docs: record test wall times and the parallelism knob

Adds the warmed/cold table for test/client-test/e2e, the pre-push total,
mutation and bench, the machine/commit note and the FFF_TEST_JOBS /
FFF_E2E_JOBS overrides. TESTING explains what makes the fan-out safe (per-file
isolation, shared build cache, worktree-local nimcache, tmpfs state dirs) and
why the wall-clock gate files still run alone.
This commit is contained in:
2026-11-21 21:42:34 +01:00
parent 1ac46b4969
commit 514104f897
2 changed files with 57 additions and 3 deletions
+32 -2
View File
@@ -325,7 +325,7 @@ panel); it needs USB debugging, the overlay does not.
| command | what it does |
|---|---|
| `devbox run test` | the server gate: Nim in-process tests (`nimble test`), then the Node black-box harnesses in `tools/*.test.mjs`, then a check that every registered evidence test actually ran and passed |
| `devbox run test` | the server gate: every Nim test file under `tests/`, then the Node black-box harnesses in `tools/*.test.mjs`, then a check that every registered evidence test actually ran and passed |
| `devbox run serve` | the LAN playtest stack: server + client build behind TLS/HTTP2 nginx, persistent state under `run/lan`; `-- --image=<file> [--tile-size=<px>]` imports first, `-- --dry-run` prints the parsed options and exits |
| `devbox run seed` | 49 deterministic NPC tokens over the real WebSocket; `-- --url=<origin> --tokens=49 --vision=1` |
| `devbox run client-test` | client unit tests (Vitest): the pure reducer, protocol client and envelope; no DOM, no GPU |
@@ -340,6 +340,36 @@ panel); it needs USB debugging, the overlay does not.
The finish gate before a release is `test` + `client-test` + `e2e`; add `mutation` and `bench` when
you touch geometry, vision, move rules or egress.
### How long the tests take
Measured 2026-11-21 on the 16-core Linux host (NixOS, kernel 6.18.64), branch `chore/test-speed`
on 30b3559, with the owner's LAN `serve` running and a second worktree's suite sharing the host for
part of the run (so the numbers are conservative). "Warm" = the worktree's Nim cache
(`run/nimcache/`) is populated; "cold" = it was removed first. The client `node_modules`/`dist`
were present in both.
| suite | warm | cold | notes |
|---|---|---|---|
| `devbox run test` | 41 s | 91 s | 419 Nim checks + 167 Node tests; the 22 fault cases are sharded, the rest fan out at `FFF_TEST_JOBS` |
| `devbox run client-test` | 0.8 s | 0.8 s | Vitest reducer/protocol seam, no build |
| `devbox run e2e` | 126 s | 166 s | 29 browser tests; the client build runs every time; timing-gate files stay serial |
| **pre-push total** | **≈168 s** | **≈258 s** | `test` + `client-test` + `e2e` |
| `devbox run mutation` | 521 s | — | 81 mutations (control + 80) on temp copies; `MUTATION_JOBS` defaults to nproc/4 |
| `devbox run bench` | 8 s | — | release build plus the vision/egress run |
| `devbox run import-scale` | ~25 s | — | 16384 px / 65,536-tile import soak; its own script, not in the pre-push gate (#83) |
Before this change the same host measured 263 s warm / 422 s cold for `test` and 176 s for `e2e`
(pre-push 440 s warm / 598 s cold).
Parallelism defaults to half the cores, capped at 8 (the host froze under uncapped load before);
the e2e caps its browser workers at 4. Override with `FFF_TEST_JOBS` (e.g. `FFF_TEST_JOBS=1
devbox run test` serialises the whole gate) or `FFF_E2E_JOBS` for the browser suite alone. Tests
are not weakened by this: the isolation was already per test file (own state dir, free ports, own
nginx/server), and the files whose assertions are wall-clock gates (`persistence`, `tiles`; e2e
`map`, `fog`, `fogbench`, `perf`) run alone first. Harness state dirs live on tmpfs (`/dev/shm`)
when it exists, so the fan-out's SQLite fsyncs do not stall on the disk (`FFF_TEST_NO_TMPFS=1` opts
out). Per-job logs land in `run/logs/`; the gate summaries stay in `results/`.
### Layout
| path | contents |
@@ -350,7 +380,7 @@ you touch geometry, vision, move rules or egress.
| `tools/` | Node black-box harnesses (WS/HTTP against the real binary), the test nginx, the tile and scene fixture writers, the bench and the mutation script |
| `docs/` | `DESIGN.md` (the spec), `TESTING.md` (how each rule is proven), `adr/` (decisions and why), `agents/` (agent workflow), `research/`, `DESIGN-history.md` |
| `results/` | committed gate evidence (`bench.log`, `leak-*.log`, `mutation.log`, `nimble-test.log`, `probing.log`, `faults.log`, `m4-fog-bench.*`); the per-run `node-test.log`, `e2e.log` and `client-test.log` are regenerated, not committed |
| `run/` | gitignored scratch: built binaries, nimcache, local state dirs |
| `run/` | gitignored scratch: built binaries, worktree-local nimcache (including the test files'), per-job test logs (`run/logs/`), local state dirs |
| `docs/archive/prototypes/` | the three prototypes whose measurements the design cites, frozen at the M4 build (#76); the maintained code is `server/` and `client/` |
`GLOSSARY.md` at the root defines the domain words (wall switch, preset, token, character, player