Skip to content

Clarify and verify the Axum local config handoff - #1653

Open
prk-Jr wants to merge 11 commits into
feat/1574-axum-shared-identityfrom
fix/1141-axum-local-config-handoff
Open

prk-Jr wants to merge 11 commits into
feat/1574-axum-shared-identityfrom
fix/1141-axum-local-config-handoff

Conversation

@prk-Jr

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

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #1646 (feat/1574-axum-shared-identity) because the documented setup includes its required writable local record directory. Update the stack by merges only; this PR depends on #1646.

Changes

File Change
crates/trusted-server-cli/src/run.rs Explain inherited directories, secrets, publication, and restart requirements in serve/config-push help.
docs/guide/getting-started.md Launch Option B through ts serve --adapter axum; explain the equivalent Cargo command and same-shell setup.
docs/guide/cli.md Link and describe the supported Axum handoff.
docs/guide/axum-dev.md Describe original publication-file consumption and malformed-envelope smoke coverage.
scripts/smoke-axum.sh Add malformed-envelope rejection; run the positive case through ts serve from the isolated project using the untouched pushed file; stop the launcher and server as one process group. A teardown failure explicitly fails an otherwise passing run, and an earlier failure keeps its own exit status.
README.md, AGENTS.md Point the abbreviated Cargo launch examples to Getting started Option B.
docs/superpowers/specs/2026-11-23-axum-local-config-handoff-design.md Record the audited contract, scope, verification, and two independent review rounds.
docs/superpowers/plans/2026-11-23-axum-local-config-handoff.md Record completed implementation and verification tasks, including the committed serve-path smoke.

No adapter runtime or EdgeZero implementation changes, new runtime environment reads, or regex/pattern compilation changes.

Closes

Closes #1141

Spec

Not a feature. Supporting design and plan; two independent design/plan review rounds ended with no unresolved findings.

Test plan

Verification locations and revisions are explicit below; current head is 6556b4abe, merged with #1646 at aa315593f. The Axum smoke is local-only: no hosted CI job invokes scripts/smoke-axum.sh. It exercises EdgeZero's shell-command serve branch with a copied manifest launching the prebuilt Axum binary; the repository manifest uses cargo run. No workflow changes are included.

  • Hosted CI: 27/27 passed at 04fed78c6 across all five completed workflows, including Fastly/Axum tests and Clippy, reusable-sandbox tests, release WASM build, runtime environment guard, Vitest, and formatting. Rust tests, format/lint, integration tests.

  • Local Axum smoke at 04fed78c6: missing config/secrets and malformed envelopes failed before listen with the expected diagnostics. The positive case ran actual ts serve --adapter axum from the isolated project without EDGEZERO_MANIFEST, used the original pushed file, returned the configured-origin sentinel, and rewrote its URL. A disposable negative control dropped CONFIG_DIR only at serve; the smoke correctly failed with CONFIG_DIR: required for declared stores, then passed again with the real CLI.

  • Local Shellcheck (shellcheck -x scripts/smoke-axum.sh), Bash syntax, cargo fmt --all -- --check, targeted Markdown formatting and diff checks passed at 04fed78c6 with Rust 1.98.1 and Node 24.20.0.

  • Fastly local runtime receipt — cb232dd19: documented ./scripts/smoke-fastly.sh passed through actual fastly compute serve, using CLI 16.0.0 and explicit Viceroy 0.21.0. Verified isolated config push, missing config and each required secret, configured-origin output and URL rewrite. A disposable supplemental probe verified malformed-envelope rejection, exact health 200/ok and repeated publisher requests. Release WASM SHA256: 73f1943de13119c517f432914a606a08ceba50559140df7624905e66ed685093. Existing Fastly CLI settings stayed unchanged; no production deployment occurred.

  • Original local evidence at cb232dd19: Finish Axum production startup on the native baseline #1635 startup tests (8/8) and original smoke; Run Axum identity through the shared application #1646 startup tests (13/13) and original smoke; CLI Clippy/parser test; runtime environment guard fixtures (52/52). The documented Option B Bash commands also ran verbatim in a clean environment through actual ts serve/Cargo against a local origin, verifying health, configured-origin output, rewriting and repeated requests.

  • Cleanup local checks at a75320300: Axum smoke, shellcheck -x scripts/smoke-axum.sh, Bash syntax, targeted Markdown formatting and diff checks passed. The positive Python launcher preserves the existing HOME.

  • Hosted CI on cleanup a75320300: 27/27 passed, across all five completed workflows. Rust tests, format/lint, integration tests.

  • Hosted CI on merge 8a0e931af: 27/27 passed.

  • Merge of Run Axum identity through the shared application #1646 at aa315593f: the merged tree's 11 files from that commit are byte-identical to Run Axum identity through the shared application #1646, whose hosted CI passed 29/29. Locally on the merged tree: cargo test-axum (121 passed, 3 ignored) and core ec::/auction:: tests (1,023 passed).

  • Teardown exit status at 6556b4abe: the old cleanup already failed a passing run on teardown failure, but only because set -e acted on the trap's return; it also replaced an earlier failure's status with the teardown status. Driving the real cleanup() under an EXIT trap with stubbed helpers, on Bash 3.2 and 5.2, now gives passing run + teardown failure → 1, earlier failure 3 + teardown failure → 3 (previously 1), and unchanged results otherwise. Axum smoke passes end to end, leaving no workspace or process; shellcheck -x scripts/smoke-axum.sh passes.

  • Hosted CI on 6556b4abe.

Self-review

Independent review found no unresolved blocking or optional findings. The serve-path revision 04fed78c6 passed 27/27 checks; the two-line cleanup at a75320300 also passed local verification and 27/27 hosted checks. The teardown exit-status fix and #1646 merge were independently reviewed. Current head/base: 6556b4abe against aa315593f. Commits are signed and GitHub Verified.

Checklist

  • Feature PRs: not a feature; supporting design linked above includes two review rounds.
  • Changes follow AGENTS.md conventions.
  • No unwrap() added to production code.
  • No production logging changes.
  • Changed smoke covers the added failure case and original-file consumption.
  • No secrets or credentials committed.

@prk-Jr prk-Jr self-assigned this Nov 23, 2026
@prk-Jr prk-Jr linked an issue Nov 23, 2026 that may be closed by this pull request
4 tasks
@prk-Jr
prk-Jr marked this pull request as ready for review November 23, 2026 12:19
prk-Jr and others added 2 commits November 23, 2026 18:32
PR #1532 now reads the native Geo profile path from
TRUSTED_SERVER__NATIVE_GEO_PROFILE_FILE instead of TS_NATIVE_GEO_PROFILE_FILE. No file in this PR
uses the old name after the merge, so the merge only takes the rename from
PR #1646. The merge had no conflicts.
@aram356

aram356 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

For #1532's rename of the native Geo profile variable to TRUSTED_SERVER__NATIVE_GEO_PROFILE_FILE, I pushed 8a0e931af here, one merge of this PR's base:

No file in this PR uses the old name after the merge, so it only takes the rename from #1646. The merge had no conflicts.

Correction: through #1566, this merge also carries five #1540 commits that #1566 had not merged before (CloudFront forwarding authentication, AWS ingress and Terraform demo prerequisites, the example deployment gate and the deployment guide). It is not only the rename.

This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize. They
arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623,
#1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540,
#1566, #1624, #1641, #1642 and #1646, with #1646's move of the request
time into IdentityApp::finalize. It also brings d5276ee, which publishes
the native AWS runtime files without GNU mv -T, and Christian's merge
5597d3e of #1538 into #1540, through #1566's merge.

The base now also carries the Axum serving line (#1613, #1616, #1617, #1615,
#1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which
decodes the Spin discovery document with Response::json, and #1627's merge
of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI.

The merge also brings the 12 #1646 commits this PR lacked, from 48a43ae
to 461aa0d: dhruv8sh's page-phase lookup and /auction EID work
(48a43ae, 82fe088, 1d0a74f, 838586e and his chain merges a061c01,
ecf16e8, e1d23a0, edcf4c5 and 9a020e1), the merge 9cad928 of
#1641 into #1642, and prk-Jr's "Merge providers-awaited into shared
identity" (4ffbaf8) and "Restore Fastly auction browser gating"
(461aa0d).

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

Restacking on the Axum serving line conflicts in scripts/smoke-axum.sh and
the Axum development guide, where #1617 changes the smoke's negative
startup cases from exiting before listen to serving the failure router.

Axum smoke: run_case keeps this PR's launch, where the positive case runs
`ts serve --adapter axum` in its own process group and the others run the
binary, followed by #1617's readiness and failure-router checks. This PR's
malformed-envelope case gives way to #1617's case of the same name, which
expects the failure router's 503 and the same parse diagnostic; #1617's
invalid-settings and hostile cases follow it.

Axum development guide: the negative-case paragraph keeps this PR's
malformed-envelope start and #1617's failure-router expectation.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.

The base now also carries #1627's 4d0c1a2, which renames the generic
runtime KV store to trusted_server_runtime_kv, #1488's a610152 and
9104fd3, which add hashed-email intake for the LiveRamp and ID5
identity providers, and #1646's aa31559, which gates identity writes for
rejected clients.

This PR's head moves to 6556b4a, which keeps the smoke's original exit
status when teardown fails, through a6b0211, its clean merge of #1646's
aa31559. Taken as the change from the old head 8a0e931, the new head
would replay #1646 commits the base already carries in rebuilt form and
conflicts in six files. a6b0211 is a clean merge of aa31559, which
the base has, so the merge takes the change from a6b0211: 6556b4a's
scripts/smoke-axum.sh edit, which applies cleanly.
aram356 added a commit that referenced this pull request Nov 25, 2026
…dentity

#1653 (2e2ea20) is on #1646, and its merge brings the Fastly SDK 0.13.3
upgrade. The merge is clean.
@aram356

aram356 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 2e2ea205f, a merge of #1646's new head b5a5f62f8 onto this PR's 6556b4abe. It brings #1646's 4f4c03689 and 71a573a08, the chain below with #1617's failure-router contract, and #1506's repin of EdgeZero to rc/identity at d063a8e7 with main's Fastly SDK upgrade (#1671). The conflicts were in scripts/smoke-axum.sh and the Axum development guide, where #1617 changes the smoke's negative startup cases from exiting before listen to serving the failure router:

#1646's new head 9f648f6 brings #1537's b181544, "Accept any Fastly EC
store link name at startup", which #1537's owner merged up through #1539,
#1538 and #1540. The merge is clean.
aram356 added a commit that referenced this pull request Nov 26, 2026
#1653 (93e2e29) carries #1537's b181544, "Accept any Fastly EC store link
name at startup", through the chain below it. The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 93e2e29c0, a merge of #1646's new head 9f648f694. It brings #1537's b181544a0, "Accept any Fastly EC store link name at startup", which #1537's owner merged up through #1539, #1538 and #1540. The merge had no conflicts.

Takes #1646's new head 9333826, which carries #1506's repin of EdgeZero to
rc/identity at 459bd27d (42e0c46): PR 275 at 0e2a58ae, the stack's test
fixes and EdgeZero 536's bounded record update, RecordHandle::update.

The merge is clean.
aram356 added a commit that referenced this pull request Nov 26, 2026
#1653 (b61d141) carries #1506's repin of EdgeZero to rc/identity at
459bd27d (42e0c46), with PR 275 at 0e2a58ae, the stack's test fixes and
EdgeZero 536's bounded record update, RecordHandle::update, through the
chain below it. The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed b61d14132, a merge of #1646's new head 933382699, which brings #1506's repin of EdgeZero to rc/identity at 459bd27d (42e0c46c7): EdgeZero #275 at 0e2a58ae, the EdgeZero stack's test fixes and EdgeZero #536's bounded record update, RecordHandle::update. The merge had no conflicts.

#1646's new head 4f1c155 brings #1539's cf4e815, "Expect the failure router in the native container test", and #1646's a18abf4, "Compare undeclared Axum KV stores with assert_eq". The merge is clean.
aram356 added a commit that referenced this pull request Nov 26, 2026
…dentity

#1653 (a0ee47b) carries #1539's cf4e815, "Expect the failure router in the native container test", and #1646's a18abf4, "Compare undeclared Axum KV stores with assert_eq". The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed a0ee47b5a, a merge of #1646's new head 4f1c15544, which brings #1539's cf4e815d4, the native container test's failure-router expectation, and #1646's a18abf428, the reworked KV check in the store metadata test. The only change to this PR's tree is that store test. The merge had no conflicts.

@dhruv8sh dhruv8sh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR makes no functional changes. It documents the Axum local config handoff: ts config push --adapter axum --local, then exporting the CONFIG_DIR, DATA_DIR and SECRETS variables, then ts serve --adapter axum. The same steps are added to the CLI help, README, AGENTS.md and the guides. The scripts/smoke-axum.sh changes hold up on review. The only finding is a non-blocking wording mismatch in the design spec.

Cross-cutting / body-level findings

  • 🤔 Design spec disagrees with how the malformed envelope is handled — The design spec says the malformed envelope "must exit nonzero with a parse diagnostic before any HTTP response". The smoke script and axum-dev.md expect something different: the failure router keeps listening and returns 503. Consider changing the spec wording to match the actual behaviour.
  • 📝 Malformed-envelope case is already covered — The malformed-envelope case the docs mention already exists in scripts/smoke-axum.sh (around line 252).
  • 👍 Smoke positive case uses the real handoff — scripts/smoke-axum.sh now reads the pushed .edgezero map unchanged and runs it through ts serve with a rewritten manifest serve command.
  • 👍 Process group handling is correct — The smoke script starts the CLI in its own process group with setsid, and APP_PROCESS_GROUP="-PID" is passed correctly to kill -- -PID.
  • 👍 Teardown has a time limit and reports failures correctly — A teardown failure now fails an otherwise passing run. It does not replace the exit status of an earlier failure.
  • 👍 Manifest rewrite fails loudly — The Python rewrite step requires exactly one serve = "cargo run ..." match, so it fails loudly if the manifest drifts.

CI Status

  • integration tests: PASS
  • integration tests (Fastly EC lifecycle): PASS
  • browser integration tests: PASS
  • format-typescript: PASS
  • trace runtime and browser acceptance: PASS
  • CLAUDE.md symlink guard: PASS
  • CI Node pin guard: PASS
  • cargo fmt: PASS
  • Native provider acceptance script: PASS
  • release scripts: PASS
  • format-docs: PASS
  • prepare integration artifacts: PASS
  • cargo test (cross-adapter parity): PASS
  • cargo check (cloudflare native + wasm32-unknown-unknown): PASS
  • docs-proposal scripts: PASS
  • HTML EOF runtime (Fastly): PASS
  • cargo test (ts CLI, native) (ubuntu-latest): PASS
  • Fastly response diff script: PASS
  • ts dev lint domains (changed lines): PASS
  • worker-deadlines (spin): PASS
  • cargo test (axum native): PASS
  • worker-deadlines (cloudflare): PASS
  • cargo test: PASS
  • vitest: PASS
  • health-startup (spin): PASS
  • health-startup (fastly): PASS
  • health-startup (axum): PASS
  • cargo check/build/test (spin native + wasm32-wasip1): PASS
  • stock-celld-records: PASS
  • health-startup (cloudflare): PASS
  • cargo test (ts CLI, native) (macos-latest): PASS

Takes #1646's new head 6b4a5fd, which carries #1506's repin of EdgeZero to
rc/identity at 1619078a (8edc50e), a revert that removes EdgeZero 522
(portable Fastly record providers) and 524 (outbound mTLS client
identities).

The merge is clean.
aram356 added a commit that referenced this pull request Nov 27, 2026
#1653 (41cea4f) carries #1506's repin of EdgeZero to rc/identity at
1619078a (8edc50e), a revert that removes EdgeZero 522 (portable Fastly
record providers) and 524 (outbound mTLS client identities), through the
chain below it. The merge is clean.
@aram356

aram356 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 41cea4f43.

Takes #1646's new head 6b4a5fd, which carries #1506's repin of EdgeZero to rc/identity at 1619078a (8edc50e), a revert that removes IABTechLab/edgezero#522 (portable Fastly record providers) and IABTechLab/edgezero#524 (outbound mTLS client identities).

The merge is clean.

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with non-blocking comments. Reviewed against #1646 at 6b4a5fdc0. I built both binaries from this head, ran the unmodified Axum smoke successfully, and verified the quickstart through the repository manifest’s Cargo command. The hosted Axum smoke also passed. I’d prioritize the teardown and manifest-selection findings.

Comment thread scripts/smoke-axum.sh

app_is_running() {
kill -0 "$APP_PID" 2>/dev/null || {
[ -n "$APP_PROCESS_GROUP" ] && kill -0 -- "$APP_PROCESS_GROUP" 2>/dev/null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R1. A stopped Axum server can fail teardown. The group-wide TERM can kill ts before it reaps Axum. Under a PID 1 that does not reap orphans, I reproduced this with the real binaries: the publisher returned 200, but the smoke exited 1 while only a defunct Axum process remained. kill -0 still succeeds for that group, and KILL cannot clear a zombie. Stop the server first so ts can reap it, then keep bounded group escalation for live descendants.


# Build and start the server in the same shell.
cargo run -p trusted-server-adapter-axum
ts serve --adapter axum

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R2. Push and serve can select different manifests. Push defaults to --manifest edgezero.toml, while serve honors an inherited EDGEZERO_MANIFEST. With that variable pointing at a missing file, I reproduced a successful publication followed by a failed launch. Pin the manifest for the repository-root quickstart; for custom manifests, tell operators to pair push’s --manifest with serve’s EDGEZERO_MANIFEST.

Suggested change
ts serve --adapter axum
EDGEZERO_MANIFEST="$PWD/edgezero.toml" ts serve --adapter axum

rewrite prove the pushed settings reach request handling. Startup integration
tests cover missing files and tampered envelopes; the smoke covers missing map
keys and individual secrets. Retain those controls. Add a malformed
inner envelope case that must exit nonzero with a parse diagnostic before any

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R3. The verification notes describe the old startup contract. The live base already covers this malformed-envelope case: health stays 200, readiness and publisher return 503, and logs contain a parse diagnostic. The current PR keeps that behavior and adds the positive ts serve launch. Please update this design, the corresponding plan item, and the PR description. The description also calls the smoke local-only, but the hosted Axum job ran it and passed on this comparison. Older receipts can stay labeled with the revisions they tested.

Comment thread docs/guide/cli.md
ts serve --adapter fastly
```

For Axum, follow [Getting started, Option B](./getting-started#option-b-axum-server):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R4. The link misses the Option B heading. VitePress renders the heading with the ID option-b-—-axum-server, so this link opens the page without jumping to the setup. Using the rendered ID preserves existing links to that heading.

Suggested change
For Axum, follow [Getting started, Option B](./getting-started#option-b-axum-server):
For Axum, follow [Getting started, Option B](./getting-started#option-b-—-axum-server):

Comment thread scripts/smoke-axum.sh
if source.count(original) != 1:
raise SystemExit('Expected exactly one Axum serve command')
command = 'exec ' + shlex.quote(str(Path(sys.argv[2]).resolve()))
manifest.write_text(source.replace(original, 'serve = ' + json.dumps(command)))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R5. A valid binary path can produce invalid TOML. I ran this with a prebuilt Axum binary under a directory containing 🔧. json.dumps emitted a surrogate pair, and the real CLI rejected the manifest before publication. The base smoke accepted the same path. Put a fixed command such as exec "$AXUM_SMOKE_BINARY" in the manifest and pass the absolute binary path in that smoke-only environment variable.

Comment thread scripts/smoke-axum.sh
(
cd "$WORKSPACE"
# Own the launcher and its server descendants as one process group.
exec "${env_args[@]}" "HOME=$HOME" python3 -c \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R6. The positive launch aborts when HOME is unset. With both prebuilt binaries supplied, the first seven cases passed, then this expansion logged HOME: unbound variable before ts ran. The base smoke passed under the same conditions. Forward HOME only when the caller has set it.

Suggested change
exec "${env_args[@]}" "HOME=$HOME" python3 -c \
exec "${env_args[@]}" ${HOME+"HOME=$HOME"} python3 -c \

Comment thread scripts/smoke-axum.sh
manifest = Path(sys.argv[1])
source = manifest.read_text()
original = 'serve = "cargo run -p trusted-server-adapter-axum"'
if source.count(original) != 1:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R7. The fixture depends on the exact manifest spelling. Removing just the spaces around = passed strict config validation but stopped the smoke here. Target the serve key in [adapters.axum.commands] instead of matching the previous assignment text. The smoke can still copy the real store declarations while replacing only the launcher.

Comment thread scripts/smoke-axum.sh

"${env_args[@]}" "$AXUM_BINARY" >"$log_path" 2>&1 &
APP_PID=$!
if [ "$case_name" = "positive" ]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R8. Renaming the positive case can silently remove handoff coverage. I changed only the case label at the call site. The smoke still passed with a publisher 200, but it rebuilt the config map and never invoked ts serve. Select the handoff explicitly at the call site and pair the config source and launcher in one branch, so a log-label change cannot change what the test covers.

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.

Make Axum consume the local config store written by ts config push

4 participants