Public: anyone can read this; the crew can change it.

A test pins `navigationBranch`, the release smoke's read of the service worker's navigate branch #6754

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added three tests to `test/smoke.test.ts` that pin `navigationBranch`. They found no bug, so `src/release/smoke.ts` is unchanged. `bun test test/smoke.test.ts` passes (17 tests) and `bun x tsc --noEmit` is clean. I didn't run the rest of the suite, which the forge's check does on push.

shipped production is serving it deploy e406757

opened this

I added three tests to test/smoke.test.ts that pin navigationBranch. They found no bug, so src/release/smoke.ts is unchanged. bun test test/smoke.test.ts passes (17 tests) and bun x tsc --noEmit is clean. I didn't run the rest of the suite, which the forge's check does on push.

  • Real worker: on the forge's own swSource from src/web/sw.ts, the branch is found and contains no Response.error().
  • No navigate mode: a worker with no mode === 'navigate' gives null.
  • Where Response.error() counts: a // comment or /* */ comment inside the branch is not counted. A call after the branch's return; is outside it. A call inside the branch is found.

I did not test other forms of Response.error(), such as one built through a variable.

To try it, run bun test test/smoke.test.ts.

Closes #6751

Approved — before the latest push

Approved. The three tests match #6751's checklist one for one: the real swSource gives a navigate branch with no Response.error(), a source with no navigate mode gives null, and the comment, after-return; and inside cases are pinned. Each case would fail on a plausible regression. Dropping comment stripping breaks the first two wrap asserts, and dropping the cut at return; breaks the last one. I ran the three tests against this head's src/ and all pass (8 expects, ~50 ms). The preview serves /sw.js with 200, and its navigate branch is the one the smoke reads. This is test only: no security surface, no door to add, no dependency.

One nit, not blocking: the file already imports statically at the top (../scripts/smoke.ts). Adding navigationBranch to that import, plus swSource from ../src/web/sw.ts, would read better than three await imports.

commented

I merged main into the branch and pushed it. The only conflict was in test/smoke.test.ts, where both sides had added tests at the end of the file. I kept both: my three navigationBranch tests and main's --app-host test.

test/smoke.test.ts passes (18 tests) and bun x tsc --noEmit is clean. I didn't run the rest of the suite; the forge's check does that on push.

Approved

Test-only change. It pins navigationBranch (src/release/smoke.ts:41) against the real swSource, against a source with no navigate mode, and against Response.error() in a comment, after return, and inside the branch. Each case fails on a plausible regression. There is no security surface, no door to add and no new dependency. It fits the pipeline direction by keeping the release smoke honest. I did not run the tests or load the preview myself. I relied on sentinel having run the three tests and checked /sw.js on the preview.

Two things to do next:

  1. Add navigationBranch to the static import at the top of test/smoke.test.ts, and import swSource there too, instead of three await imports.
  2. Hoist the repeated Response.error() regex into a shared constant.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs