Skip to content

Drain Axum after-response identity tasks on SIGTERM - #1636

Draft
prk-Jr wants to merge 3 commits into
feat/1573-axum-production-servingfrom
feat/1575-drain-after-response
Draft

prk-Jr wants to merge 3 commits into
feat/1573-axum-production-servingfrom
feat/1575-drain-after-response

Conversation

@prk-Jr

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

Copy link
Copy Markdown
Collaborator

Summary

Stack: based on #1635 (feat/1573-axum-production-serving), which is stacked on #1531. The other current open branches do not supply a more appropriate A3 base. This does not require waiting for those reviews or merges.

Temporary dependency — must repin before merge: all six EdgeZero dependencies and Cargo.lock pin b256e5b1da9c3b61b661e039a680e1afeb4bfe23 on preview/r2-after-response. This is the clean merge of rc/identity at 9d02d7b3 with IABTechLab/edgezero#509 at a5c176e1; no new EdgeZero implementation changes. Replace this preview pin with R2 (IABTechLab/edgezero#490) before merging. The preview is not R2.

Changes

File Change
Cargo.toml, Cargo.lock Immutable preview revision; dev-only provider fixture dependency
crates/trusted-server-core/src/ec/after_response.rs Shared captured inputs and guarded lookup runner
crates/trusted-server-core/src/settings.rs Document Axum's whole-task budget
crates/trusted-server-adapter-fastly/src/app.rs, src/post_delivery.rs Use shared runner, preserve delivery and permit gating
crates/trusted-server-adapter-axum/src/app.rs, src/after_response.rs, src/lib.rs Capture request scheduler, prepare optional work, register after successful publisher response assembly
crates/trusted-server-adapter-axum/src/after_response/tests.rs, Cargo.toml Registration and real-process shutdown tests with fixture-only identity storage
docs/guide/edgezero.md, docs/guide/native-rc-demo.md Preview repin requirement, task/shutdown budgets and staged activation
Spec and plan linked below Reviewed design and implementation/verification scope

Closes

Closes #1575 with the following explicit acceptance boundary, matching #1573's staged approach:

Spec

Design · Plan

Two independent design/plan review rounds completed; all blocking and optional feedback resolved. Independent implementation review also completed. Two fresh self-reviewers found no blocking production defects; their shared assertion/reporting precision finding was corrected by enforcing strict successful shutdown bounds and rerunning the affected tests. Both verified the correction on the final head: zero unresolved blocking or optional findings.

Test plan

Final reviewed head: 53650c24264f919f6ba18aebb0690a5b5f1ca866; base: 6949eea868adc9427f965f984d9ea049e4b36f69.

Full local CI intentionally not run, as requested. After the reported failure, CI on 4ee94f8b7 was inspected: both failing jobs (cargo test (cross-adapter parity) and integration tests) stopped at the same stale identity-guard exception for Fastly's former direct commit_after_response_lookups call. The call moved to core in this PR; 53650c242 removes its obsolete pending-migration exception while retaining the forbidden-symbol check.

The std-only identity-guard test source was reproduced locally with Rust 1.98.1: 8 passed/1 failed before the correction, then all 9 passed with -D warnings. A disposable negative control reintroducing the direct Fastly call was rejected. Rust formatting, changed-line domain lint and an independent review also passed. This targeted validation used rustc --test with the actual crate's CARGO_MANIFEST_DIR; the Cargo integration suite and full local CI were not rerun. New-head CI remains pending/unassessed, and the R2 repin is still required before merge.

  • cargo test-fastly && cargo test-axum
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: unchanged
  • JS format: unchanged
  • Docs format: targeted changed Markdown files only
  • WASM release build: not run locally
  • Manual testing via fastly compute serve: not run
  • Native core after-response tests: 16 passed.
  • Fastly affected tests under pinned Viceroy 0.21.0: 7 lookup + 7 post-delivery tests passed, including fallback/committed-body gating.
  • Axum adapter suite: 94 passed; 2 intentionally ignored tests (subprocess entry is invoked by parents; real Next.js fixture requires external setup), plus 3 ignored documentation examples. Included 10 after-response tests.
  • cargo clippy-axum; targeted native core lib and Fastly all-target/all-feature clippy passed.
  • Documentation generated for core/Axum; 30 warnings in unchanged core documentation, none in new APIs.
  • Changed-line domain lint against the stacked base; Rust and changed-Markdown formatting passed.

Runtime evidence: the subprocess fixture uses the real EdgeZero production host and the same Axum scheduling helper. Its live row and guarded store are test-only; the real pull-sync coordinator consumes a scripted provider response. A separate actual SDK HTTP call from the runner's post-response row read verifies the fresh outbound scope. This qualifies the infrastructure; it does not qualify deployed record persistence or a real partner HTTPS integration.

The control skips registration: response drain succeeds while lookup/write completion disappears. Additional tests exercise shared request/task grace, independent task-budget cancellation and client disconnect. Ordinary operator-path serving and response drain are tested separately from fixture activation. Real Chrome through the publisher proxy executed injected TSJS on candidate and exact #1635 base. During a publisher request, candidate completed a 1.45 MB response and exited 0 in 3.288 s of a 5 s grace; exact #1635 control exited 0 in 3.151 s. Image 404s and analytics 411s reproduced on the base. The operator smoke used a private compatibility projection with unsupported identity-only Prebid behavior, auctions and request signing disabled; it does not certify those features. All original local files were restored exactly; no operator trusted-server.toml or .env edits.

The registered-task fixture separately proves response completion before the guarded write and successful exit strictly within its 2 s grace. Skipping registration removes the lookup/write while preserving response drain. With 450 ms spent on a held response and an 850 ms task, the 1 s shared grace cancels the write; it does not grant another task grace. Task-budget cancellation and disconnect release also pass.

EdgeZero qualification: all 10 selected after-response tests, format and targeted Axum clippy passed on the preview tree. Four broader native proxy/TLS hosting tests fail locally (including serial rerun): native_selected_families_conflicts_malformed_sets_gaps_and_exhaustion, native_source_bound_single_proxy_and_mapped_cidr_match_only_owned_peers, and native_two_proxy_chain_stops_at_untrusted_hop_and_gateway_replaces_prefix fail at the response-head check in crates/edgezero-adapter-axum/tests/production_hosting.rs:394; native_verified_tls_ingress_overwrites_public_assertions_and_rejects_wrong_name reports an unexpected TLS EOF at line 875. Attribution is unresolved. The preview adds only four test-file changes over the previous pin, with no EdgeZero runtime-code delta. No EdgeZero implementation fix was attempted or added here.

Checklist

  • Feature spec linked above with at least two independent review rounds
  • Changes follow repository conventions
  • No production unwrap(); uses log macros
  • New behavior has focused tests
  • No secrets or credentials committed
  • Repin EdgeZero preview to R2 before merge
  • Final independent self-review and PR-description reconciliation

@prk-Jr prk-Jr self-assigned this Nov 19, 2026
@prk-Jr prk-Jr linked an issue Nov 19, 2026 that may be closed by this pull request
3 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.

Drain after-response tasks on SIGTERM

1 participant