Prevent 304 responses for SSAT root documents#952
Conversation
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Summary
Reviewed PR #952 against main. The Fastly path is covered, but one supported-adapter cache-bypass gap needs follow-up; it is included inline.
| { | ||
| let mut publisher_request = PlatformHttpRequest::new(req, backend_name); | ||
| if should_run_ad_stack { | ||
| publisher_request = publisher_request.with_cache_bypass(); |
There was a problem hiding this comment.
🔧 Cloudflare ignores the new cache-bypass contract
This marks eligible publisher requests for cache bypass, but CloudflareHttpClient::execute never reads bypass_cache: its worker::RequestInit retains the default cache mode. Cloudflare Workers fetch supports CacheMode::NoStore, and without setting it an eligible navigation can still be satisfied by configured/default Cloudflare cache behavior rather than receiving a complete origin body. That leaves the PR's SSAT invariant incomplete on a supported adapter.
Please map bypass_cache to init.with_cache(CacheMode::NoStore) in the Cloudflare adapter and add a regression test for that mapping.
Summary
Cache-Control: private, no-store.502 Bad Gatewayand abandon the dispatched auction if an eligible origin unexpectedly returns304 Not Modified.Changes
crates/trusted-server-core/src/platform/http.rscrates/trusted-server-core/src/platform/test_support.rscrates/trusted-server-adapter-fastly/src/platform.rsset_pass(true)for synchronous and asynchronous sends.crates/trusted-server-core/src/publisher.rsprivate, no-store, reject unexpected eligible 304s, abandon auctions, and add regression coverage.docs/superpowers/specs/2026-07-22-ssat-root-document-304-prevention-design.mddocs/superpowers/plans/2026-07-22-ssat-root-document-304-prevention.mdCloses #953
Test plan
cargo test-fastly && cargo test-axumcargo clippy-fastly && cargo clippy-axumcargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest run(411 tests using pinned Node 24.12.0)cd crates/trusted-server-js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute servecargo test-cloudflare,cargo test-spin, 13 parity tests, 29 CLI proxy E2E tests, andcargo clippy-fastlyChecklist
unwrap()in production codeprintln!)