Skip to content

Finish Axum production startup on the native baseline - #1635

Draft
prk-Jr wants to merge 4 commits into
baseline/native-aws-20261110from
feat/1573-axum-production-serving
Draft

prk-Jr wants to merge 4 commits into
baseline/native-aws-20261110from
feat/1573-axum-production-serving

Conversation

@prk-Jr

@prk-Jr prk-Jr commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Changes

File Change
crates/trusted-server-adapter-axum/src/startup.rs Missing/unreadable secret diagnostics name the config field paths, never the key or value. NativeStoreSnapshot is pub(crate). read_only_config/read_only_secret merged into read_only_snapshot (see note below)
crates/trusted-server-adapter-axum/src/app.rs 501 messages and comments say "Axum adapter", not "dev server"
crates/trusted-server-adapter-axum/Cargo.toml, Cargo.lock Description covers production; unused temp-env dev-dependency removed
crates/trusted-server-adapter-axum/tests/startup.rs Before-listen probe ignores Linux self-connections; missing-config test asserts required snapshot missing with every legacy name poisoned by a valid envelope; distinctive short passphrase; secret-in-logs check after successful runs; rename to ..._while_running; reserve_port comments; should-messages
crates/trusted-server-adapter-axum/tests/native_acceptance.rs Per-key missing-secret assertions; truncated-POST test asserts exactly three /action requests; distinctive short passphrase and success-path log checks; reserve_port comments; should-messages
crates/trusted-server-core/src/secret_resolution.rs, crates/trusted-server-core/src/config_payload.rs New secret_reference_paths / required_secret_references: each required key with the config paths that reference it, for diagnostics. Unit test
crates/trusted-server-core/src/integrations/datadome/protection.rs When checked request info fails, the protection payload omits Host/Protocol instead of falling back to the raw header or URI target. New red/green test
crates/trusted-server-integration-tests/tests/environments/axum.rs Attaches a bounded stdout+stderr tail when Axum exits before readiness or misses the readiness deadline
scripts/test-native-providers.mjs import.meta.main (works through a symlink); agent: false; self-connect guard; failure launches capture output in memory and assert the cause and absence of secret values without printing; --dns 127.0.0.1; DOCKER_HOST pass-through
scripts/tests/test-native-providers.test.mjs Unit tests for the new helpers
scripts/smoke-axum.sh Per-secret missing cases assert the config path and that no reference key is printed
.github/workflows/format.yml, AGENTS.md New CI job runs node --test 'scripts/tests/*.test.mjs'; gate list entry
docs/guide/getting-started.md Axum Option B rewritten for ts config push --adapter axum --local, EDGEZERO__ADAPTER__CONFIG_DIR and EDGEZERO__SECRETS__*; legacy env table removed
docs/guide/native-rc-demo.md, docs/guide/axum-dev.md, docs/guide/api-reference.md, docs/guide/architecture.md, crates/trusted-server-adapter-axum/README.md, docs/.vitepress/config.mts Operator-facing native startup guide with a run-locally block and sidebar entry; Axum described as a production entry point
docs/superpowers/specs/2026-11-19-axum-production-serving-design.md, docs/superpowers/plans/2026-11-19-axum-production-serving.md Design and plan

Acceptance status (#1573)

Item Status
AX-1: missing secret exits before the port opens Done, CI test
AX-1: SIGTERM drains in-flight requests within the grace Done, CI test
AX-1: pending record write completes on SIGTERM Not possible in A1: Axum has no record store until A2 (#1574); the after-response drain is A3 (#1575) and its CI test A8 (#1579). Maintainers: please narrow this checklist item in #1573
AX-2: provider startup through the edgezero#414 AWS providers scripts/test-native-providers.mjs passes locally against moto and the AppConfig agent (Docker). CI runs only its helper unit tests
AX-2: no runtime reads of TS_*, TRUSTED_SERVER_CONFIG_*, TRUSTED_SERVER_SECRET_* Done. Remaining occurrences are poison inputs in tests and scripts; TS_GIT_VERSION is a build-time constant
AX-2: TRUSTED_SERVER__ overrides Applied by ts config push, never read at runtime. The CI guard is A9 (#1580)
AX-7: EdgeZero pin Lockfile resolves EdgeZero to rc/identity 9d02d7b3

#1531 review threads

  • Fixed here: before-listen probe ignores self-connections (thread 10); provider script runs through a symlink via import.meta.main (thread 11); missing-config test asserts the exact diagnostic and poisons every legacy name with valid values (thread 12); truncated-POST test asserts exactly three /action requests (thread 20); native guide rewritten for operators, sidebar entry, run-locally block (thread 23); agent: false (thread 27); DataDome omits Host/Protocol when checked request info fails, on all adapters, instead of reporting the unchecked raw Host or request target (thread 32; the thread offered rejecting or omitting, and omitting keeps the protection request); reserve_port comments (thread 33); getting-started quickstart rewritten (it previously failed; D-2); CI job for the provider helper tests and AGENTS.md gate entry (A-7); temp-env removed (A-9); distinctive short passphrase and secret-in-logs checks after successful runs (A-10); failure launches assert the cause without printing output (A-12); --dns 127.0.0.1 and DOCKER_HOST pass-through (A-13; DOCKER_CONTEXT is intentionally not passed because HOME is isolated); rename to ..._while_running (A-14); NativeStoreSnapshot is pub(crate) (A-18); should-messages on touched assertions (A-21); integration environment attaches a bounded output tail on pre-readiness exit (A-23); missing-secret diagnostics name the secret's config path, asserted per secret in Rust tests and smoke-axum.sh, with no reference key printed (derived from thread 8; naming the key itself could print a secret pasted into a reference field).
  • Declined: a 501 for discovery (A-16). Cloudflare and Spin also return 500 without a JWKS, and discovery_route_status_parity requires Axum to match. Native startup already rejects request_signing.enabled.
  • Already fixed or obsolete after the chain merge: 25 of 33 inline threads and 18 review-body points. Examples: the TS outbound bridge (send_async, eager dispatch, budget tests, proxy marker) is gone and outbound goes through EdgeZero's HttpClient; Spin startup.rs and the Fastly delivery_tests.rs are gone; oversized bodies map to 413 in core; the EdgeZero pin is a rev, not a tag; SIGTERM drain is already covered by production_sigterm_drains_the_admitted_publisher_response.
  • EdgeZero side: pre-dispatch and head-limit (414/431) finalization (A-27).
  • Out of scope: RustSec advisories (rustls, ctutils) are present on the stack base (A-26).
  • Local-only checks (A-8, A-28): see the test plan. The ignored real Next.js test was not run.

Note: read_only_config/read_only_secret were merged into read_only_snapshot because CodeQL flagged the old helper name as a cleartext-logging source on #1528 (rust/cleartext-logging, rotation rollback log). CodeQL only runs on PRs to main, so this PR cannot show the alert gone.

Self-review

An independent review of the implementation found no blocking issues. Its three optional findings are fixed in 6949eea86: name config paths instead of reference keys in the missing-secret error, update the Axum section of the architecture guide, and attach the output tail on the integration readiness deadline.

Closes

Part of #1573. Not Closes: #1531 carries most of A1, and the pending-record-write item belongs to A3/A8.

Spec

Spec: docs/superpowers/specs/2026-11-19-axum-production-serving-design.md (ends with a three-round review log)

Test plan

Full gates, run locally on the code before the self-review fix commit 6949eea86; hosted CI covers that commit:

  • cargo test-fastly && cargo test-axum (also test-fastly-reuse with Viceroy 0.21.0, test-cloudflare, test-spin)
  • cargo clippy-fastly && cargo clippy-axum (also clippy-cloudflare, clippy-cloudflare-wasm, clippy-spin-native, clippy-spin-wasm, clippy-cli, clippy-codegen, and the template_build_digest clippy)
  • 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: parity test; template_build_digest test
  • Other (targeted): core DataDome and secret-resolution tests (new tests); Axum startup and native_acceptance tests; integration-tests clippy; node --test 'scripts/tests/*.test.mjs' (7 pass); ./scripts/smoke-axum.sh
  • Other (providers): scripts/test-native-providers.mjs against a release binary with both AWS features, moto and the AppConfig agent; every PASS line, including the selected config and secret failures before listen
  • Other (runtime): local Axum production binary behind the publisher dev proxy with real Chrome. Publisher page served 200 with both TSJS bundles injected and executing. A missing secret on real operator inputs exits 1 without opening the port and names the config path, with no key or value in the output (control: Extract native prepared startup on the demo baseline #1531's head gives the generic message); a valid legacy-named value is present but ignored; no secret values in output. SIGTERM during an in-flight 1.4 MB page request completed it, refused new connections and exited 0 within a 5 s grace. The getting-started Option B commands, run verbatim, start the server. Image 404s seen with that local publisher config are identical on Extract native prepared startup on the demo baseline #1531's head (preexisting)
  • Not run locally: wasm clock lint, domain lint, other script gates; the ignored real Next.js test (needs the external fixture)

Checklist

  • Feature PRs: spec linked above, ending in a review log of two or more agent review rounds
  • Changes follow AGENTS.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • New code has tests
  • No secrets or credentials committed

Startup errors for an absent or unreadable app-config secret now name the
reference key, never its value. The startup tests poison every legacy name
with valid values, ignore Linux self-connections in the before-listen probe
and check logs for secret values after successful runs too.

DataDome leaves Host and Protocol out of the protection payload when the
checked request information fails, instead of reporting an unchecked header
or request target.

The provider acceptance script runs through a symlink, asserts the cause of
each startup failure without printing output, and pins container DNS.
The getting-started Axum quickstart exported legacy config and secret
variables that the production startup ignores, so following it failed. It now
uses the local config directory and EDGEZERO__SECRETS__ values. The Axum
guides describe the binary as the production entry point, and the native
startup guide is written for operators with a run-locally example.

CI runs the provider acceptance helper tests; the full Docker run stays local.
@prk-Jr prk-Jr self-assigned this Nov 19, 2026
A secret reference key is an operator-supplied string. If a secret value were
pasted into a reference field, an error naming the key would log it. Startup
errors now name the config field paths that reference the missing secret,
using a new core secret_reference_paths helper, and the tests and smoke script
assert that no key appears.

The architecture guide now describes Axum's prepared-store snapshots, and the
integration environment attaches Axum's recent output when readiness times out.
@prk-Jr prk-Jr linked an issue Nov 19, 2026 that may be closed by this pull request
4 tasks
@prk-Jr
prk-Jr added this pull request to stack #1638 November 19, 2026 13:00

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.

Serve Axum in production mode from main

1 participant