Skip to content

Stop pull sync from re-calling a partner for a full row - #1639

Open
dhruv8sh wants to merge 3 commits into
feat/s2s-eid-collection-providersfrom
fix/pull-sync-full-row
Open

dhruv8sh wants to merge 3 commits into
feat/s2s-eid-collection-providersfrom
fix/pull-sync-full-row

Conversation

@dhruv8sh

Copy link
Copy Markdown
Collaborator

Summary

  • When an EC row is at the 16 KiB cap, a pulled partner UID cannot be stored, so every navigation called the partner again and threw the answer away. Pull sync now skips a partner while the row has no room for its UID.
  • The partner becomes eligible again once expired IDs are pruned and the row has room. Batch sync's row_full already refused full rows without retrying, so the two now match.

Changes

File Change
crates/trusted-server-core/src/ec/coordinator/mod.rs Each pull-sync partner gets a byte reserve for the longest accepted UID (512 bytes); due_sources reports the source as NotDue when the row size plus the reserve exceeds MAX_ENTRY_BYTES. Tests: pull_sync_does_not_recall_a_partner_for_a_full_row, pull_uid_reserve_covers_the_longest_pulled_uid.
crates/trusted-server-core/src/ec/write_plan.rs serialized_len and member_len become pub(crate) so the coordinator can measure rows.
docs/guide/edge-cookies.md, docs/superpowers/specs/2026-10-30-s2s-eid-collection-design.md Describe the full-row rule in the pull sync section and the row size cap.

Known limit: the reserve assumes the UID needs no JSON escaping, so a UID made mostly of escaped characters could still be called once and then not fit.

Closes

Closes #1551

Spec

Not a feature (bug fix; follow-up from #1487, design in docs/superpowers/specs/2026-10-30-s2s-eid-collection-design.md).

Test plan

  • cargo test-fastly && cargo test-axum (also test-cloudflare, test-spin)
  • cargo clippy-fastly && cargo clippy-axum (also clippy-cloudflare, clippy-spin-native)
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run (no JS changes)
  • JS format: cd crates/trusted-server-js/lib && npm run format (no JS changes)
  • Docs format: prettier on the changed markdown
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve

Checklist

  • Feature PRs: spec linked above, ending in a review log of two or more agent review rounds (not a feature)
  • 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

A pull-sync partner's empty source on a row too full to take its UID was looked up on every navigation: the write planner dropped the UID for size, the source stayed empty and the EC ID went to the partner again. Pull sync now reserves the bytes its longest UID adds to a row and treats a source as not due when the row lacks that room, so the partner is not called until pruning frees space. This matches batch sync, which refuses the same row with row_full and is not retried.

Closes #1551.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
The edge cookies guide now says pull sync skips a partner whose empty source has no room left on the EC row, matching the design spec and the coordinator.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Keep PR #1489's EC-hash wording for the pull-sync rate limit and this PR's full-row note in the edge cookies guide.

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

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.

Stop pull sync from re-calling a partner for a row that is full

1 participant