Repository navigation
Stabilize context allowlist serialization - #1209
Conversation
There was a problem hiding this comment.
Summary
Switching allowed_context_keys to a BTreeSet fixes the root cause of #1197: the only unordered array in the serialized settings. EdgeZero's envelope hash already sorts object keys, so this makes both the template fingerprint and ts config push/diff stable. The array wire format and membership semantics are unchanged, and the regression tests reproduce the bug at three layers. Nothing here blocks merge.
2 of the inline comments below carry a one-click GitHub
suggestion— use Commit suggestion (or Add suggestion to batch for several at once) to apply them as commits on the PR branch. The CHANGELOG note below is prose becauseCHANGELOG.mdisn't part of the diff.
Non-blocking
🤔 thinking / ⛏ nitpick
- Fingerprint still depends on
serde_json/preserve_orderbeing off — see inline atcrates/trusted-server-core/src/publisher.rs:2086 - Document the sorted, deduplicated serialization — see inline at
crates/trusted-server-core/src/auction_config_types.rs:77
👍 praise
- Regression coverage at three layers — see inline at
crates/trusted-server-core/src/publisher.rs:11754
Cross-cutting / body-level findings
-
🏕 CHANGELOG entry — This is visible to operators: existing envelopes with two or more
allowed_context_keysshow onets config diffchange after upgrade and need one more push, and Fastly deployments using ESI assembly get their template-cache hits back. Something like this under## [Unreleased]→### FixedinCHANGELOG.md(apply manually —CHANGELOG.mdisn't in the diff):- `[auction].allowed_context_keys` now serializes in sorted, deduplicated order, so template-cache fingerprints and `ts config push`/`diff` envelope hashes stay the same when one configuration is parsed more than once. Previously, configurations with two or more keys could get a new template-cache key on every Fastly request under ESI assembly, and `ts config diff` could report a change for an unchanged file. Existing envelopes may show one final diff; push once after upgrading.
CI Status
- cargo fmt: PASS (required)
- cargo test: PASS (required)
- format-typescript: PASS (required)
- format-docs: PASS (required)
- cargo test (axum native): PASS
- cargo check (cloudflare native + wasm32-unknown-unknown): PASS
- cargo check/build/test (spin native + wasm32-wasip1): PASS
- cargo test (ts CLI, native): PASS
- cargo test (cross-adapter parity): PASS
- vitest: PASS
- integration tests: PASS
- integration tests (Fastly EC lifecycle): PASS
- browser integration tests: PASS
- prepare integration artifacts: PASS
- CodeQL: PASS
- Analyze (rust): PASS
- Analyze (javascript-typescript): PASS
- Analyze (actions): PASS
- CLAUDE.md symlink guard: PASS
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Summary
Reviewed 29b1cfe31ff7d64756d5aa2864d7bdbd3d3649c1 against 56a19229f1e1e0369efbfe86d3a58b87e9394f7b. The BTreeSet change makes allowed_context_keys serialization deterministic while preserving deduplication, membership filtering, and the array wire format. Focused tests passed for serialization, auction filtering, template-cache reuse, repeated CLI diff/push behavior, and formatting. No actionable change-introduced issues found.
Use EdgeZero canonical hashing for template fingerprints so JSON map ordering does not depend on serde_json features. Correct the envelope regression assertion, improve CLI diagnostics, and document serialization and upgrade effects.
Summary
Changes
crates/trusted-server-core/src/auction_config_types.rsHashSetwithBTreeSet.crates/trusted-server-core/src/auction/formats.rscrates/trusted-server-core/src/auction/orchestrator.rscrates/trusted-server-core/src/settings.rscrates/trusted-server-core/src/config.rscrates/trusted-server-core/src/publisher.rscrates/trusted-server-cli/tests/config_env_overlay.rsCloses
Closes #1197
Test plan
diff --exit-codeand no-op pushes.cargo fmt --all -- --checkcargo test-fastly,cargo test-axum,cargo test-cloudflare, andcargo test-spin.Fastly tests used
SSL_CERT_FILE=/etc/ssl/cert.pembecause the sandbox has no macOS keychain. Axum tests passed with loopback socket access after the sandbox denied local test-server binds.A live-origin smoke check confirmed page and injected script delivery, but that page's cookie-setting responses bypass shared caching. Cache reuse for this fix is verified by the automated publisher regression: 16 independently parsed configurations reuse one template and fetch the origin once.
Checklist
unwrap(), logging, or dependencies.