Public: anyone can read this; the crew can change it.
The edge Worker answers a browser with a static "the forge is restarting" page when the body is unreachable #16689
Check · Review · Land · Live done — Landed and live in production.
When the body is unreachable, the edge Worker now answers a browser GET with a 503 restarting page instead of the plain-text 502. The new tests, test/forge-cloudflare.test.ts and test/check-list.test.ts pass, and bun x tsc --noEmit is clean. I didn't run the rest of the suite.
shipped production is serving it deploy 92b768e
When the body is unreachable, the edge Worker now answers a browser GET with a 503 restarting page instead of the plain-text 502. The new tests, test/forge-cloudflare.test.ts and test/check-list.test.ts pass, and bun x tsc --noEmit is clean. I didn't run the rest of the suite.
- Page:
infra/forge-cloudflare/worker.jsaddsrestartingPage(), one self-contained HTML page with inline style and no script. It says the forge is restarting and shows a<time>for when the edge last heard from the body, or says it hasn't heard since it started. The headers areRetry-After: 5,Cache-Control: no-store, a CSP ofdefault-src 'none'; style-src 'unsafe-inline', nosniff andReferrer-Policy. - Which requests get it: a "browser GET" is a GET whose
Acceptincludestext/html./healthzis still the JSON 503. Non-GET requests and non-browser GETs such as/mcpstill get the plain 502, so the existing test is unchanged. - Last heard: it is kept in memory on the Durable Object, set whenever the body answers at all. If the Durable Object is evicted or restarted, the page says it hasn't heard from the body. I chose not to persist it.
- Tests:
test/edge-restarting.test.tsrunsForge.fetchagainst an unreachable body and asserts the status, headers and page, then the "last heard" time after a real answer. It also checks that/healthz, a POST and a non-browser request are unchanged. - Gate list:
scripts/gate.tsneeded no edit. It gates everytest/*.test.tsby default, so the new file is in exactly one place.scripts/gate.ts --fixfound nothing to rewrap. - Reuse: I added no new helpers beyond the page builder. I did not run
scripts/similar.ts.
To try it, run bun test test/edge-restarting.test.ts.
The Worker now answers a browser GET it cannot pass on with a self-contained 503 page: no script, inline style, Retry-After, no-store, a CSP, nosniff and Referrer-Policy. It says the forge is restarting and when the edge last heard from it. /healthz, POSTs and non-browser GETs keep their old answers, and the three tests cover each of these. scripts/gate.ts gates every test/*.test.ts by default, so the new file sits in exactly one list. I did not exercise the edge Worker through the preview, since the preview runs the app and not the Worker; I judged it from the source and the tests.
Two things I would do next:
- The page is a plain 'restarting' and the timestamp is a raw ISO string. A phone reader would be better served by 'last heard 2 minutes ago' with the ISO value kept in the datetime attribute. A few lines of server-side formatting are enough, and the page still needs no script.
heardlives only in the Durable Object's memory, so an eviction resets it to 'has not heard from it since it started', which misleads after a long outage. Persist it with state.storage if it turns out to matter.
When the body is unreachable, the edge Worker now answers a browser GET with a 503 restarting page instead of the plain-text 502. The new tests,
test/forge-cloudflare.test.tsandtest/check-list.test.tspass, andbun x tsc --noEmitis clean. I didn't run the rest of the suite.infra/forge-cloudflare/worker.jsaddsrestartingPage(), one self-contained HTML page with inline style and no script. It says the forge is restarting and shows a<time>for when the edge last heard from the body, or says it hasn't heard since it started. The headers areRetry-After: 5,Cache-Control: no-store, a CSP ofdefault-src 'none'; style-src 'unsafe-inline', nosniff andReferrer-Policy.Acceptincludestext/html./healthzis still the JSON 503. Non-GET requests and non-browser GETs such as/mcpstill get the plain 502, so the existing test is unchanged.test/edge-restarting.test.tsrunsForge.fetchagainst an unreachable body and asserts the status, headers and page, then the "last heard" time after a real answer. It also checks that/healthz, a POST and a non-browser request are unchanged.scripts/gate.tsneeded no edit. It gates everytest/*.test.tsby default, so the new file is in exactly one place.scripts/gate.ts --fixfound nothing to rewrap.scripts/similar.ts.To try it, run
bun test test/edge-restarting.test.ts.Closes #16259