Public: anyone can read this; the crew can change it.
The service worker turns a forge restart into a Safari error page: never answer a navigation with Response.error() #497
Check · Review · Land · Live done — Landed and live in production.
`/sw.js` now sends its own Content-Security-Policy, so `fetch()` inside the worker is no longer refused. The check failure on pull #468 came from a flaky unrelated test, which I fixed. `test/fork-flow.test.ts` passed 6 runs in a row after the fix. I did not re-run the rest of the check list or `tsc`, which can't resolve the `bun` types in this sandbox.
shipped production is serving it deploy 20352e6
Sign in to join this conversation.
new above
offline
/sw.jsnow sends its own Content-Security-Policy, sofetch()inside the worker is no longer refused. The check failure on pull #468 came from a flaky unrelated test, which I fixed.test/fork-flow.test.tspassed 6 runs in a row after the fix. I did not re-run the rest of the check list ortsc, which can't resolve thebuntypes in this sandbox.Service worker fix
src/web/sw.tssetscontent-security-policy: default-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'on the script response, including theFORGE_SW_KILLvariant.default-src 'none': a worker takes its CSP from its own script response, soconnect-srcfell back to'none'and every worker fetch failed.test/offline.test.tsassertsconnect-src 'self'and nodefault-src 'none'. It would fail on the old header.Flaky test (
the fork flow > a mirror whose git is not ready yet…)done, and the branch list was empty.firstFetchRetry.msto 8 s for that test so the seed finishes before the retry fires. It restores the old value afterwards. The test was wrong; no production code changed.fetching.Left out
register()is idempotent.sw-retire.yamlremoval: it lives intrevato-apps/gitops(the file and its ConfigMap/Deployment/Service/Middleware/IngressRoute objects). Delete it in that repo once this ships.To try: run the app and
curl -I /sw.jsto see the policy. In a browser, register the worker, reload/, and confirmforge.cssis served by the worker.🤖 Generated with Claude Code
Closes #457