Repository navigation
Conversation
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's base #509 now stacks on #517. Checked locally at |
|
For the identity integration branch (#495), I pushed |
|
For the identity integration branch (#495), I pushed |
|
For the identity integration branch (#495), I pushed |
Summary
RequestContext::after_response(budget, task)on Cloudflare Workers so background work starts after terminal response egress without delaying delivery.waitUntilpromises, give each task a fresh outbound callback scope, and cancel pending work atmin(budget, 30 seconds)after release.after-response-tasksasBoundedCooperativefor Cloudflare and document Workers lifetime limits, registration closure, and lack of persistence or retries.Stacked on #509 (
feature/476-after-response-tasks, basea5c176e1), which supplies the portable task API and response-egress foundation. This PR targets that branch; its changes are the Cloudflare implementation of #478.Integration note: a current
git merge-treecomparison with #496 reports conflicts in Axum response conversion, Cloudflare/Spin contracts, and core error/extractor code. These siblings need reconciliation when integrated.Changes
edgezero-adapter-cloudflare/src/after_response.rs,src/lib.rsedgezero-adapter-cloudflare/src/request.rs,src/response.rsedgezero-adapter-cloudflare/src/cli.rsBoundedCooperativesupport and update the capability test.edgezero-adapter-cloudflare/tests/contract.rsand colocated testsCHANGELOG.mdscripts/check_outbound_docs_contract.mjsCloses
Closes #478
This PR targets
feature/476-after-response-tasks, so merging it into that branch does not automatically close the linked issue(s); close them manually or upon default-branch integration.Test plan
Historical author-reported local verification below (original head unrecorded unless an explicit SHA is given). These results, counts, timings and negative controls were not rerun in this audit, and their underlying local logs were unavailable; checked boxes retain the original report. At the current head
953f0031, all 18 reported hosted checks are passing.Local checks used Rust 1.98.1 and Node.js 24.20.0. Current reported GitHub checks are passing.
cargo test --workspace --all-targetscargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcargo check --workspace --all-targets --features "fastly cloudflare spin"wasm32-wasip1(Fastly) /wasm32-wasip2(Spin) /wasm32-unknown-unknown(Cloudflare) — Cloudflare Worker built and Spin target checked; Fastly target build not rerun for this Cloudflare change.examples/app-demoworkspace:cd examples/app-demo && cargo test --workspace --all-targetscd docs && npm run lint && npm run format && npm run buildedgezero serve --adapter axum— runtime verification used Cloudflare below.cloudflareandcloudflare,test-utils; Cloudflare WASM unit/contract suites and browser ingress suite; outbound documentation contract check.1, expected0).run_appconsumer under local Wrangler 4.83/workerd: response-first return about 3 ms versus an inline-delay control about 306 ms; delayed completion, streaming/full post-egress budget, pending-task drop, fresh outbound transport and old-scope revocation, 204 handoff, 500 fallback, and overlapping request gates all passed.The local workerd run exercises the actual Worker artifact. Hosted Cloudflare deployment was not exercised. Budgets are cooperative, and Workers independently limits the shared
waitUntillifetime; these checks do not establish durable completion. Panic isolation requires an unwinding build; an aborting WASM panic can terminate the invocation.Checklist
{id}syntax (not:id)edgezero_core(nothttpcrate)KvRegistry/ConfigRegistry/SecretRegistry(not the legacy single-handle setters) — existing store wiring is unchanged