Summary
/__ts/page-bids is the only internal Trusted Server URL path that uses a double-underscore (__) prefix. Every other internal route lives under the single-underscore /_ts/ namespace. Rename the route to /_ts/page-bids so the internal-path convention is consistent.
Current state
Non-compliant (double underscore):
All other internal routes use /_ts/:
/_ts/set-tester, /_ts/clear-tester
/_ts/admin/keys/rotate, /_ts/admin/keys/deactivate
/_ts/api/v1/identify, /_ts/api/v1/batch-sync
/_ts/debug/ja4
A survey of URL string literals confirms /__ts/page-bids is the only path using __. (__ts_rsc_payload_ and the __tsjs_* window globals are internal JS identifiers, not URL paths, so they are out of scope.)
There is also an existing internal inconsistency that suggests the __ was unintentional: the unit test make_page_bids_request already builds its request with the single-underscore form /_ts/page-bids (crates/trusted-server-core/src/publisher.rs ~L4945), even though the route is registered as /__ts/page-bids. The test passes only because the same-origin gate inspects headers/Fetch-Metadata, not the path.
Scope — references to update in lockstep (~42 occurrences)
The tsjs client and the server route must agree on the path, so all of these change together:
Server route registration (all four adapters):
crates/trusted-server-adapter-fastly/src/app.rs:1086
crates/trusted-server-adapter-axum/src/app.rs:331
crates/trusted-server-adapter-cloudflare/src/app.rs:487, 494
crates/trusted-server-adapter-spin/src/app.rs:153, 734, 736
Client (must match the served bundle):
crates/trusted-server-js/lib/src/integrations/gpt/index.ts:731 (the fetch), plus the doc at L699
Tests + docs:
crates/trusted-server-integration-tests/tests/parity.rs:705-707
crates/trusted-server-core/src/publisher.rs:2337 (doc comment), and align the test at ~L4945 (already uses /_ts/)
- any references under
docs/
Compatibility / rollout note
The browser runs whatever tsjs bundle the server served it, so a single atomic deploy updates client + server together. However, already-cached/older bundles in the wild will keep requesting /__ts/page-bids, and on a Next.js SPA that path drives ad delivery for in-session navigations — a hard rename would drop ads for those clients until their bundle refreshes.
Recommended rollout:
- Register both
/__ts/page-bids (deprecated alias) and /_ts/page-bids, routing to the same handler.
- Switch the client
fetch to /_ts/page-bids.
- After old bundles have aged out of caches, remove the
/__ts/page-bids alias.
Acceptance criteria
- The route is served at
/_ts/page-bids across all four adapters.
- The
tsjs client fetches /_ts/page-bids.
- Parity tests, unit tests, and docs reference the single-underscore path.
- A transition alias for
/__ts/page-bids exists (and a follow-up to remove it), so no ad-serving gap during rollout.
- No other internal URL paths use a
__ prefix (confirmed: /__ts/page-bids is the only one).
Summary
/__ts/page-bidsis the only internal Trusted Server URL path that uses a double-underscore (__) prefix. Every other internal route lives under the single-underscore/_ts/namespace. Rename the route to/_ts/page-bidsso the internal-path convention is consistent.Current state
Non-compliant (double underscore):
/__ts/page-bidsAll other internal routes use
/_ts/:/_ts/set-tester,/_ts/clear-tester/_ts/admin/keys/rotate,/_ts/admin/keys/deactivate/_ts/api/v1/identify,/_ts/api/v1/batch-sync/_ts/debug/ja4A survey of URL string literals confirms
/__ts/page-bidsis the only path using__. (__ts_rsc_payload_and the__tsjs_*window globals are internal JS identifiers, not URL paths, so they are out of scope.)There is also an existing internal inconsistency that suggests the
__was unintentional: the unit testmake_page_bids_requestalready builds its request with the single-underscore form/_ts/page-bids(crates/trusted-server-core/src/publisher.rs~L4945), even though the route is registered as/__ts/page-bids. The test passes only because the same-origin gate inspects headers/Fetch-Metadata, not the path.Scope — references to update in lockstep (~42 occurrences)
The
tsjsclient and the server route must agree on the path, so all of these change together:Server route registration (all four adapters):
crates/trusted-server-adapter-fastly/src/app.rs:1086crates/trusted-server-adapter-axum/src/app.rs:331crates/trusted-server-adapter-cloudflare/src/app.rs:487, 494crates/trusted-server-adapter-spin/src/app.rs:153, 734, 736Client (must match the served bundle):
crates/trusted-server-js/lib/src/integrations/gpt/index.ts:731(thefetch), plus the doc at L699Tests + docs:
crates/trusted-server-integration-tests/tests/parity.rs:705-707crates/trusted-server-core/src/publisher.rs:2337(doc comment), and align the test at ~L4945 (already uses/_ts/)docs/Compatibility / rollout note
The browser runs whatever
tsjsbundle the server served it, so a single atomic deploy updates client + server together. However, already-cached/older bundles in the wild will keep requesting/__ts/page-bids, and on a Next.js SPA that path drives ad delivery for in-session navigations — a hard rename would drop ads for those clients until their bundle refreshes.Recommended rollout:
/__ts/page-bids(deprecated alias) and/_ts/page-bids, routing to the same handler.fetchto/_ts/page-bids./__ts/page-bidsalias.Acceptance criteria
/_ts/page-bidsacross all four adapters.tsjsclient fetches/_ts/page-bids./__ts/page-bidsexists (and a follow-up to remove it), so no ad-serving gap during rollout.__prefix (confirmed:/__ts/page-bidsis the only one).