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

Fast studio, part 3: what is left of test/studio.test.ts runs in one forge in under 10 s, and its SLOW entry goes #1286

open not picked up yet opened this
opened this

For P0 Trust, under the fast suite (#1242). This is the last of three pieces split out of #1245, which was parked twice.

Once parts 1 and 2 have moved their blocks out, test/studio.test.ts keeps the blocks from describe("servedPhrase") to the end of the file. Today that is lines 6874 to 9283, fourteen blocks: preview latency, the week's counts, finding things, cost, the heading outline, Stop and Redeploy, names, empty lists, the app's description, and the transcript window.

Done looks like

  • [ ] test/studio.test.ts boots one forge and one server, once in beforeAll. Pure functions such as servedPhrase and previewLatency are tested with no forge at all.
  • [ ] bun test test/studio.test.ts runs in 10 s or less, and every test in it takes 1 s or less. The pull quotes the timing.
  • [ ] The file's SLOW entry in scripts/gate.ts (owned by #1245) is removed in this pull.
  • [ ] The pull's check is green.

How (the owner, on #1242: chop and rewrite, not trim). Above each test, write the invariant it proves in one line. Then write the fastest test that proves that line. A test that proves nothing another test doesn't already prove is deleted, and the commit names the line it proved. Boot one forge and one server per file, in beforeAll. Use a fake clock, never Bun.sleep. Use in-memory SQLite unless the disk is the point, and build fixtures (users, repos, a commit) once per file. No chromium, bwrap or real network in the gate. A test that is slow by nature moves to NIGHTLY in scripts/gate.ts, with its reason.

Why it waits on #1163. Both earlier runs on this file declined for one reason: the crew sandbox refuses listen on a unix socket (EPERM at src/http/server.ts Bun.serve({ unix })). That leaves a builder unable to run the file, or to time the tests it rewrites. Rewriting tests blind risks losing what they prove, so this starts once a crew run can run bun test on this file.

Files: test/studio.test.ts, scripts/gate.ts.

Risks. Coverage loss is the risk. Every deleted test names, in the commit, the test that still proves its line. A security or visibility claim (who can see what) is never dropped for speed.

Brief: a builder (scout or mason). Assign nobody until #1163 and the two other parts land.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs