Skip to content

Name backends in each adapter - #1390

Open
jwrosewell wants to merge 46 commits into
feature/46-last-namesfrom
feature/47-backend-naming
Open

jwrosewell wants to merge 46 commits into
feature/46-last-namesfrom
feature/47-backend-naming

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Changes

Area Change
crates/trusted-server-core/src 11 files, 447 lines added, 818 removed
crates/trusted-server-adapter-fastly/src 3 files, 390 lines added, 39 removed
crates/trusted-server-adapter-axum/src 2 files, 180 lines added, 17 removed
crates/trusted-server-adapter-cloudflare/src 2 files, 84 lines added, 16 removed
crates/trusted-server-adapter-spin/src 2 files, 84 lines added, 15 removed
docs/superpowers 1 file, 78 lines added, 0 removed
docs/guide 6 files, 30 lines added, 17 removed
crates/auction/aps 1 file, 5 lines added, 5 removed
crates/analytics/tinybird 1 file, 3 lines added, 7 removed
crates/trusted-server-adapter-axum/tests 1 file, 3 lines added, 7 removed
crates/trusted-server-cli/src 1 file, 3 lines added, 7 removed
CHANGELOG.md 1 file, 2 lines added, 0 removed
crates/shared/51degrees 1 file, 2 lines added, 6 removed
crates/testing/iabtl 1 file, 2 lines added, 7 removed
Cargo.lock 1 file, 1 line added, 0 removed
crates/auction/prebid-server 1 file, 1 line added, 6 removed
crates/trusted-server-adapter-fastly/Cargo.toml 1 file, 1 line added, 0 removed

Closes

Closes #1339

Spec

Spec: backend-naming

Test plan

CI on this pull request at 3af8768 passed all 26 checks.

  • cargo test-fastly && cargo test-axum
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: the full workflow set of this repository, run on this pull request at 3af8768

Checklist

  • Changes follow AGENTS.md conventions
  • No unwrap() in production code (clippy denies unwrap_used in CI)
  • Uses log macros as AGENTS.md asks (not println!)
  • New code has tests
  • No secrets or credentials committed

On top of the last names series (#1389). Issue: #1339.

What this adds

What changes.

Each adapter names its own backends. Core's platform/backend_naming.rs, with a naming and transport timeout policy for each of the four adapters, is gone. The PlatformBackend interface core already asked for a backend's name and timer now also answers the auction backend budget and the transport timeout bucket count, and an auction plan is validated against a descriptor the adapter builds from that same implementation, so a policy and the registration it predicts cannot drift apart.

How it works.

  • One interface, no enum. PlatformBackend gains two defaulted methods, the enum of platform policies and the structs beside it are deleted, and AuctionPlan::validate_for_target takes an AuctionTargetDescriptor the adapter builds from its backend implementation and its capabilities.
  • Each adapter carries its policy. The Fastly adapter's naming, timer buckets and backend budget sit in its backend.rs beside the registration that uses them, with its platform backend delegating to them, and the Axum, Cloudflare and Spin adapters each hold a backend_name beside their platform backend. The names a deployment sees are unchanged and each adapter pins them in a test.
  • Nothing moves into the host layer. The Fastly adapter registers through the SDK itself, the host layer's own proxy registers under a prefix core never predicted, and the other three adapters register nothing, so no platform's registration is the host layer's to name.
  • Core's test double names from every field and can be driven to each refusal, so the plan's refusals (fan out, budget, prediction, collision, disabled) are each tested in core without a platform.

Why

Core names no hosting platform. These policies were kept in core so that startup validation and the adapters agreed, and the interface gives the same agreement without the names.

What breaks

Nothing for a deployment. The names predicted are the same, from the adapter that registers them. A crate outside core that built a BackendNamingPolicy builds a descriptor from its platform backend instead.

The commits

  1. Each adapter names its own backends.
  2. The planned instances test expects the exact bounded budget.
  3. A merge of the client hints middleware.
  4. The 51Degrees shared crate's test backend names no naming policy.
  5. A merge of the last names series, after which the Tinybird crate's test backend drops the naming policy too.
  6. A merge of the last names series' final commit.
  7. Two more merges of the last names series, which carry the fixes made lower in the stack.
  8. A merge of the series below, which carries the page origin change.
  9. The backend naming design names the callers the policy had and what breaks outside core, and takes its round 2 corrections.
  10. Later merges of the series below carry Tech Lab main at 6ef07ae.

How it was verified

Each adapter pins the backend names it predicts in a test.

Core held a backend naming and transport timer policy for each of the
four adapters, with a variant per platform, so that startup validation,
the ts command and the adapters predicted the same backend names before
any was registered. The policies called no platform and still named every
platform in core, where the rule is that core names none.

Core keeps one interface. PlatformBackend already answered the name a
backend will have and the transport timer it allows, and now also answers
the backend budget and the timer bucket count that plan validation asks,
with defaults for a host whose names are not a limited resource. The
method that returned a platform variant is gone, with the enum, the
target id enum, the predicted backend type and the naming error type.

Plan validation takes an AuctionTargetDescriptor the adapter builds from
its name, the backend implementation its runtime services use, and its
capabilities, so the names validation predicts are the names the host
registers. Each adapter carries its own policy beside the code that
registers its backends: the Fastly policy sits in backend.rs next to the
registration, and the Axum, Cloudflare and Spin correlation names sit in
each platform.rs next to its PlatformBackend. The names a deployment
sees are unchanged and each adapter pins them in a test.

Core's test double names from every field of the specification and
declares the budget and buckets a test gives it, so validation is driven
to every refusal without a host. The ts command's one backend implements
the interface alone. The design page, the auction and integration guides
and the changelog say the same.
The test registered two demand sources through core's naming double and
expected each backend's transport timer to be 750ms, which was one host's
rounding of the 777ms auction budget. The double keeps the exact bounded
value, so the timer it registers is the budget itself.
# Conflicts:
#	CHANGELOG.md
#	crates/trusted-server-adapter-fastly/Cargo.toml
The backend naming series removed the policy from the platform backend, and
this double came in with the client hints series.
# Conflicts:
#	CHANGELOG.md
#	crates/auction/prebid-server/src/lib.rs
#	crates/trusted-server-adapter-fastly/src/tinybird.rs
#	crates/trusted-server-core/src/platform/mod.rs
…reaks outside core

Review round 1 found that the design named the ts command as a third
caller of the policy, when the command never called it and the callers
were each adapter's startup validation and registration. The design now
names those two callers, says that only convention keeps the backend in
an adapter's descriptor the same type as the one its runtime services
use, lists what breaks for crates outside core, and gives the paths with
no test. The design also says what remains named in core, what the issue
asks, and why the ts command cannot yet get a descriptor, corrects the
pull request references, and records the review round.

The auction guide said core names no platform. It now says that plan
validation names none, which is the claim the code supports. The lines
after that sentence are re-wrapped and carry no other change.
Review round 2 approved the design with no blocking issues and asked for
four small changes. The compatibility paragraph now says the descriptor
is no longer Copy, PartialEq or Eq, has no naming_policy method, has
methods that take &self, and gives its name as a static string. The
related pull requests line names the Tech Lab draft as well as the fork
draft, and the orchestrator test is described as changing two
assertions, one for each provider. The design names neither pull request
for the design documents, so the fourth change needed no edit. The
review log and the revision record carry the round.
@jwrosewell
jwrosewell added this pull request to stack #1401 October 15, 2026 17:56
@jwrosewell
jwrosewell removed this pull request from stack #1401 October 15, 2026 20:51
`proxy.certificate_check = false` is meant for local development with a
self-signed origin, and the Axum adapter, which is the local development
server, ignored it in silence. Its reqwest client is built with rustls and
the bundled public roots and is never told to skip verification, so the
setting changed nothing there and nothing said so.

The adapter now warns once at startup, where its state is built for the
process, that it does not honor the setting and still verifies every
HTTPS origin's certificate. The test builds the state with the check off
and finds one such warning, and with the check on finds none.

The configuration guide says that only the Fastly adapter honors `false`,
that Axum warns, and that Cloudflare and Spin use the setting only in the
name each gives a backend, because the HTTP client each platform provides
takes no option to skip the check. The architecture table, the
getting-started note and the Axum guide list it among Axum's limits, and
the backend naming design records it.

The behavior was reported in #1132.
# Conflicts:
#	CHANGELOG.md
#	crates/trusted-server-adapter-axum/src/app.rs
#	docs/guide/architecture.md
#	docs/guide/axum-dev.md
# Conflicts:
#	crates/trusted-server-core/src/auction/orchestrator.rs
@jwrosewell
jwrosewell removed this pull request from stack #1408 October 18, 2026 20:15
@jwrosewell jwrosewell closed this Oct 18, 2026
@jwrosewell jwrosewell reopened this Oct 18, 2026
@jwrosewell
jwrosewell added this pull request to stack #1418 October 19, 2026 12:18
@jwrosewell
jwrosewell removed this pull request from stack #1418 October 19, 2026 16:30
@jwrosewell jwrosewell closed this Oct 19, 2026
@jwrosewell jwrosewell reopened this Oct 19, 2026
@jwrosewell
jwrosewell added this pull request to stack #1421 October 19, 2026 17:38
@jwrosewell
jwrosewell removed this pull request from stack #1421 October 19, 2026 18:29
@jwrosewell
jwrosewell added this pull request to stack #1422 October 19, 2026 19:20
@jwrosewell jwrosewell changed the title Each adapter names its own backends Name backends in each adapter Oct 19, 2026
@jwrosewell
jwrosewell marked this pull request as ready for review October 19, 2026 20:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core predicts each platform's backend names

1 participant