feat(ads-client): add MozAdsContextIdProvider callback interface (AC-95)#7278
Draft
Almaju wants to merge 3 commits intomozilla:mainfrom
Draft
feat(ads-client): add MozAdsContextIdProvider callback interface (AC-95)#7278Almaju wants to merge 3 commits intomozilla:mainfrom
Almaju wants to merge 3 commits intomozilla:mainfrom
Conversation
The /v1/t tracking endpoint requires a `reason` query parameter for report interactions. Add MozAdsReportReason enum with Inappropriate, NotInterested, and SeenTooManyTimes variants and thread it through the full stack, appending it to the callback URL before the request.
Introduces an optional `context_id_provider()` method on `MozAdsClientBuilder` that accepts a `MozAdsContextIdProvider` UniFFI callback interface. When set, the embedded `ContextIDComponent` is not created — the caller's implementation is used instead. `rotation_days` is silently ignored (with a log warning) when an external provider is supplied. This allows HNT to wire its existing `ContextId.sys.mjs` (which handles storage, rotation, and MARS deletion via OHTTP) directly into the ads client, eliminating the competing throw-away UUID the client was generating internally. Mobile consumers that do not set a provider are completely unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes AC-95.
Summary
AdsClientwas internally creating a throw-away UUID viaContextIDComponentwithDefaultContextIdCallback, completely disconnected from HNT's ownContextId.sys.mjssystem (which handles storage in prefs, rotation, and MARS deletion via OHTTP).This PR introduces an opt-in
MozAdsContextIdProvidercallback interface that lets embedders supply their own context ID:MozAdsContextIdProviderUniFFI callback interface with a singlecontext_id() -> Stringmethod — consumers implement this in JS/Swift/Kotlin and cache the value synchronouslycontext_id_provider()builder method onMozAdsClientBuilderContextIDComponentis not created;rotation_daysis ignored (logged as a warning)HNT will implement
MozAdsContextIdProviderin JS, backed byContextId.sys.mjs, which continues to own rotation and MARS deletion unchanged.Pull Request checklist
[ci full]to the PR title.get_context_id()dispatching toContextIdSource::Externallog = "0.4"— already used across the workspace, no due diligence required