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:
@@ -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
|
||||
|
||||
+25
-1
@@ -26,6 +26,27 @@ Evidence roots (relative to repo root):
|
||||
How to run: `devbox run test` = Nim in-process tests first, then the Node black-box harnesses;
|
||||
`devbox run mutation` = the mutation suite. Run everything from the repo root through `devbox run`.
|
||||
|
||||
Both gates run concurrently at `FFF_TEST_JOBS` (default: half the cores, capped at 8; `FFF_TEST_JOBS=1`
|
||||
serialises). Concurrency does not change a test or an assertion; it is safe because the harnesses
|
||||
were already isolated (each Node test file is its own process with its own state dir, free ports,
|
||||
nginx and server). What makes it fast: the real server (clean, `leakfault`, `dispfault`) and the leak
|
||||
checker are built once per source+flags and shared across the parallel files (`lib.mjs`
|
||||
`cachedNimBuild`, locked and published by rename), each Nim test file compiles into a worktree-local
|
||||
`run/nimcache/test-*`, and `fault.test.mjs`'s 22 independent cases are sharded across processes
|
||||
(`FFF_TEST_SHARDS`/`FFF_TEST_SHARD`). Two Node files whose assertions are wall-clock gates
|
||||
(`persistence.test.mjs`'s move-ack budget, `tiles.test.mjs`'s lock-free burst) run alone before the
|
||||
fan-out, so those numbers are never measured under the suite's own load. `devbox run e2e` uses
|
||||
`FFF_E2E_JOBS` (default: the same, capped at 4) and keeps its timing-gate files (`map`, `fog`,
|
||||
`fogbench`, `perf`) in a serial first phase for the same reason. The host froze under uncapped load
|
||||
before, hence the half-cores default.
|
||||
|
||||
Harness state dirs are created under `TMPDIR`; the gates point it at `/dev/shm` when it exists
|
||||
(`FFF_TEST_NO_TMPFS=1` opts out). On a disk-backed `/tmp`, the fan-out's SQLite commits
|
||||
(`synchronous=FULL`) plus transcripts and tile fixtures could stall a first commit long enough for a
|
||||
harness ack to look lost; tmpfs keeps the same SQLite and SIGKILL-restart semantics without the
|
||||
fsync storm. The harness ack/handshake patience is 15 s (`lib.mjs` `HARNESS_TIMEOUT_MS`) so a busy
|
||||
host is not mistaken for a missing answer; the wall-clock gate files keep their own asserted budgets.
|
||||
|
||||
**Do not export devbox's `LD_LIBRARY_PATH` into host tools or stale binaries.** The devbox store is
|
||||
built against glibc 2.44 while this host (NixOS) runs 2.42, so a 2.44-built `libsqlite3` loaded by a
|
||||
2.42 loader fails at load time (or loads a mismatched libc). Rebuild after a `devbox.lock` change
|
||||
@@ -623,11 +644,14 @@ from the prototype, what was missing, what the M3 build added, and the tools it
|
||||
Vitest seam (pure reducer, protocol client, envelope); `devbox run e2e` = the built client through
|
||||
the real server and vhost; `devbox run fogbench` = the 50-token 16384 px server measurement
|
||||
(`results/m4-fog-bench.log`). The finish gate (#76) runs all of them plus `mutation` and `bench`.
|
||||
Both suites fan out files at `FFF_TEST_JOBS` (see "How to run"); no file is serialised for
|
||||
correctness, only the wall-clock gate files are run alone so their budgets stay meaningful.
|
||||
- The nine M3 accept groups and their proving harness tests are mapped in `tools/groups.mjs`;
|
||||
`tools/groups.test.mjs` fails if a group file or its named evidence test disappears, so the
|
||||
acceptance checklist cannot silently go stale. Harnesses that are not an accept group (`smoke`,
|
||||
`walls`, `tokens`, `details`, `scene`, `wsheaders`) run in the same pass.
|
||||
- In-process tests stay Nim (`nimble test`, unchanged).
|
||||
- In-process tests stay Nim (every `tests/*.nim` file, compiled and run like `nimble test`; the
|
||||
runner only bounds how many files compile at once).
|
||||
- Browser e2e details and the client-side extension rules (append-only reducer slices and render
|
||||
modules): `client/README.md`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user