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

Each test in test/releases-page.test.ts stands alone: no test leaves the repository public or the fixture half-built for the next #4710

Merged opened this

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

Merged

`test/releases-page.test.ts` now has each test standing alone. The file passed 8 of 8 tests in 20 consecutive runs, and `tsc --noEmit` reports nothing for it. I did not rebase on #4663 or #4681, and I did not check whether their pulls have landed. Nothing in `src/` changed, because no test showed the handler to be wrong.

shipped production is serving it deploy eb43263

opened this

test/releases-page.test.ts now has each test standing alone. The file passed 8 of 8 tests in 20 consecutive runs, and tsc --noEmit reports nothing for it. I did not rebase on #4663 or #4681, and I did not check whether their pulls have landed. Nothing in src/ changed, because no test showed the handler to be wrong.

  • Public flip: the non-admin test now flips the forge repository to public inside a try, and a finally always sets it back to private. One failure there can no longer turn the button, swapping-off and home-link tests red.
  • Fixture users: alice, bob and crew1 are inserted straight into the user table with a placeholder hash and marked verified with markVerified. beforeAll no longer calls createUser. The helper proveAll is gone from this file. The sessions already bypassed the sign-in form.
  • Swapping off: after the 303 and the flash, the test calls beginSwap(). If it succeeds, the test calls endSwap(false) to give the turn back. If it refuses, the test asserts the reason is not "already under way". The swap turn flag is private to src/release/swap.ts, so this is the only way to read it from outside without touching src/. It has a blind spot: if the kernel setting tcp_migrate_req is off, beginSwap() refuses for that reason, and the check then only rules out "already under way".

Closes #4694

commented

test/releases-page.test.ts now has each test standing alone. The file passed 8 of 8 tests in 20 consecutive runs, and tsc --noEmit reports nothing for it. I did not rebase on #4663 or #4681, and I did not check whether their pulls have landed. Nothing in src/ changed, because no test showed the handler to be wrong.

  • Public flip: the non-admin test now flips the forge repository to public inside a try, and a finally always sets it back to private. One failure there can no longer turn the button, swapping-off and home-link tests red.
  • Fixture users: alice, bob and crew1 are inserted straight into the user table with a placeholder hash and marked verified with markVerified. beforeAll no longer calls createUser. The helper proveAll is gone from this file. The sessions already bypassed the sign-in form.
  • Swapping off: after the 303 and the flash, the test calls beginSwap(). If it succeeds, the test calls endSwap(false) to give the turn back. If it refuses, the test asserts the reason is not "already under way". The swap turn flag is private to src/release/swap.ts, so this is the only way to read it from outside without touching src/. It has a blind spot: if the kernel setting tcp_migrate_req is off, beginSwap() refuses for that reason, and the check then only rules out "already under way".
Approved

Test-only change; nothing in src/ moves, and the preview is unaffected. I ran test/releases-page.test.ts at this head: 8 pass, 0 fail. The public flip is now restored in a finally, and fixture users no longer depend on createUser or proveAll. Each test creates what it needs. The change is in scope: it makes the tests independent, with no new dependency and no dead code.

Two things I would do next:

  1. The swapping-off check is weak. It can only rule out "already under way" when beginSwap() refuses for another reason, such as tcp_migrate_req being off. Export a small read-only swapping() from src/release/swap.ts and assert it is false, so the test has no blind spot.
  2. The addUser helper inserts raw SQL that mirrors the user schema. If other test files copy it, move it to test/helpers/ so a schema change touches one place.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs