Skip to content

feat(ads-client): add OHTTP support (AC-94)#7315

Draft
Almaju wants to merge 1 commit intomozilla:mainfrom
Almaju:ac-94-ohttp-support
Draft

feat(ads-client): add OHTTP support (AC-94)#7315
Almaju wants to merge 1 commit intomozilla:mainfrom
Almaju:ac-94-ohttp-support

Conversation

@Almaju
Copy link
Copy Markdown
Contributor

@Almaju Almaju commented Apr 8, 2026

Summary

  • Add ohttp: bool field to MozAdsRequestOptions and new MozAdsCallbackOptions { ohttp: bool } to opt individual requests into OHTTP routing
  • Add OHTTP support to all MARS request paths: request_tile_ads, request_image_ads, request_spoc_ads, record_impression, record_click, report_ad
  • All new options parameters use UniFFI defaults so existing callers require no changes
  • Move OHTTP_CHANNEL_ID from http_cache into client — http_cache is now generic and has no ads-client knowledge
  • Add #[uniffi(default = None/false)] to optional fields across MozAdsPlacementRequest, MozAdsCacheConfig, MozAdsRequestCachePolicy for better ergonomics in consumer code
  • Split docs/usage.md into per-language files (usage-javascript.md, usage-kotlin.md, usage-swift.md) with correct language-specific examples
  • Add NSS build steps to CI workflow (required since viaduct's ohttp feature depends on NSS)
  • Add integration test test_contract_tile_ohttp_prod against production MARS over OHTTP

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@Almaju Almaju force-pushed the ac-94-ohttp-support branch 3 times, most recently from 5654d59 to b9cd744 Compare April 9, 2026 17:17
@Almaju Almaju marked this pull request as ready for review April 9, 2026 17:27
@Almaju Almaju force-pushed the ac-94-ohttp-support branch from e1f3556 to 0e85300 Compare April 9, 2026 17:32
@Almaju Almaju changed the title feat(ads-client): add OHTTP support via enable_ohttp() builder method feat(ads-client): add OHTTP support (AC-94) Apr 9, 2026
@Almaju Almaju marked this pull request as draft April 9, 2026 19:43
@Almaju Almaju force-pushed the ac-94-ohttp-support branch 10 times, most recently from 5e46fdd to ce78337 Compare April 15, 2026 23:03
Add per-request OHTTP support via the `ohttp` flag on `MozAdsRequestOptions`
and `MozAdsCallbackOptions`. When enabled, individual MARS requests are routed
through viaduct's OHTTP layer with automatic preflight for geo/user-agent
override headers.

- Add `ohttp: bool` parameter to fetch_ads, record_click, record_impression,
report_ad and all public API methods
- Add `MozAdsCallbackOptions` FFI type for callback OHTTP support
- Add `mars/preflight.rs` with PreflightRequest/PreflightResponse types
- Preflight responses cached via HttpCache (CacheFirst with default TTL)
- Add `FetchAdsError::Preflight` variant for preflight failures
- Add OHTTP integration test against prod
- Update usage docs for all platforms (JavaScript, Kotlin, Swift)
@Almaju Almaju force-pushed the ac-94-ohttp-support branch from ce78337 to c3fbfd1 Compare April 16, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant