Repository navigation
AC-179 - Send the context id deletion request from the ads client over OHTTP - #7630
Open
copyrighthero wants to merge 3 commits into
Open
copyrighthero wants to merge 3 commits into
copyrighthero wants to merge 3 commits into
Conversation
copyrighthero
force-pushed
the
jira/ac-179--ohttp-context-id-deletion
branch
from
October 14, 2026 02:12
b26e84a to
e2a747c
Compare
copyrighthero
force-pushed
the
jira/ac-179--ohttp-context-id-deletion
branch
from
October 14, 2026 19:53
e2a747c to
f8d3493
Compare
…timeout Adds a DELETE /v1/delete_user request builder to the MARS client so the ads client can send the context id deletion itself instead of relying on the context_id component's direct request. The request goes through MARSTransport with a 5 s timeout on the relay request and, when asked, the ads-client OHTTP channel; gateway key retrieval keeps viaduct's own timeout. When OHTTP is asked for and the channel is not configured the request fails with OhttpChannelNotConfigured rather than being sent directly. Without OHTTP the helper sends a direct request; the OHTTP-only gate lives in the ads client's rotation path. MARSTransport gains fire_with_timeout, and client_for now takes the ClientSettings to use instead of always using the default.
…r OHTTP The embedded ContextIDComponent used to send DELETE /v1/delete_user to MARS directly whenever the context id rotated, outside the OHTTP channel the ads client uses for ad requests. The ads client now disables the component's request (running_in_test_automation = true, as Firefox already does for its JS-side component) and implements ContextIdCallback itself with a small queue: rotated ids are collected and flushed right after each ad fetch, with the OHTTP setting of the request_ads call that drains them. When that call did not use OHTTP the deletion is skipped and logged. Failures are logged and not retried. Consumers that do not configure an OHTTP channel for the ads client therefore no longer send the deletion request after this change. The context id still rotates on the same schedule. The usage docs now note that the ohttp request option also applies to this deletion request. This also replaces the cfg!(test) that was passed as running_in_test_automation, a compile-time constant answering a runtime question, which meant release builds always sent the component's request.
…e_user The contract test sends the same DELETE /v1/delete_user the ads client sends after a rotation, over the production relay and gateway, prints the status, and checks that MARS answers 200. Because it writes to production and CI runs this crate with --ignored, it returns without sending unless ADS_CLIENT_PROD_DELETE_USER_CONTRACT is set; it is meant to be run by hand with --nocapture and the observed status pasted into the PR.
copyrighthero
force-pushed
the
jira/ac-179--ohttp-context-id-deletion
branch
from
October 19, 2026 15:11
f8d3493 to
3be5fbb
Compare
copyrighthero
marked this pull request as ready for review
October 19, 2026 17:31
copyrighthero
requested review from
thesuzerain
and removed request for
a team
October 19, 2026 17:31
This branch has not been deployed
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.
Send the
DELETE /v1/delete_userrequest for a retired context id from the ads client, over the same OHTTP channel as the ad request, instead of as a direct request from the embeddedcontext_idcomponent.Changes
MARSClient::delete_user(context_id, ohttp):DELETE /v1/delete_userwith{"context_id": ...}throughMARSTransport, 5 s timeout on the relay request, over theads-clientOHTTP channel when asked. If OHTTP is asked for and the channel is not configured it fails withOhttpChannelNotConfigured; there is no fallback to a direct request.DISABLE_CONTEXT_ID_COMPONENT_DELETION(true) asrunning_in_test_automation, the same thing Firefox does for its JS-side component inbrowser/modules/ContextId.sys.mjs. This replaces thecfg!(test)passed there before, which only disabled it in test builds.ContextIdDeletionQueueas theContextIdCallback: rotated ids are queued, andrequest_adstakes them before its ad fetch and sends their deletions right after it, with that call's OHTTP setting. The flush runs whether or not the fetch succeeded. Without OHTTP the deletion is skipped and logged; failures are logged and not retried.ads-clientstop sending the deletion request after this lands. The context id still rotates on the same schedule. Configuring the channel and passingohttp: trueon ad requests makes it resume.ohttprow ofMozAdsRequestOptionsin the Kotlin, Swift and JavaScript usage docs to say it also applies to the deletion request.ADS_CLIENT_PROD_DELETE_USER_CONTRACT=1 -- --ignored --nocapture). Ran it by hand: HTTP 200 observed 2026-10-14 through the production relay and gateway. It returns without sending unless the env var is set, so CI's--ignoredrun does not touch production.No changes to
ffi.rs, the binding APIs, orcomponents/context_id/.For the reviewer: the flush is synchronous inside
request_ads, so once per rotation one ad request can take longer (one relay request with a 5 s timeout, plus a 10 s gateway key fetch if the key cache is cold). If the worker direction in #7597 lands first it seems natural to move it there; happy to rebase either way. Two spots worth a close look:get_context_id()andtake_all()are separate critical sections, so an overlapping call can drain an id a different call rotated. Since #7647, requests with relevance scores skipget_context_id(), so they never rotate the id, but they still flush any ids already queued. And scope: this changes which path carries the deletion, not when it is sent; it does not address correlation by request timing. The component's own request path will be removed in a follow-up. Thank you so much for taking a look!!Pull Request checklist