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 #2404

Parked opened this
Closed without merging

scripts/smoke.ts now waits for a given version on /healthz and checks /sw.js. Both are covered in test/smoke.test.ts. bun test test/smoke.test.ts test/resilience.test.ts passes (21 tests) and tsc --noEmit is clean.

Notes

stopped parked by the crew deploy 72e2e94

opened this

scripts/smoke.ts now waits for a given version on /healthz and checks /sw.js. Both are covered in test/smoke.test.ts. bun test test/smoke.test.ts test/resilience.test.ts passes (21 tests) and tsc --noEmit is clean. I haven't run the full check; the forge does that on push.

  • --version <v>: the script polls /healthz once a second until X-Forge-Version is <v>. The limit is --wait <seconds>, default 120. If the version never arrives it exits 1 with FAIL … never became <v> in <n>s (last seen: <x>), where <x> is none if no version was ever seen. The polling is exported as waitForVersion.
  • /sw.js check: smoke() fetches /sw.js once, as desktop. It must be a 200 JavaScript response, and its navigation branch must contain no Response.error(). Comments are stripped before that match, because the real worker mentions Response.error() in a comment on the navigation branch. The same check also fails a worker with no navigation handler at all.
  • Tests: the existing stub now serves /sw.js and an x-forge-version header. New tests cover a version that arrives late (passes), one that never arrives (fails within the 1 s limit and names the last version seen), a /sw.js containing Response.error() on the navigation path, and a /sw.js served as text/html. The tests set no globals and no env outside the spawned process.

Left out: only the navigation branch is checked, so the Response.error() fallback for /assets/ and /icons/ requests is allowed. The check is a text match, not a run of the worker. I touched only the script and its test.

Try it: bun scripts/smoke.ts https://… --version <v> --wait 60.

Closes #2388

commented

scripts/smoke.ts now waits for a given version on /healthz and checks /sw.js. Both are covered in test/smoke.test.ts. bun test test/smoke.test.ts test/resilience.test.ts passes (21 tests) and tsc --noEmit is clean. I haven't run the full check; the forge does that on push.

  • --version <v>: the script polls /healthz once a second until X-Forge-Version is <v>. The limit is --wait <seconds>, default 120. If the version never arrives it exits 1 with FAIL … never became <v> in <n>s (last seen: <x>), where <x> is none if no version was ever seen. The polling is exported as waitForVersion.
  • /sw.js check: smoke() fetches /sw.js once, as desktop. It must be a 200 JavaScript response, and its navigation branch must contain no Response.error(). Comments are stripped before that match, because the real worker mentions Response.error() in a comment on the navigation branch. The same check also fails a worker with no navigation handler at all.
  • Tests: the existing stub now serves /sw.js and an x-forge-version header. New tests cover a version that arrives late (passes), one that never arrives (fails within the 1 s limit and names the last version seen), a /sw.js containing Response.error() on the navigation path, and a /sw.js served as text/html. The tests set no globals and no env outside the spawned process.

Left out: only the navigation branch is checked, so the Response.error() fallback for /assets/ and /icons/ requests is allowed. The check is a text match, not a run of the worker. I touched only the script and its test.

Try it: bun scripts/smoke.ts https://… --version <v> --wait 60.

commented

Parked by the crew: the check failed ("a green agent pull and its reviewer > before the review it is the crew's: no ask, no count, a waiting word") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs