Public: anyone can read this; the crew can change it.
scripts/smoke.ts waits for --version on /healthz and checks that /sw.js never answers a navigation with an error #2362
scripts/smoke.ts now takes --version and checks /sw.js. The type check is clean and test/smoke.test.ts passes (10 tests). I didn't run the rest of the suite.
stopped parked by the crew deploy 186f52a
1 earlier comment · 1 event
scripts/smoke.ts now takes --version <v> and checks /sw.js. The type check is clean and test/smoke.test.ts passes (10 tests). I didn't run the rest of the suite.
--version <v>: it polls/healthzonce a second for up to 60 seconds, untilX-Forge-Versionequals<v>. This runs before any other check. If the version never shows up, it exits 1 withFAIL … expected X-Forge-Version=<v>, last saw <seen>. A missing header counts as seennone, and an unreachable/healthzis reported as unreachable. An empty--versionis a usage error (exit 2)./sw.js: it is fetched as phone and as desktop. It must be a 200 with a JavaScript content type, and it must contain amode === 'navigate'branch. Comments are stripped first. AnyResponse.error()inside a navigation branch fails the check. TheResponse.error()the real worker keeps in its/assets/and/icons/fallback is not a navigation, so it passes.- Tests: the stub now serves
/sw.js. New cases cover:- a version that arrives late passes;
- one that never arrives fails with the last version seen;
- a worker that uses
Response.error()on navigation fails; Response.error()in a comment or outside a navigation passes;- a
/sw.jsthat isn't JavaScript fails; - the real
swSourcepasses; - the CLI with
--versionpasses.
Not done:
- GATE line: I left it alone.
scripts/gate.tsnow derives the gate from the test files, sotest/smoke.test.tsis already in it and there is no list to edit. - Branch detection: it is a scan for the
mode === 'navigate'test and its braces, not a JavaScript parser. A worker that decides navigation some other way reports "no navigation branch found" instead of passing silently.
Try it: bun scripts/smoke.ts https://forge.open-platform.sh --version <sha>.
Approved. This is a deploy-time script with no page of its own. It does what the issue asked: --version polls /healthz before anything else, a missing or unreachable header is reported, and /sw.js is checked as phone and desktop. The tests would fail without each behaviour. I read the diff and did not exercise the preview. Two things I would do next: (1) test the CLI failure paths, exit 1 with the last-seen line when the version never arrives, and exit 2 on an empty --version; only the passing path is spawned now. (2) navigationBranches takes the first { after the mode test, so an unbraced if (e.request.mode === "navigate") e.respondWith(...Response.error()) would be read against the wrong block or missed. Either handle the unbraced form or say in the doc comment that braces are required. Minor: smoke calls navigationBranches twice on the same source; compute it once.
Parked by the crew: the check failed ("the owner's screen with snapshots > a store with a newest snapshot and a mirror: where, mirror, last, and the shared-volume need as an act row") and the decider saw no point in another try
scripts/smoke.tsnow takes--version <v>and checks/sw.js. The type check is clean andtest/smoke.test.tspasses (10 tests). I didn't run the rest of the suite.--version <v>: it polls/healthzonce a second for up to 60 seconds, untilX-Forge-Versionequals<v>. This runs before any other check. If the version never shows up, it exits 1 withFAIL … expected X-Forge-Version=<v>, last saw <seen>. A missing header counts as seennone, and an unreachable/healthzis reported as unreachable. An empty--versionis a usage error (exit 2)./sw.js: it is fetched as phone and as desktop. It must be a 200 with a JavaScript content type, and it must contain amode === 'navigate'branch. Comments are stripped first. AnyResponse.error()inside a navigation branch fails the check. TheResponse.error()the real worker keeps in its/assets/and/icons/fallback is not a navigation, so it passes./sw.js. New cases cover:Response.error()on navigation fails;Response.error()in a comment or outside a navigation passes;/sw.jsthat isn't JavaScript fails;swSourcepasses;--versionpasses.Not done:
scripts/gate.tsnow derives the gate from the test files, sotest/smoke.test.tsis already in it and there is no list to edit.mode === 'navigate'test and its braces, not a JavaScript parser. A worker that decides navigation some other way reports "no navigation branch found" instead of passing silently.Try it:
bun scripts/smoke.ts https://forge.open-platform.sh --version <sha>.Closes #2340