Add background pull-sync dispatch for organic routes#559
Draft
ChristianPavilonis wants to merge 1 commit intofeature/ec-s2s-batch-syncfrom
Draft
Add background pull-sync dispatch for organic routes#559ChristianPavilonis wants to merge 1 commit intofeature/ec-s2s-batch-syncfrom
ChristianPavilonis wants to merge 1 commit intofeature/ec-s2s-batch-syncfrom
Conversation
Implement Story 9 (#542): server-to-server pull sync that runs after send_to_client() on organic traffic only. Refactors the Fastly adapter entrypoint from #[fastly::main] to explicit Request::from_client() + send_to_client() to enable post-send background work. Pull sync enumerates pull-enabled partners, checks staleness against pull_sync_ttl_sec, validates URL hosts against the partner allowlist, enforces hourly rate limits, and dispatches concurrent outbound GETs with Bearer auth. Responses with uid:null or 404 are no-ops; valid UIDs are upserted into the identity graph. Includes EC ID format validation to prevent dispatch on spoofed values, partner list_registered() for KV store enumeration, and configurable pull_sync_concurrency (default 3).
01e9180 to
a4ae046
Compare
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.
Summary
Implements Story 9 (#542): server-to-server pull sync that runs after
send_to_client()on organic traffic only, ensuring zero client-facing latency impact.#[fastly::main]to explicitRequest::from_client()+send_to_client()to enable post-send background workpull_syncmodule: enumerates pull-enabled partners, checks staleness viapull_sync_ttl_sec, validates URL hosts against partner allowlist, enforces hourly rate limits, and dispatches concurrent outbound GETs with Bearer authPartnerStore::list_registered()for KV store enumerationec.pull_sync_concurrencysetting (default 3)Acceptance Criteria Coverage
handle_publisher_request,handle_proxy— never/sync,/identify,/auction,/admin/*pull:{partner_id}:{ec_hash}, 1-hour windowsettings.ec.pull_sync_concurrencydefault 3pull_sync_urlhost inpull_sync_allowed_domainsec_hash+ipquery params + Bearer tokenuid: nulland404→ no-op (debug only)send_to_client()Known Follow-ups
list_registered()scans all partner keys per eligible request. A pull-sync partner index would reduce this to O(1) for deployments with many partners.Test Results
cargo fmt✅cargo clippy✅cargo test --workspace— 812 tests passnpx vitest run— 282 tests passCloses #542