Repository navigation
Conversation
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Reviewed c012ddf0d against feat/s2s-eid-vendors (b990702ea). The range includes the #1712 retry-memory commit via merge dad2dce73; comments here are about this PR's own changes.
Approving so I'm not blocking, on the understanding that you'll handle the comments before merging. R1 needs a decision before this lands: it's a broader consent change than #1548 asks for, and I'd like the stack owners to agree to it explicitly or have the combined gate restored. R2 is a small retry-memory bug.
Checks: focused core tests on the touched modules.
| /// | ||
| /// Owned UIDs use their recorded owner's consent. Ownerless legacy UIDs | ||
| /// retain the source's existing aggregate vendor gates. | ||
| pub(crate) fn uid_allowed(&self, source: &str, uid: &KvUid, consent: &ConsentContext) -> bool { |
There was a problem hiding this comment.
R1 · Decision needed: owned UIDs no longer need the source's combined vendor consent. Before, every stored UID for a source was withheld unless all vendors claiming that source had consent, including disabled providers' vendors via keep_vendor_gate. Now an owned UID checks only its owner. Example: source S moves from disabled provider old (vendor B) to new (vendor A). A visitor who consents to A but not B now gets new's UIDs for S. Before, they were withheld.
Browser-sent EIDs for the same source still use the combined gate (auction/endpoints.rs:661-671), so one source now has two consent rules. from_ec_with_kinds_keeps_a_disabled_providers_gate_on_a_reassigned_source still says the source is "withheld while the disabled provider's vendor lacks consent", which no longer governs owned UIDs. The guide also lost the sentence saying the gate covered "every ID for those sources, whether a provider stored it or the browser sent it".
#1548 only asks that egress check the owner is still configured. The smallest change that keeps the old contract is providers.allows(...) && !partner.owner_vendor_consent_denied(consent). If relaxing it is a deliberate product call for the stack, that's fine, but please get the stack owners to sign off, document the stored-vs-browser difference in the guide, and update that registry test.
| ProviderLookup { | ||
| provider: registered.id.clone(), | ||
| status, | ||
| retry: status.retry_action(), |
There was a problem hiding this comment.
R2 · P3: a response whose IDs are all for GDPR-excluded sources still clears retry memory. retry is fixed here from the initial status, so a vendor that returned IDs gets RetryAction::Clear. After the merge, exclude_sources drops the GDPR-excluded sources and recount_found downgrades the status to NoMatch, but retry stays Clear, and plan_write removes the deadline. For a GDPR visitor where the vendor only returns an ID for an excluded source, the due source is retried on every navigation, which contradicts the new spec §8.3 ("an empty validated result classified as NoMatch" records an hour). In exclude_sources, when filtering turns a Found/Clear into NoMatch, set retry = RetryAction::NoMatch (leave cookie-derived Preserve and Failure alone), and add a test with only an excluded source in the response. I traced this path in the code but didn't run it.
| /// .with_provider_config(&settings.ec.identity_providers); | ||
| /// ``` | ||
| #[must_use] | ||
| pub fn with_provider_config(mut self, providers: &[IdentityProviderConfig]) -> Self { |
There was a problem hiding this comment.
R3 · Nonblocking: owner configuration exists in two copies. The policy is built once into PartnerRegistry.providers (used by plan_write, egress and admin) and again into KvIdentityGraph.providers, which is only set through the with_provider_config builder. A graph built without it skips pruning silently, and the two can disagree; the Fastly fixture had to rewrite settings.ec.identity_providers to line them up (app.rs:3765-3768). Fastly also rebuilds the graph copy per maybe_identity_graph call. Since egress is already enforced by the registry and #1548 says "pruned or not served", I'd either keep pruning only in plan_write and admin and drop the graph-level copy, or pass the registry's ConfiguredProviders into the graph as a required argument.
| if !record.is_provider_written() { | ||
| return true; | ||
| } | ||
| let mut entry = KvEntry::tombstone(created); |
There was a problem hiding this comment.
R4 · Nonblocking: owner and lifetime sanitizing is duplicated. normalize_provider_expiries(); prune_unconfigured_owners(...) appears here, in kv.rs prepare_entry and entry_for_write, and in write_plan.rs:70-71. KvPartnerId::retain_uids is a fourth copy of the retain/drop-empty/resync shape in prune_expired, retain_readable and drop_last_uid. This function also wraps one record in a fake KvEntry::tombstone just to reach entry-level pruning, and the ownerless gate in eids.rs:133-137 repeats uid_allowed's ownerless branch. A record-level retain_servable, one KvEntry helper running both steps, and a single ownerless gate would cover all of it.
| "should mark {source}" | ||
| ); | ||
| } | ||
| registry.providers = super::super::registry::ConfiguredProviders::new(&[ |
There was a problem hiding this comment.
R5 · Nonblocking: owner-policy fixtures are copied ten times. This registry.providers = ConfiguredProviders::new(&[serde_json::from_value(json!({...}))]) shape repeats across write_plan, identify (×4), eids, coordinator, after_response and admin (×2), mostly as single lines over 100 columns that rustfmt can't wrap. providers is pub(crate) largely so tests can overwrite it. One test helper (for example test_support::owner_registry(...)) with a multi-line json! would cut this and let providers go private.
| matches!(only_status(&results), LookupStatus::Found { .. }), | ||
| "should make a fresh lookup for the new owner" | ||
| ); | ||
| assert!( |
There was a problem hiding this comment.
R6 · Nits: this should be assert_eq!(transport.sent.borrow().len(), 1, ...). Also: seven new tests have no blank line before them (validate.rs:513, eids.rs:457, identify.rs:1199, kv.rs:4823, write_plan.rs:1729, admin.rs:1794, coordinator/mod.rs:5020), 18 added lines exceed 100 columns (the R5 fixtures), several new tests skip the Arrange/Act/Assert layout AGENTS.md asks for, and the "#1488 is gated on #1547" note in docs/guide/configuration.md:1021 and spec §8.3 is process state that goes stale once the stack merges.
dhruv8sh
left a comment
There was a problem hiding this comment.
Summary
This PR caps every provider-written UID at 30 days, measured from acquired_at, or from the row's created time for legacy UIDs. Stored UIDs are now gated by their recorded owner, which must still be configured for the source and must have vendor consent. The gate covers auction user.eids, x-ts-eids, identify and the admin export. The graph and plan_write prune orphaned owners on writes. The PR also adds a per-provider retry_after memory: one hour after NoMatch, five minutes after a failure. Both the page write and the after-response write persist it, and success or a fresh opt-out clears it.
I traced the egress paths (live_eids, source_views, identify, admin auction view and provider StoredEids). I also traced the merge order in collect and merge_entries across early skips, cookie results and transport results, and how the graph and registry pick up provider config. I found no correctness problems. Production registries come from from_ec_with_kinds, which now goes through from_ec, so they carry the provider config. Every runtime graph is built through maybe_identity_graph / require_identity_graph, which call with_provider_config. The remaining findings are non-blocking.
Non-blocking
🤔 thinking
- Legacy UIDs on older rows expire immediately — see inline at
crates/trusted-server-core/src/ec/kv_types.rs:512
♻ refactor / ⛏ nitpick / 📝 note
raw_bodyis now never populated — see inline atcrates/trusted-server-core/src/ec/admin.rs:221PartnerRegistry::providersis a mutablepub(crate)field that tests set directly — see inline atcrates/trusted-server-core/src/ec/registry.rs:156- Internal PR-gating note in operator docs — see inline at
docs/guide/configuration.md:1021 - Spec §10 describes mirror code that isn't on this branch — see inline at
docs/superpowers/specs/2026-10-30-s2s-eid-collection-design.md:1621
👍 praise
- Test that covers every graph writer — see inline at
crates/trusted-server-core/src/ec/kv.rs:4894
Cross-cutting / body-level findings
- 📌 Scope: the retry-after feature is bundled with the lifetime/owner change. The title covers bounded lifetimes and owner gating. The diff also adds a whole retry-memory feature:
RetryAction,KvEntry.retry_after, the newcan_changecondition inafter_response, the early-skip merge incollect, and new documentation sections. The retry-after work also changes the meaning of several existing tests:an_unchanged_cookie_is_not_rewritten_while_another_source_is_due, the browser-ingest tests inwrite_plan, and the old "other provider's refresh state" test. Each of these used to assert "no write" and now accepts a retry-only write. That is consistent with the new design, but reviewers should judge it as a separate behaviour change. Please call it out in the PR description, or split it out if it is meant to land on its own (the docs say #1547).
| } | ||
| let maximum = self | ||
| .acquired_at | ||
| .unwrap_or(UnixSeconds::new(row_created)) |
There was a problem hiding this comment.
🤔 thinking — Using row_created as the fallback anchor for legacy owned UIDs is conservative: a read never extends a UID's lifetime. But every provider UID on a row created more than 30 days ago becomes expired on its first read after deploy, even if the provider wrote it yesterday with an explicit exp, because at.min(created + 30d) wins. configuration.md documents this. If owned UIDs are already deployed (outside a pre-release branch), this means a surge of lookups across all such rows right after the upgrade. That surge is bounded only by the new retry_after and rate_limit_per_hour.
Could you confirm that no production rows carry owned UIDs yet? If some do, one option is a one-time grace anchor, such as max(row_created, DEPLOY_EPOCH), so the cap is introduced without mass expiry. No change is needed if this feature hasn't shipped.
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| entry_error: Option<String>, | ||
| /// Raw entry body (lossy UTF-8) when it was not valid JSON. | ||
| /// Reserved raw-body field. Opaque bodies are omitted because their |
There was a problem hiding this comment.
♻ refactor — After this change raw_body is always None: the only assignment, at line 391, is raw_body: None, and the parse-error branch no longer fills it. Keeping it as a "reserved" field leaves a dead, always-skipped member in the response type, and the API reference still names it.
Proposed change: remove the field and its initializer, and drop the raw_body mention from docs/guide/api-reference.md:
// delete:
// #[serde(skip_serializing_if = "Option::is_none")]
// raw_body: Option<String>,
// and `raw_body: None,` in build_lookup_responseApply this by hand. It touches the struct, its constructor and the docs, which are outside a single hunk.
| pub struct PartnerRegistry { | ||
| by_source_domain: HashMap<String, PartnerConfig>, | ||
| by_api_key_hash: HashMap<String, String>, | ||
| pub(crate) providers: ConfiguredProviders, |
There was a problem hiding this comment.
♻ refactor — providers is a mutable pub(crate) field that is populated separately from owner_tcf_vendor_ids and provider_owned, which from_ec_with_kinds derives from the same config. About ten tests in this PR set it directly with the same long single-line serde_json::from_value(json!({..."enabled":false...})) literal. That works, but production code could also end up with a registry whose owner gate and source gate disagree.
Suggestion: make the field private and add a #[cfg(test)] helper on PartnerRegistry, for example with_stored_owner(id, sources, vendor), or a shared test fn in test_support. Use it in place of the repeated JSON literals in admin.rs, after_response.rs, coordinator/mod.rs, eids.rs, identify.rs and write_plan.rs.
Apply this by hand. It spans multiple files.
| retry-after. Cookie-only updates preserve the deadline; a cookie ID does not | ||
| make another source's failed lookup successful. Ordinary skips never renew it. | ||
|
|
||
| The first vendor implementation PR (#1488) is gated on the retry-after fix |
There was a problem hiding this comment.
📝 note — "The first vendor implementation PR (#1488) is gated on the retry-after fix (#1547)" is project tracking. It belongs in the spec or the PR description, not in operator-facing configuration docs, and it goes stale once both PRs land. Consider keeping only the rate_limit_per_hour sentence:
The optional `rate_limit_per_hour` default remains unlimited; it is a
separate traffic control, shared by ECs behind one IP.Apply this by hand. It replaces lines 1021–1023.
| - **Fill order:** sources in partner config order, entries and UIDs in stored | ||
| order. A UID is added if the encoded value fits; otherwise it is skipped and | ||
| filling continues. KV retains the full set. | ||
| - **Built** by `ec::mirror::build_mirror`, called from finalization on consented |
There was a problem hiding this comment.
📝 note — The §10 rewrite cites ec::mirror::build_mirror, a per-UID day-rounded expiry cap, and set-only-when-changed semantics. None of these exist on this branch; there is no build_mirror in crates/. §8.2 says the mirror lives on "the dependent collection branch". Consider marking §10 as describing that branch, or moving this rewrite into the PR that implements the mirror, so the spec doesn't describe code that isn't merged.
| } | ||
|
|
||
| #[tokio::test(flavor = "current_thread")] | ||
| async fn every_graph_writer_prunes_unconfigured_provider_uids() { |
There was a problem hiding this comment.
👍 praise — every_graph_writer_prunes_unconfigured_provider_uids covers create, revive, upsert, batch, snapshot, cluster, page and after-response. It checks the raw stored bytes rather than the typed entry, so a new writer that skips serialize_configured_entry would be caught. The same goes for configured_page_commit_returns_the_same_pruned_row_it_writes, which pins that the returned row and the persisted row stay identical.
A stable ID such as a SharedID or a pull-sync partner's ID is bounded to 30 days in the row and on the mirror, like a vendor token. The spec gives a source a UID lifetime of its own, from 1 to 365 days, with 365 as the default for stable sources, and records how it should meet the finite lifetime work in #1548 and #1715. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtcLmGQyykYkNRTJ5G9Ydb
Summary
Base and scope
Targets
feat/s2s-eid-vendors, starting at #1488 headb990702eaaaaaa8e0000723c78b5994bd91f28d5. That branch already introducesMAX_EXPIRY_SECSand clamps absolute and relative provider expiries. The approved dependency mergedad2dce732b9b64d0640453f40d48daf299fb4deincorporates #1712 / #1547 retry memory before this change. Neithermainnorrc/identityis the base or target.The mirror does not exist on this base. Separately reviewed companion changes on
fix/1548-provider-uid-mirror-compat, targeting #1489'sfeat/s2s-eid-collection-providers, cover mirror construction, retained-cookie fallback, and synthesized pull-sync owners. Merge that companion as part of integrating the identity stack to complete mirror coverage; this core change does not import #1489 or later Axum support.Behavior before and after
Previously, an unspecified provider expiry became
Expiry::Never. Any live provider UID at a source suppressed lookup, even if another provider owned it. Egress checked current source configuration, so removing or renaming a provider could leave its stored UID served indefinitely and prevent the new owner from acquiring an identity.Now validation defaults an unspecified UID expiry to the existing 30-day maximum and preserves the existing
At/Afterclamps. The constant is shared fromec/eid_types.rs. An unspecified refresh time still schedules no refresh. Lookup eligibility, generated IDs and cookie deduplication distinguish owners; a former owner's UID, expiry or private refresh state cannot satisfy or block the new owner.Owned UIDs require a configured owner that still claims the source and passes its own vendor-consent gate. Disabled providers remain configured. Matching duplicate disabled-owner policies retain every applicable vendor gate. Ownerless browser/batch records retain their existing source-level rules. Source GDPR exclusions, cookie opt-outs, revocations, retry memory and conditional-write protections remain in force.
Orphaned owners are withheld immediately and physically pruned on the next successful write. Cleanup resynchronizes the legacy
record.uidalias and covers page-load, after-response, create/revive, partner/batch upsert, legacy pull-sync enrichment and identify's cluster-cache writes. Pruning accompanies real writes rather than introducing a separate cleanup write.Egress coverage
user.eidsfrom/auctionand page-bidslive_eidsand the shared filtered EID viewx-ts-eidsuidandeidlive_eidsA carried mirror contains no owner metadata. If its row or request clock cannot establish current eligibility, the companion expires it. This can clear an otherwise valid cookie during a read/clock failure or non-navigation response without a clock; a later successful navigation rebuilds it.
Existing rows and rollback
New provider results record additive optional
acquired_atmetadata. Effective expiry is the earlier of the stated deadline and acquisition plusMAX_EXPIRY_SECS. Existing owned UIDs without acquisition metadata useKvEntry.createdas a fixed anchor, includingNeverand overlong absolute expiries. Repeated reads do not extend that deadline; no migration is needed.The conservative fallback can immediately expire a legacy UID acquired recently on a much older row, because its true acquisition time was never stored. New results on old rows use their own acquisition timestamp. Older binaries ignore and may discard
acquired_atwhen rewriting rows, causing upgraded readers to use the conservative fallback again. Ownerless IDs are unaffected.Changes
The diff includes prerequisite #1547 / #1712 retry memory through the signed dependency merge; the table identifies that inherited behavior alongside #1548.
crates/trusted-server-adapter-fastly/src/app.rscrates/trusted-server-adapter-fastly/src/main.rscrates/trusted-server-core/src/ec/admin.rscrates/trusted-server-core/src/ec/after_response.rscrates/trusted-server-core/src/ec/coordinator/mod.rscrates/trusted-server-core/src/ec/coordinator/results.rscrates/trusted-server-core/src/ec/coordinator/validate.rscrates/trusted-server-core/src/ec/eid_types.rscrates/trusted-server-core/src/ec/eids.rscrates/trusted-server-core/src/ec/identify.rsuidandeidthrough the shared stored-UID policy.crates/trusted-server-core/src/ec/kv.rscrates/trusted-server-core/src/ec/kv_types.rscrates/trusted-server-core/src/ec/registry.rscrates/trusted-server-core/src/ec/write_plan.rscrates/trusted-server-core/src/test_support.rsdocs/guide/configuration.mddocs/superpowers/specs/2026-10-30-s2s-eid-collection-design.mdCloses
Closes #1548
Spec
Updated existing collection design, especially validation, disabled providers, the no-expiry acceptance scenario and mirror policy.
Test plan
Core implementation commit:
ead6159013767c782f6bacce7e4e60df1e12635f. Its committed tree exactly matches the reviewed and tested working tree.Rust 1.98.1 and Node 24.20.0 were used. Fastly tests used Viceroy 0.22.0, matching the actual worktree
.tool-versionspin.cargo test --locked -p trusted-server-core --lib ec::— 662 passed.cargo clippy --locked -p trusted-server-core --all-targets --all-features -- -D warnings.cargo clippy --locked -p trusted-server-core --lib --all-features --target wasm32-wasip1 -- -D warnings.cargo test --locked -p trusted-server-adapter-fastly --target wasm32-wasip1 ec— 62 passed; one existing deadline-network fixture ignored because it needs its separate origin harness.cargo clippy --locked -p trusted-server-adapter-fastly --all-targets --all-features --target wasm32-wasip1 -- -D warnings.ignoreexamples.Independent review and runtime evidence
Review corrections through
c012ddf0dcce3464e2d7311fd3fb6ae00e2c70bfpreserve cookie IDs alongside another source's failed lookup and record its one-hour or five-minute retry interval, including request-build failures. Cookie-only updates preserve the deadline; successful lookups/generated results and fresh opt-outs clear it. Filtering all cookie IDs preserves the actual failure interval. Admin diagnostics now reportprovider_policyfor owner/lifetime exclusions; guidance matches retry-only writes, bounded lifetimes and opaque-body withholding. The final correction passed 667 native EC tests and all-target/all-feature core Clippy under the pinned toolchain. Fail-first regressions distinguish the lost deadline, changed-cookie clearing, filtered-result interval and request-build path. Formatting passes. All 25 current-revision hosted checks pass. Checkout logs confirm the tested merge includes headc012ddf0dcce3464e2d7311fd3fb6ae00e2c70bfand live basebfdd19b077d67d697e85408f8974aae5442d7a0e; the API workflow base field retains historicalb990702eaaaaaa8e0000723c78b5994bd91f28d5.Local Axum runtime verdict: VERIFIED for the approved integration-overlay scope. The #1488 Axum adapter itself rejects providers. Verification therefore used native-support revision
6b4a5fdc0aca527eed1f8842eb7b87b89cca6cf8with the core and mirror changes applied in a disposable worktree; that later adapter support is not included here.The real Axum application served localhost HTTP with persistent EC records and scripted provider, origin and bidder transport at example hosts. A seeded UID had no expiry and carried the old owner's private refresh state. Positive controls first observed it in actual bidder OpenRTB EIDs,
/auctionresponsex-ts-eids, authenticated identify and mirror output.Disabling the shared owner checks only in the disposable copy makes the pre-write identify assertion fail. Restoring the exact source reproduces both positive scenarios. Every positive-run listener was stopped and verified closed; the disposable runtime worktree was removed after preserving the patch and sanitized evidence.
This proves the local application route/storage/serialization flow with controlled upstreams. It does not claim browser behavior, live provider TLS/API validation, deployed behavior, or that unmodified #1488 supports providers on Axum. The 30-day boundary is established by targeted tests rather than waiting 30 days in the runtime probe. No browser, DataDome bypass, remote proxy task, real credential or operator configuration was used.
Checklist
unwrap().