test(walls): rewrite the leak scenario as one world, gate every fault class (#61)

The Walls r1 scenario had grown appendages: a marked window bolted on in the
room, a one-way wall tacked onto the southern walk, and no secret or locked
door at all. #61 makes it one coherent world and proves the world itself.

The world now holds a room entered through an opening door, a far wall with a
solid stretch, a secret door and a locked door (a token behind each, so their
absence from the transcript is the leak proof), a one-way screen the subject
sees across, a marked window in the room, the same window's switch cleared and
restored (retraction and re-earn end to end), a marked solid wall, and a marked
window the subject never sees.

- tools/leak.mjs: declarative WORLD with role handles (no wallIds[1] indexing),
  narrative groups, and a scenarioCoverage() reading the GM's wall frames and
  the subject's marker frames.
- tools/leak.test.mjs: asserts the coverage on subject A: one-way wall, secret
  door, locked door, a marked window on each side of the sight gate and a
  marked non-window.
- tools/groups.mjs: the leak+fault group lists doors.test.mjs (#56) and
  markers.test.mjs (#59/#60) with their proving tests.
- docs/TESTING.md: the scenario, the coverage gate and the marker retraction
  exercise are recorded as built.

Fault matrix: all 21 fault classes still caught as exactly their own class
(oneWay, markerEarly/Extra/Off included); 22 tests with the clean-build gate.
That build passes and its bytes carry no LEAK_FAULT. nimble test and the
136-test node suite green.

Ref #61
This commit is contained in:
2026-11-19 23:58:45 +01:00
parent a69563f701
commit f9f26a4a01
4 changed files with 202 additions and 88 deletions
+13 -3
View File
@@ -60,7 +60,7 @@ How to run: `devbox run test` = Nim in-process tests first, then the Node black-
| # | Proving test |
|---|---|
| T1 | leak test + fault classes |
| T2 | fault `walls` [MEASURED caught]; door-equivalence test (T17, §10.3) [MEASURED caught: fault `secretgap`]; `MARKER_EARLY`/`MARKER_EXTRA`/`MARKER_OFF` (§10.3) [MEASURED caught: `tools/fault.test.mjs`, Walls r1 #60] |
| T2 | fault `walls` [MEASURED caught]; door-equivalence test (T17, §10.3) [MEASURED caught: fault `secretgap`]; `MARKER_EARLY`/`MARKER_EXTRA`/`MARKER_OFF` (§10.3) [MEASURED caught: `tools/fault.test.mjs`, Walls r1 #60]; scenario coverage of the rewritten leak world (Walls r1 #61) [MEASURED: `tools/leak.test.mjs`] |
| T3 | faults `other-*` [MEASURED caught] |
| T4 | leak (d) against the independent oracle, smoke steal check, direct `/_tiles/` -> 404 (M3 test nginx) |
| T5 | documented, not testable as a leak; M4 timing gates (§13) |
@@ -325,7 +325,7 @@ from the prototype, what was missing, what the M3 build added, and the tools it
|---|---|---|
| Geometry unit tests (M1 port baseline: 33 test blocks / 98 checks, none dropped; current count in `results/nimble-test.log`) | `tests/tgeometry.nim`, `results/nimble-test.log` | Port with `geometry.nim`. |
| Geometry mutation check | `tools/mutation.sh` (a: no +-RayEps rays, b/c: upper/lower segment end exclusive) | Control passes, each mutation fails >= 1 test [MEASURED 1, 2, 2]. Port. |
| Leak test | `tools/leak.mjs`, `leakcheck.nim`, `leaktest.sh` | Subject A and B, fresh DB, ~240 steps; asserts (a)-(e) in README. Independent LOS oracle for token visibility (added after the bow-tie bug). |
| Leak test | `tools/leak.mjs`, `leakcheck.nim`, `leaktest.sh` | Subject A and B, fresh DB, ~240 steps; asserts (a)-(e) in README. Independent LOS oracle for token visibility (added after the bow-tie bug). Walls r1 #61 rewrote the scenario into one world (a marked window, a one-way wall, a secret and a locked door, marked walls on both sides of the sight test) and `tools/leak.test.mjs` asserts that coverage. |
| Negative control / fault injection | `tools/faulttest.sh`, `-d:leakfault` build | 8 faults, exact failure-class set each, clean build passes, `LEAK_FAULT` string asserted absent from clean binary [MEASURED 8/8]. Port and extend. |
| Restart | `tools/restart.mjs` | SIGTERM + SIGKILL, identical player keys/positions/doors/vision/explored/hello+state. |
| Concurrency | `tools/concurrency.mjs` | 60 s, 3 clients, gseq monotonic, every intent acked, quiesced views == fresh connection. **M5 port [FIXED, #15]:** 6 walkers on one GM socket (~200/s) exceeds the 30/s per-connection rate (DESIGN §6.4); spread walkers across connections (4 per player, 16 total; DESIGN §4.3). |
@@ -356,6 +356,14 @@ from the prototype, what was missing, what the M3 build added, and the tools it
transcript checker); `MARKER_EARLY`/`MARKER_EXTRA`/`MARKER_OFF` (#60), each asserted as exactly
its own class by `tools/fault.test.mjs` (the leak transcript checker, with the scenario's unseen
marked window and marked solid wall as the negative controls).
**The scenario itself (Walls r1 #61)** is one coherent world, not appended fragments: a room with
an opening door, a far wall holding a solid stretch, a secret door and a locked door with a token
behind each, a one-way screen, a marked window the subject sees, the same window's switch cleared
and restored (retraction and re-earn), a marked solid wall and a marked window the subject never
sees. `tools/leak.test.mjs` asserts that coverage from the GM's wall frames and the subject's
marker frames, so a rewrite that drops an element fails on its own, not only inside a fault. All
pre-existing classes still fire under the rewrite, each as exactly its own class (all 21 entries
of the `FAULTS` table of `tools/fault.test.mjs`, 22 tests with the clean-build gate).
`tools/leakcheck.nim`
refuses the `gm` bucket, the `owner` bucket on a
non-controller and any `source` on a player status entry. Two consequences: the `hidden` and
@@ -464,7 +472,9 @@ from the prototype, what was missing, what the M3 build added, and the tools it
`set` and `del` for one id in a frame, no explored write from a pure retraction, and durability
of the deletes across a restart. A `LEAK_FAULT=markerCrash` hook quits in a `-d:leakfault` build
between the wall commit and the derived write; after a restart the changed wall's marker is gone
for all four causes while the untouched window's marker is restored (the positive control).
for all four causes while the untouched window's marker is restored (the positive control). The
leak scenario (#61) also drives one retraction and one re-earn end to end, so the transcript
checker's own memory drop is exercised inside the world.
- **Wall fields, storage and migration (#49).** Three gates. **Leak:** `BannedAlways` contains every
wall field name (`thickness`, `position`, `height`, `blocks_sight`, `blocks_movement`, `sight_dir`,
`player_marker`, `door`, `open`, `secret`, `locked`, `label`, `a`, `b`), so any of them in a player