Skip to content

Verify awaited identity lookups and save /auction body EIDs - #1642

Open
dhruv8sh wants to merge 15 commits into
feat/record-backend-edgezerofrom
feat/providers-awaited
Open

dhruv8sh wants to merge 15 commits into
feat/record-backend-edgezerofrom
feat/providers-awaited

Conversation

@dhruv8sh

Copy link
Copy Markdown
Collaborator

Summary

  • Pins ID-4 and WB-1 on Fastly with tests: a provider that answers within the deadline has its ID in the row and the mirror cookie of the same navigation (including the real ID5 provider); a late one is skipped without delaying the response; identity cookies are set only on navigations.
  • Removes the request-local thread_local for Fastly page lookups: the handler collects them once the response status is known, before finalize, and carries only the results on the EC context.
  • Saves /auction request-body EIDs to the EC row again (ID-8), under browser-ingest rules, in one conditional write to an existing row. /auction is not a page load, so "a page load writes the record once" still holds.

Changes

File Change
crates/trusted-server-adapter-fastly/src/app.rs Page lookups collected in the handler (no NAVIGATION_LOOKUPS thread-local); after-response signals move into EcFinalizeState. Tests: page_lookup_within_the_deadline_reaches_the_record_and_the_mirror_cookie, page_lookup_past_the_deadline_is_skipped_without_delaying_the_response, id5_lookup_reaches_the_minted_record_and_the_mirror_of_the_same_navigation, identity_cookies_are_set_only_on_navigations_and_may_expire_anywhere.
crates/trusted-server-adapter-fastly/src/main.rs, post_delivery.rs Finalize takes the collected results instead of draining lookups itself.
crates/trusted-server-core/src/ec/kv.rs New KvIdentityGraph::commit_auction_ingest: one conditional write to a live row the request read; never creates or recovers a row, no retry.
crates/trusted-server-core/src/ec/finalize.rs, ec/mod.rs, auction/endpoints.rs /auction passes its body EIDs to finalize (fill-missing, consent-gated, SharedID opt-out applied, provider-owned sources protected); cookies still wait for the next navigation. New finalize tests; the endpoint test now expects the EIDs saved.
docs/superpowers/specs/2026-10-30-s2s-eid-collection-design.md, docs/guide/edge-cookies.md, CHANGELOG.md Document /auction body EID persistence (D1, §5.4, §5.5, §12.3), the WB-1 rule, and the Axum deferral.

WB-1 reading: identity cookies are set only on navigation and EC route responses; expiry Set-Cookie headers (withdrawal, mirror revocation) may appear on any response.

Not in this PR:

Closes

Closes #1591

Spec

Spec: server-side identity on every adapter, ID-4, ID-5, WB-1

Test plan

  • cargo test-fastly && cargo test-axum (also test-fastly-reuse, test-cloudflare, test-spin, parity, build-digest, CLI tests)
  • cargo clippy-fastly && cargo clippy-axum (all clippy aliases, including CLI and codegen)
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run (3350 pass; test/trace/collector.test.ts "invalidates capture on checked eviction overflow" times out locally at ~16 s vs 15 s, also on the base branch, with no JS change in this stack)
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: scripts/lint-wasm-clock.sh

Checklist

  • Feature PRs: spec linked above, ending in a review log of two or more agent review rounds
  • Changes follow AGENTS.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • New code has tests
  • No secrets or credentials committed

Fastly already starts provider lookups at navigation, collects them against one shared deadline inside the single finalize bridge and writes their IDs in the page-load write. These tests pin the acceptance criteria: a lookup answering within the deadline reaches the record and the mirror cookie of the same navigation response, one past the deadline is skipped and releases the response at the deadline, the registered ID5 provider puts its UID in the minted record and the mirror of the navigation that mints the EC, and identity cookies are set on navigations but never on subresource, auction or page-bids responses.

Part of #1591 (ID-4, WB-1).

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
The Fastly navigation parked its in-flight provider batch and its after-response signals in a request-local thread_local for finalize to take. The batch is not Send, so it cannot ride in response extensions. The handler now collects the page-phase lookups once the response status is known, skipping a redirect as before, and the results reach finalize on the EC context. The after-response signals travel in EcFinalizeState. Lookups still start before the origin fetch, so their wait overlaps it, and still complete before EC finalization.

Tests drive routing on the fixture clock so collection can reach the lookup deadline.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
ID-8 keeps main's behaviour: EIDs in the /auction request body are saved to the record. /auction is not a page load and holds no page-load permit, so the body EIDs go in one conditional write of their own (KvIdentityGraph::commit_auction_ingest) under browser-ingest rules: consent-gated, SharedID opt-out applied, filling only partner UIDs a live row lacks and never a provider-owned source. The row must have been read live; the write never creates or recovers a row and a conflict drops the EIDs without a retry. The request's ts-eids and sharedId cookies are still left to the next navigation, so the endpoint now hands finalize only the body's EIDs.

The navigation's single page-load write is unchanged. Update the S2S EID collection spec, the edge cookies guide and the changelog, which said body EIDs are never stored.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…rral

Identity cookies are set only on navigation and EC route responses; expiry Set-Cookie headers for a withdrawal or a mirror revocation are allowed on any response. Rename the Fastly test and let it ignore expiries, and say so in the S2S spec. Note in the spec that Axum's after-response follow-up writes (ID-5) are deferred to #1581.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
@dhruv8sh dhruv8sh self-assigned this Nov 20, 2026
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
@dhruv8sh
dhruv8sh added this pull request to stack #1645 November 20, 2026 01:58
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
PR #1532 now reads the native Geo profile path from
TRUSTED_SERVER__NATIVE_GEO_PROFILE_FILE instead of TS_NATIVE_GEO_PROFILE_FILE. No file in this PR
uses the old name after the merge, so the merge only takes the rename from
PR #1641. The merge had no conflicts.
@aram356

aram356 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

For #1532's rename of the native Geo profile variable to TRUSTED_SERVER__NATIVE_GEO_PROFILE_FILE, I pushed 9cad92896 here, one merge of this PR's base:

No file in this PR uses the old name after the merge, so it only takes the rename from #1641. The merge had no conflicts.

Correction: through #1566, this merge also carries five #1540 commits that #1566 had not merged before (CloudFront forwarding authentication, AWS ingress and Terraform demo prerequisites, the example deployment gate and the deployment guide). It is not only the rename.

dhruv8sh added a commit that referenced this pull request Nov 24, 2026
Keeps the finalize mirror return and FinalizeRequest from this branch on top of
the base's ineligible-cookie filter, and moves #1642's /auction tests to
FinalizeRequest.
dhruv8sh added a commit that referenced this pull request Nov 24, 2026
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize. They
arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623,
#1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540,
#1566, #1624 and #1641, with #1536's, #1535's, #1566's and #1624's moves of
their finalize calls onto FinalizeRequest. It also brings d5276ee, which
publishes the native AWS runtime files without GNU mv -T, and Christian's
merge 5597d3e of #1538 into #1540, through #1566's merge.

The base now also carries the Axum serving line (#1613, #1616, #1617, #1615,
#1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which
decodes the Spin discovery document with Response::json, and #1627's merge
of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI.

Fastly adapter imports: the merge takes #1489's imports for the request
time and FinalizeRequest and keeps this PR's removal of the identity
coordinator import, since page lookups are now collected in the handler.
apply_edgezero_ec_finalize keeps this PR's body and #1489's navigation-only
request time.

EC finalize: #1489 runs the page-load write only with the request time,
which the adapters read only for a navigation with an eligible response.
This PR's /auction body EID write is not a navigation and gets no request
time, so it stays outside that gate as the first branch and plans its
write at the clock read when it runs, as it did before. A clock failure
there plans at time 0, as before this merge, where the page-load write is
skipped. The imports keep current_timestamp and EidSyncSource for it.

EC finalize tests: finalize_auction_request, the helper of this PR's
/auction body EID tests, passes a FinalizeRequest with no request time, as
the adapter does for /auction, so the tests show the body EIDs are saved
without one. finalize_saves_auction_body_eids_to_missing_partner_uids keeps
this PR's two calls and assertions with #1489's NOW_SECS row seed.

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

Restacking on the Axum serving line conflicts in the Fastly app.rs and
main.rs, where #1617 wraps the request lifecycle in with_finalization,
while this PR removes the request-local lookup slot.

After-response lookups: this PR's AfterResponseLookups stays in the
Fastly adapter, after IdentityLookups, and keeps its #[derive(Clone)],
since EcFinalizeState, which now carries the work to post-delivery,
derives Clone. It also keeps the base's Referer and Accept-Language
fields from #1488. collect_identity_lookups keeps this PR's doc.

Fastly entry point: serve sends the request through #1617's
with_finalization without this PR's removed take_navigation_lookups calls,
and finalize_response keeps #1617's comment that trace and operational
responses are left untouched, without the removed slot read.

Identity conformance: #1613's Fastly conformance runner no longer drains
the request-local lookup slot before and after each request, since this PR
removes it.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.

The base now also carries #1627's 4d0c1a2, which renames the generic
runtime KV store to trusted_server_runtime_kv while the rebuilt #1537
merge keeps trusted_server_kv declared for EC records, and #1488's
a610152 and 9104fd3, which add hashed-email intake for the LiveRamp
and ID5 identity providers.

Fastly page lookups: #1488 replaces dispatch_identity_lookups with
PageIdentityDispatch, prepared before the origin fetch and started, after
any hashed-email status call, inside a join with it, and hands the
started lookups to the request-local slot. This PR removes that slot and
collects the lookups in the handler once the response status is known.
The merge keeps #1488's prepare, start and join, and the join's lookups
go to this PR's page_lookups, which collect_identity_lookups awaits after
the response, with this PR's comments that the handler collects them.
aram356 added a commit that referenced this pull request Nov 25, 2026
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize. They
arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623,
#1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540,
#1566, #1624, #1641, #1642 and #1646, with #1646's move of the request
time into IdentityApp::finalize. It also brings d5276ee, which publishes
the native AWS runtime files without GNU mv -T, and Christian's merge
5597d3e of #1538 into #1540, through #1566's merge.

The base now also carries the Axum serving line (#1613, #1616, #1617, #1615,
#1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which
decodes the Spin discovery document with Response::json, and #1627's merge
of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI.

This PR already carries #1646's head 461aa0d, so the merge adds only
#1646's new merge 166944769 of #1642 and the chain below it, including the
identity conformance check that now strips the mirrored UID's exp.

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

Restacking on the Axum serving line conflicts in the Axum startup tests,
where #1617 waits for /ready, since liveness stays up after a caught
initialization failure, and this PR rewrites the wait to retry a port
collision and to require the child's own ready lifecycle event.

Axum startup tests: wait_ready keeps this PR's collision retry and
lifecycle check, then probes #1617's /ready and returns the /health
response once the child is ready.

The fixture drains each child's output through this PR's log readers, so
#1617's assert_serves_failure_router reaps the stopped child and reads
those captured logs instead of collecting the pipes, which the readers
already own.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.

This PR now stacks on #1661 instead of #1646, so rc/identity can take both
as plain merges. #1661 sits on #1656 and #1626, which sit on #1646, so the
merge also brings #1626 (provider opt-outs and legacy EID expiry on Fastly
and Axum), #1656 (the configurable Edge Cookie browser gate) and #1661
(refusing EC creation when a trusted JA4 contradicts the User-Agent).

Fastly identity conformance fixture: #1661 records each scenario's runtime
TLS JA4 through a RuntimeTlsJa4 middleware in place of derived device
signals, takes the User-Agent from the scenario and drops the browser flag.
This PR adds geo consent requests with their own trusted client IP settings
and no browser device signals. The merge assembles the conformance app with
#1661's middleware and keeps this PR's geo_configured flag and
producer_settings. It sends the scenario's User-Agent unless the API request
supplies one, and inserts the scenario's JA4 only for requests without a geo
consent exchange, because this PR derived device signals only for those.

The base now also carries #1627's 4d0c1a2, which renames the generic
runtime KV store to trusted_server_runtime_kv, #1488's a610152 and
9104fd3, which add hashed-email intake for the LiveRamp and ID5
identity providers, #1646's aa31559, which gates identity writes for
rejected clients, and #1626's d07f789, which withholds a mirrored UID
while another source owner is opted out.

Fastly conformance JA4: the rebuilt #1661 merge supplies a trusted Python
JA4 behind the Chrome User-Agent for #1646's known non-browser API
requests, and this PR inserts the scenario's JA4 only without a geo
consent exchange, with its producer_settings. The merge keeps both: a
known non-browser request gets the Python JA4, any other request the
scenario's JA4 unless it is a geo consent exchange.

This PR's head moves to e8015ca, its clean merge of #1646's aa31559,
which the base already carries, so it adds no change beyond the base.

Axum lib.rs: the base now carries #1636, through #1626's merge of it, whose
after_response_drain_tests module sits where this PR adds its
geo_conformance module. The crate keeps both test modules.
aram356 added a commit that referenced this pull request Nov 25, 2026
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize. They
arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623,
#1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540,
#1566, #1624, #1641, #1642 and #1646, with #1646's move of the request
time into IdentityApp::finalize. It also brings d5276ee, which publishes
the native AWS runtime files without GNU mv -T, and Christian's merge
5597d3e of #1538 into #1540, through #1566's merge.

The base now also carries the Axum serving line (#1613, #1616, #1617, #1615,
#1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which
decodes the Spin discovery document with Response::json, and #1627's merge
of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI.

The merge also brings the 12 #1646 commits this PR lacked, from 48a43ae
to 461aa0d: dhruv8sh's page-phase lookup and /auction EID work
(48a43ae, 82fe088, 1d0a74f, 838586e and his chain merges a061c01,
ecf16e8, e1d23a0, edcf4c5 and 9a020e1), the merge 9cad928 of
#1641 into #1642, and prk-Jr's "Merge providers-awaited into shared
identity" (4ffbaf8) and "Restore Fastly auction browser gating"
(461aa0d).

Edge cookies guide: a conflict is the request lifecycle paragraph.
The merge takes #1646's sentences on positive identity cookies, core
expiries and /auction body EIDs, and keeps this PR's closing sentences on
the default ec.sliding_refresh = false flow and sliding renewal.

Fastly adapter tests: 82fe088 from #1646 removed the navigation-lookups
thread-local and the page-lookups argument of apply_edgezero_ec_finalize,
since the handler now collects page lookups onto the EC context. This PR's
sliding_ec_renews_held_publisher_identity_before_terminal_privacy test
drops its two take_navigation_lookups calls and passes no page lookups to
finalize. Its configuration has no record store or providers, so no
lookups were collected before either, and its assertions are unchanged.

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.

This PR now stacks on #1661 instead of #1646, so rc/identity can take both
as plain merges. #1661 sits on #1656 and #1626, which sit on #1646, so the
merge also brings #1626 (provider opt-outs and legacy EID expiry on Fastly
and Axum), #1656 (the configurable Edge Cookie browser gate) and #1661
(refusing EC creation when a trusted JA4 contradicts the User-Agent).

Cloudflare route tests: both PRs add a test at the end of the file. The
merge keeps both, this PR's
sliding_ec_configuration_preserves_unsupported_platform_responses and
#1661's ec_route_creates_no_record_whatever_the_bot_management_ja4.

Fastly sliding EC test: #1617, which now sits below this PR, answers GET
/health through the router's probe hook as an operational response, which
carries no EC state. This PR's
sliding_ec_renews_held_publisher_identity_before_terminal_privacy routes
/health through the router and expected EC state on every path but the
unsupported EC route, so it now also accepts the liveness probe without EC
state. Its check that /health issues no renewal cookie is unchanged.

The base now also carries #1627's 4d0c1a2, which renames the generic
runtime KV store to trusted_server_runtime_kv, #1488's a610152 and
9104fd3, which add hashed-email intake for the LiveRamp and ID5
identity providers, #1646's aa31559, which gates identity writes for
rejected clients, and #1626's d07f789, which withholds a mirrored UID
while another source owner is opted out.

Settings: this PR's MaxAgeDays and #1488's HashedEmailSource are both
added before Ec in settings.rs; the merge keeps both.

This PR's head moves to fbe5670, its merge of #1646's aa31559, which
models admitted clients in the core sliding tests, finalizes them with
the store gate and adds refused_client_gets_no_renewal_or_record_io, and
adds the proposal's review log. Taken as the change from the old head
668d501, the new head would replay #1646 commits the base already
carries in rebuilt form. The merge takes only fbe5670's own resolution,
the change from a plain merge of 668d501 and aa31559 to fbe5670:
the sliding tests and the proposal apply cleanly, and its Fastly sliding
test port is the one this merge already made.
aram356 added a commit that referenced this pull request Nov 25, 2026
…1622 into rc/identity

#1622 (244ca26) now carries the whole chain, each PR merging the one below
it:

- #1506 (c197404) repins EdgeZero to rc/identity at d063a8e7, which
  carries EdgeZero main's Fastly SDK 0.13.3 upgrade through every EdgeZero PR
  here, and merges Trusted Server main's upgrade (#1671): fastly 0.13.3, url
  2.5.9 and Viceroy 0.22.0.
- #1614, #1525, #1526, #1487 and #1488 take it in turn. #1488 also adds
  b2d4bfd, which records known UID hashes with a setter.
- #1489, the identity spine (#1639, #1640, #1612, #1628 and #1623), #1531 and
  #1532.
- The Axum serving line: #1613, #1616, #1617, #1615, #1635, #1637 and #1627,
  chained, with #1627's b958107 decoding the Spin discovery document with
  Response::json and #1627's merge of #1625, which brings #1625's Wrangler pin
  into the chain.
- The held line on #1627: #1533, #1534, #1536, #1535, #1537, #1539, #1538,
  #1540, #1566, #1624, #1641, #1642 and #1646. #1646 keeps its own shared
  after-response runner in ec::app::lookups.
- #1636 (72096cd) on #1646 (b5a5f62), draining Axum
  after-response identity tasks on SIGTERM through #1646's shared runner.
- The EC route line on #1636: #1626 (067531e), which merges #1636, the
  draft #1656, #1661, #1662 and #1622, and through #1622's merge of it,
  #1620's round-6 head.

Each conflict was resolved in the PR that sits higher. This merge is clean.

Since the last update the chain also takes #1488's hashed-email intake
(a610152 and 9104fd3) and its POST, body and header options for the
status call (f063a76), #1627's split of the generic runtime KV store into
trusted_server_runtime_kv (4d0c1a2), #1646's gate on identity writes for
rejected clients (aa31559) its native container test of the failure router
(4f4c036) and that test's header check on an ordinary route (71a573a),
#1626's withholding of a mirrored UID while another source owner is opted
out (d07f789), and #1617's description of the Axum startup failure router
(6d174a8) and of the startup failures that still exit before listening
(4c07cad). #1636 no longer sits in the Axum serving line; it arrives
through #1626, which merges it on top of #1646. Its new head adopts #1646's
after-response runner in place of the one rc/identity took with cf1102c.

Cloudflare guide: #1627's merge of #1625 now keeps both #1625's tool version
clause and #1627's TRUSTED_SERVER_RUNTIME_KV binding in the smoke paragraph,
and fixes #1625's smoke script test for #1617's Python floor and Worker
build, and #1537's merge fixes its ts stub for #1537's storage template
step, so this merge needs no resolution.
@aram356

aram356 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed f654f67ef, a merge of #1641's new head e2f1f6975. It brings the Axum serving line, including #1617's with_finalization and #1613's conformance runner, #1488's hashed-email intake and PageIdentityDispatch, #1489's FinalizeRequest and request time, and #1506's repin of EdgeZero to rc/identity at d063a8e7 with main's Fastly SDK upgrade (#1671). Resolutions:

#1641's new head 739161e brings #1537's b181544, "Accept any Fastly EC
store link name at startup", which #1537's owner merged up through #1539,
#1538 and #1540. The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 85436785d, a merge of #1641's new head 739161ea0. It brings #1537's b181544a0, "Accept any Fastly EC store link name at startup", which #1537's owner merged up through #1539, #1538 and #1540. The merge had no conflicts.

Takes #1641's new head 0a18d37, which carries #1506's repin of EdgeZero to
rc/identity at 459bd27d (42e0c46): PR 275 at 0e2a58ae, the stack's test
fixes and EdgeZero 536's bounded record update, RecordHandle::update.

The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed f2c268ae7, a merge of #1641's new head 0a18d37aa, which brings #1506's repin of EdgeZero to rc/identity at 459bd27d (42e0c46c7): EdgeZero #275 at 0e2a58ae, the EdgeZero stack's test fixes and EdgeZero #536's bounded record update, RecordHandle::update. The merge had no conflicts.

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. This PR moves Fastly page-phase identity lookup collection out of the NAVIGATION_LOOKUPS thread-local and into the handler. Collection now runs once the response status is known, a redirect drops the batch without waiting, and only the Send results travel on EcContext. After-response work now goes to post-delivery on EcFinalizeState. The PR also adds tests for ID-4 and WB-1 on Fastly, and it saves /auction body EIDs to a live row again (ID-8) through a separate conditional write, commit_auction_ingest.

I traced the following and found no blocking problems:

  • Lifecycle: removing the thread-local leaves nothing that can outlive the request. Detached responses never had page lookups to release. The after_response handoff still runs after apply_edgezero_ec_finalize, which sets the after-response permit, so post-delivery gating is the same as before.
  • /auction ingest gating:
    • It runs only after the consent_allows_ec early return. The updates pass through gate_eid_updates_by_consent (Purpose 1 + 4) and the SharedID opt-out filter.
    • plan_write refuses a non-consented row or a snapshot without a generation. apply_browser_ingest skips provider-owned sources and fills only vacant ones.
    • It writes only for a returning EC with a live, consented row (no create, no orphan recovery), and it does not write when nothing changes.
  • Cookie fallback: the ts-eids cookie fallback still reaches bidders but is no longer put on ec_context, so the cookie is not persisted from /auction.
  • Cookies on /auction: finalize passes now: None on /auction, so no mirror cookie is set there, which matches WB-1.

One non-blocking finding is inline: /auction adds a writer whose write can conflict with an in-flight navigation's page-load write, which the spec text says is unaffected.

Verification

  • Native cargo test -p trusted-server-core --lib -- auction ec::finalize ec::kv: 645 passed at f2c268ae7.
  • Broken control: with the commit_auction_ingest call removed, finalize_saves_auction_body_eids_to_missing_partner_uids and auction_body_eids_reach_context_and_kv fail. finalize_auction_body_eids_never_create_a_row passes either way, as a guard on absence should.
  • The Fastly adapter tests (the new ID-4/WB-1 tests) were not run locally because the local Viceroy is older than the pinned 0.21.0. I rely on CI cargo test, which passes at this head.
  • CI at f2c268ae7: everything passes except local-provider-image, which fails with invalid-envelope must not listen. The base head 0a18d37aa (#1641) fails the same assertion and this PR does not touch that image, so the failure is pre-existing and unrelated.

Comment on lines +271 to +273
and a conflict drops the EIDs without a retry. This does not break "a page load
writes the record once": `/auction` is not a page load, holds no page-load
permit, and the navigation's own write is unchanged. The `/auction` request's

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: "the navigation's own write is unchanged" holds for its code path, but /auction is now a writer that can make that write fail.

A navigation plans its page-load update against the generation it read at request start and writes it at finalize, after the origin fetch and the lookup budget. Per D4, a Conflict there is not retried. Suppose an /auction from the previous page (or another tab) fills a missing partner UID inside that window. Its commit_auction_ingest moves the generation, so the navigation's conditional write is dropped, along with that navigation's provider lookup results and cookie ingest. Mirror changes then wait for a later navigation.

The window is bounded because /auction writes only when its body fills a vacant source, so I don't think the code needs to change. Please add a sentence here, e.g. "an /auction save that lands between a navigation's read and its write makes that navigation's write conflict (D4)", so the spec does not claim the navigation is unaffected.

#1641's new head 962572a brings #1539's cf4e815, "Expect the failure router in the native container test". The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 582327226, a merge of #1641's new head 962572ae1, which brings #1539's cf4e815d4, the native container test's failure-router expectation. The merge had no conflicts. It clears local-provider-image, which failed here with "invalid-envelope must not listen".

Takes #1641's new head 04cb794, which carries #1506's repin of EdgeZero to
rc/identity at 1619078a (8edc50e), a revert that removes EdgeZero 522
(portable Fastly record providers) and 524 (outbound mTLS client
identities).

The merge is clean.
@aram356

aram356 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 3b6b8b588.

Takes #1641's new head 04cb794, which carries #1506's repin of EdgeZero to rc/identity at 1619078a (8edc50e), a revert that removes IABTechLab/edgezero#522 (portable Fastly record providers) and IABTechLab/edgezero#524 (outbound mTLS client identities).

The merge is clean.

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed #1642 against the live head of #1641. I ran focused probes against this revision and left inline notes on the auction write and what the Fastly tests cover.

return;
}
let Some(RowChange::Update { entry, expected }) =
commit.plan(ec_context, commit.ec_id, ec_context.kv_snapshot(), None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the SharedID migration out of auction ingest. I tested a row with a legacy sharedid.org UID, an auction carrying _pubcid_optout, and a new body EID for an unrelated partner. The CAS saved the unrelated EID and moved the opted-out UID to pubcid.org. It did the same when pubcid.org was provider-owned. drop_opted_out_sharedid_updates filters the incoming EIDs, but plan_write still runs refile_legacy_sharedid on the stored row. Can we leave that migration to navigations and add a regression test that reads back both entries after the auction?

}

#[test]
fn page_lookup_within_the_deadline_reaches_the_record_and_the_mirror_cookie() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exercise a successful document response in the ID-4 tests. I ran both deadline tests and the ID5 test under Viceroy 0.22.0. All three passed with /article returning 502: the fixtures script the provider but not the publisher origin. That checks the row and mirror on an error response, and misses a regression that starts provider work after the origin finishes. Could we script a delayed 200 HTML response, assert success, and check the recorded sends for overlap? The late case should distinguish the original cutoff from a fresh budget started after the origin returns.

),
(
"auction API",
browser_request(Method::POST, "/auction", "empty"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use admitted requests for the WB-1 API cases. Under Viceroy this test passed with /auction returning 400 for the empty body and /_ts/page-bids returning 403 at the admission check. It would miss a cookie set only on success. Please send valid consented requests with a live row and assert success before checking headers. Include the configured SharedID cookie and its _cst companion in the matcher, while still allowing expiry headers.

Comment on lines 228 to +229
TS-->>B: Auction response + x-ts-eids header when available
TS->>KV: Add missing partner UIDs from request eids[]<br/>+ ts-eids/SharedID cookies (TCF Purpose 1 + 4 under GDPR)
TS->>KV: Add missing partner UIDs from request eids[]<br/>to a live row (TCF Purpose 1 + 4 under GDPR)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: show the CAS before delivery. Fastly awaits the auction write in response finalization, before sending the response. The design spec's §9.1 also still says no other request can write at all; that should refer to the permit-gated navigation write and point to the separate auction CAS in §5.4.

Suggested change
TS-->>B: Auction response + x-ts-eids header when available
TS->>KV: Add missing partner UIDs from request eids[]<br/>+ ts-eids/SharedID cookies (TCF Purpose 1 + 4 under GDPR)
TS->>KV: Add missing partner UIDs from request eids[]<br/>to a live row (TCF Purpose 1 + 4 under GDPR)
TS->>KV: Add missing partner UIDs from request eids[]<br/>to a live row (TCF Purpose 1 + 4 under GDPR)
TS-->>B: Auction response + x-ts-eids header when available

This branch has not been deployed

No deployments
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.

Providers in the shared app, awaited before finalization

4 participants