Fix missing Permutive segments and ignored integration log settings - #1223
ChristianPavilonis wants to merge 3 commits into
Conversation
dhruv8sh
left a comment
There was a problem hiding this comment.
Summary
Shares the context-provider registry and log level across independently built TSJS bundles via Symbol.for globals, which restores Permutive segments in /auction requests and makes integration logging follow tsjs.setConfig / tsjs.log.setLevel. The fix is small and well tested; no blocking issues, just one behavior question about tsdebug scope and a forward-looking note on shared-state robustness.
Non-blocking
🤔 thinking / 🌱 seedling / ⛏ nitpick
tsdebugnow raises logging for every bundle and can override the publisher's level — see inline atcrates/trusted-server-js/lib/src/integrations/creative/click.ts:492- Document the wider
tsdebugscope in the CHANGELOG (contingent on the above) — see inline atCHANGELOG.md:35 - Shared provider map is never checked for shape or version — see inline at
crates/trusted-server-js/lib/src/core/context.ts:20
👍 praise
- Tests run the real production bundles together — see inline at
crates/trusted-server-js/lib/test/iife-state-artifact-integration.test.mjs:1
CI Status
- browser integration tests: PASS
- integration tests: PASS
- integration tests (Fastly EC lifecycle): PASS
- CodeQL: PASS
- cargo test (ts CLI, native): PASS
- cargo test: PASS (required)
- Analyze (rust): PASS
- Analyze (javascript-typescript): PASS
- cargo fmt: PASS (required)
- cargo test (axum native): PASS
- format-typescript: PASS (required)
- cargo check (cloudflare native + wasm32-unknown-unknown): PASS
- CLAUDE.md symlink guard: PASS
- format-docs: PASS (required)
- cargo check/build/test (spin native + wasm32-wasip1): PASS
- cargo test (cross-adapter parity): PASS
- prepare integration artifacts: PASS
- vitest: PASS
- Analyze (actions): PASS
- Analyze (javascript-typescript): PASS
Retain both unreleased changelog entries while preserving the shared\ncontext and logging repair alongside current main updates. Correct\none build-script indentation line caught by the format check.
prk-Jr
left a comment
There was a problem hiding this comment.
Summary
The shared global provider registry and log level fix the independent-IIFE state duplication described in #1196. The extracted build options preserve production behavior, and the artifact tests exercise context propagation, publisher log settings, load order, and explicit tsdebug overrides. No blocking or non-blocking findings.
Local verification with the pinned Node 24.12.0: 31 tests pass across the context, logger, config, and production-IIFE state suites.
CI Status
- integration tests: PASS
- browser integration tests: PASS
- integration tests (Fastly EC lifecycle): PASS
- CodeQL: PASS
- cargo test (ts CLI, native): PASS
- Analyze (rust): PASS
- CLAUDE.md symlink guard: PASS
- Analyze (javascript-typescript): PASS (both reported runs)
- cargo fmt: PASS (required)
- cargo test (axum native): PASS
- format-typescript: PASS (required)
- cargo check (cloudflare native + wasm32-unknown-unknown): PASS
- cargo test: PASS (required)
- format-docs: PASS (required)
- cargo check/build/test (spin native + wasm32-wasip1): PASS
- cargo test (cross-adapter parity): PASS
- Analyze (actions): PASS
- prepare integration artifacts: PASS
- vitest: PASS
Summary
/auctionand integrations ignored publisher logging settings. Share the provider registry and log level across bundles.info, while preserving explicittsdebugbehavior.Changes
Paths below are relative to
crates/trusted-server-js/lib/, exceptCHANGELOG.mdat the repository root.src/core/context.tssrc/core/log.tssrc/integrations/creative/click.tswarntoinfobump when installing the click guard.build-module-options.mjsbuild-all.mjstest/iife-state-artifact-integration.test.mjstest/core/context.test.tstest/core/log.test.tstest/core/config.test.tstest/prebid-artifact-integration.test.mjsCHANGELOG.mdScope
This is the small repair for the two observable failures in #1196. It retains separate browser bundles and the existing publisher API. It does not change Rust, share APS renderer state, or implement the browser-runtime redesign in #1194. That redesign can replace the shared storage later without losing these behavior tests.
Restoring context starts sending
config.permutive_segmentswhen Permutive is enabled and cohorts are available. The server retains it only whenauction.allowed_context_keysincludes"permutive_segments". The allowlist is not a consent gate; this PR does not add consent enforcement, so publisher consent handling still needs review before relying on this data flow.Closes
Closes #1196
Test plan
cargo test-fastly && cargo test-axumcargo clippy-fastly && cargo clippy-axumcargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest runcd crates/trusted-server-js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute servenpm run lint,node build-all.mjs, explicit Prettier checks for the new.mjsfiles, focused TypeScript checking, andgit diff --check.All JS commands run from
crates/trusted-server-js/lib/. Rust, docs-site and deployment checks were not run because those areas are unchanged.The artifact suite reproduced nine failures before the runtime fix, including missing segments and ignored logging settings. All 11 artifact tests pass afterward. The two separate-module unit regressions also failed before the fix and pass afterward. The full suite passes 1,174 tests across 49 test files, including the existing Prebid artifact tests. The production build emits all 13 expected bundles.
Focused TypeScript check:
Checklist
unwrap()in production code — useexpect("should ...")tracingmacros, notprintln!. Not applicable: no Rust logging changes.