Repository navigation
Conversation
…e tasks Spin does not run after-response tasks. Every converted Spin request now carries a scheduler that rejects registration with 501 Not Implemented and the message exported as edgezero_adapter_spin::AFTER_RESPONSE_UNSUPPORTED, instead of core's generic "not supported by this adapter" message. The task is dropped without being polled. The handle is installed in into_core_request_head, which every native Spin entry point uses (run_app, run_app_with_platform, dispatch_app, AppExt::dispatch, dispatch, dispatch_with_kv_label, into_core_request). The capability matrix already reports Spin Unsupported, so required = ["after-response-tasks"] still refuses Spin. Tests: host unit test for the scheduler; wasm32 contract test dispatching a real SpinRequest. Docs: capabilities, Spin guide, changelog, core after_response docs, design and plan.
Installing a rejecting Spin scheduler changes a zero budget from 501 to 500: core now finds a handle and rejects the budget before the scheduler, as it already does on Axum and Fastly. The guides, changelog and spec claimed every Spin registration returns 501 and that the zero budget case was unchanged. Correct them and pin the 500 with a Spin unit test. Also note that core pre-dispatch hooks can replace or remove the handle (removal falls back to core's 501), that PR #512 overlaps on the CHANGELOG line as well as the capabilities bullet, and point the #509 design at the follow-up.
#509 (2620377) adds bounded work after the response on Fastly and Axum, drained on Axum SIGTERM (EZI-1, #476). #512 (cdc232c) runs it on Cloudflare through waitUntil (#478), and #515 (ec347a2) reports Spin's capability error (#483). The line now stacks on #517 and each PR merged the one below it, so this merge is clean.
|
For Trusted Server's identity integration chain, this PR now stacks on #512 instead of #509: the two conflicted in Checked locally at |
Summary
ctx.after_response(budget, task)on Spin fell through to core's generic501 after-response tasks are not supported by this adapter. That error looks the same as a bare core context or an adapter that forgot to install a scheduler.501 Not Implemented(kindnot_implemented) withafter-response tasks are not supported by the Spin adapter, exported asedgezero_adapter_spin::AFTER_RESPONSE_UNSUPPORTED. The task is dropped without being polled.501, because core found no handle and refused before checking the budget. It now returns500, because core rejects a zero budget before calling any installed scheduler. Axum and Fastly already return500here (Add bounded after-response tasks on Fastly and Axum #509 treats a zero budget as a programming error). Cloudflare keeps501until After-response work on Cloudflare (waitUntil) #478.Unsupported, sorequired = ["after-response-tasks"]still refuses Spin atbuild/serve/deploy.Stacked on #509 (
feature/476-after-response-tasksatc3ba7e56), which addsRequestContext::after_responseand theafter-response-taskscapability. #483 is blocked by #476. #512 (Cloudflare, #478) is also stacked on #509. The two PRs overlap in two places: the after-response bullets indocs/guide/capabilities.mdand the capability line inCHANGELOG.md. #512 also says "Spin installs no scheduler". Whichever lands second drops that sentence and the "tracked in #483" wording.Design:
docs/superpowers/specs/2026-11-18-spin-after-response-error-design.md; plan:docs/superpowers/plans/2026-11-18-spin-after-response-error.md.Changes
edgezero-adapter-spin/src/after_response.rs(new)AfterResponseScheduler: drops the task and returnsEdgeError::not_implemented(AFTER_RESPONSE_UNSUPPORTED); host unit tests: poll and drop probes, and zero budget returns 500edgezero-adapter-spin/src/lib.rspub const AFTER_RESPONSE_UNSUPPORTED; module gated likeingressedgezero-adapter-spin/src/request.rsinto_core_request_headinserts the handle. This coversrun_app,run_app_with_platform,dispatch_app,AppExt::dispatch,dispatch,dispatch_with_kv_labelandinto_core_requestedgezero-adapter-spin/tests/contract.rsSpinRequestthroughdispatch_requestto a route that registers a task gets the Spin 501; the task is never polled and is dropped once; a control route returns 200edgezero-core/src/after_response.rsdocs/superpowers/specs/2026-11-17-after-response-tasks-design.mddocs/guide/capabilities.md,docs/guide/adapters/spin.md,CHANGELOG.mddocs/superpowers/{specs,plans}/2026-11-18-spin-after-response-error*.mdNot covered, by construction:
send_assembly_error(no app, no handlers) and the test-utilsdispatch_ingress_*bridges, which build core requests directly. Both keep core's generic 501.Closes
Closes #483
Test plan
Local, Rust 1.98.1 (pinned) and Node 24.20.0:
cargo test --workspace --all-targets(2824 passed)cargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcargo check --workspace --all-targets --features "fastly cloudflare spin"wasm32-wasip2(Spin):cargo check -p edgezero-adapter-spin --target wasm32-wasip2 --features spin, plus Spin wasm clippy forspinandspin,test-utils. Fastly and Cloudflare are untouched and were not rebuilt.examples/app-demoworkspace:cd examples/app-demo && cargo test --workspace --all-targets(68 passed)cd docs && npm run lint && npm run format && npm run build;node scripts/check_outbound_docs_contract.mjsedgezero serve --adapter axum: not applicable (Spin-only change); runtime check below used Spin.--test contract --test sdk_resourcesunder Wasmtime 48.0.2 (36 + 25 passed);adapter_capability_matrix_matches_contracts(--features cli).spin up4.1.0. A scratch copy ofexamples/app-demogot an/after-taskroute, which propagates the registration error with?and whose task would print a stderr marker. The same copy was built from this branch and from Add bounded after-response tasks on Fastly and Axum #509:501 {"error":{"kind":"not_implemented","message":"after-response tasks are not supported by the Spin adapter","status":501}}on two consecutive requests.501 ... not supported by this adapter./and/echo/spinreturn 200 on both builds.Hosted Spin (Akamai Functions) was not exercised. GitHub CI is pending.
Checklist
{id}syntax (not:id)edgezero_core(nothttpcrate)KvRegistry/ConfigRegistry/SecretRegistry(not the legacy single-handle setters); store wiring is unchanged