test: tie group evidence to passing tests and baseline restart on the as-built server (#36)
- tools/groups.mjs evidence entries now name the exact test, a minimum assertion count and the calls its body must keep; groups.test.mjs checks all three. - tools/evidence.mjs parses the spec reporter log and fails the gate unless every registered evidence test ran and passed; test.sh runs it after the Node suite. - restart.test.mjs snapshots the live as-built world on the first server, then compares it to the post-SIGTERM/SIGKILL state (players connect before the GM, so the GM's derived encountered grey is computed on both sides). - Negative controls: a hollowed auth test fails the new evidence check; a planted first-load drop of a token's gm prop bucket fails the new restart baseline while the old restart-to-restart test passed. - Refresh the gate evidence (control + 73 mutations incl. s1-s7, 142 node tests).
This commit is contained in:
+7
-2
@@ -602,8 +602,13 @@ from the prototype, what was missing, what the M3 build added, and the tools it
|
|||||||
|
|
||||||
- **M3 accept result.** Measured 2026-11-20: `devbox run test` exit 0 (Nim suite all pass; 142 Node
|
- **M3 accept result.** Measured 2026-11-20: `devbox run test` exit 0 (Nim suite all pass; 142 Node
|
||||||
harness tests) and `devbox run mutation` exit 0 (control passes, all 73 mutations fail at least one
|
harness tests) and `devbox run mutation` exit 0 (control passes, all 73 mutations fail at least one
|
||||||
expected test). The nine groups map to their proving tests in `tools/groups.mjs`;
|
expected test). The nine groups map to their proving tests in `tools/groups.mjs`. Evidence is
|
||||||
`tools/groups.test.mjs` fails if a group or its named evidence test disappears.
|
executable, not a title substring (#36): `tools/groups.test.mjs` pins each test's exact title, a
|
||||||
|
minimum assertion count and the calls its body must keep, and the last step of `devbox run test`
|
||||||
|
(`tools/evidence.mjs`) parses the reporter output in `results/node-test.log` and fails unless every
|
||||||
|
registered test ran and passed. The restart group takes its baseline from the as-built state on the
|
||||||
|
first server instance, before any restart, not from a state that has already been through one
|
||||||
|
(#36).
|
||||||
- **M4 gate harness.** (a) automated headless-Chromium test with mobile emulation (viewport, dpr, CPU
|
- **M4 gate harness.** (a) automated headless-Chromium test with mobile emulation (viewport, dpr, CPU
|
||||||
and network throttle) against the real server path (nginx HTTP/2 + caching); (b) one manual run on
|
and network throttle) against the real server path (nginx HTTP/2 + caching); (b) one manual run on
|
||||||
the owner's 5-year-old Android phone. The 2026-11-08 prototype phone run is evidence, not the gate
|
the owner's 5-year-old Android phone. The 2026-11-08 prototype phone run is evidence, not the gate
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
leakcheck: subject A (player 2), 55 groups, 2 tokens in view at the end, 10 withdrawals, 1338 explored cells, 0 failures
|
leakcheck: subject A (player 2), 62 groups, 3 tokens in view at the end, 12 withdrawals, 1733 explored cells, 0 failures
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
leakcheck: subject B (player 3), 55 groups, 2 tokens in view at the end, 6 withdrawals, 1767 explored cells, 0 failures
|
leakcheck: subject B (player 3), 62 groups, 2 tokens in view at the end, 6 withdrawals, 1682 explored cells, 0 failures
|
||||||
|
|||||||
+489
-132
File diff suppressed because it is too large
Load Diff
+80
-33
@@ -1,6 +1,6 @@
|
|||||||
Info: Using the environment variable: NIMBLE_DIR='/home/davide/Projects/GDR/FFF_vtt/.devbox/nimble'
|
Info: Using the environment variable: NIMBLE_DIR='/home/davide/Projects/GDR/FFF_vtt-b36/.devbox/nimble'
|
||||||
Info: using /nix/store/0cbdz34lsakfirycixckf6ypsd8hazhg-x86_64-unknown-linux-gnu-nim-wrapper-2.2.12/bin/nim for compilation
|
Info: using /nix/store/0cbdz34lsakfirycixckf6ypsd8hazhg-x86_64-unknown-linux-gnu-nim-wrapper-2.2.12/bin/nim for compilation
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tauth (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tauth (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] GM key (fff-vtt gm-key)
|
Nim Output [Suite] GM key (fff-vtt gm-key)
|
||||||
... [OK] first run creates the single GM and prints a key; re-run prints the same key
|
... [OK] first run creates the single GM and prints a key; re-run prints the same key
|
||||||
... [OK] --new rotates: new key, old key invalid, GM sessions revoked, same player
|
... [OK] --new rotates: new key, old key invalid, GM sessions revoked, same player
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
... [OK] only the hash is stored; the token itself appears nowhere
|
... [OK] only the hash is stored; the token itself appears nowhere
|
||||||
... [OK] unknown hash gives no player; revoking one player leaves the other alone
|
... [OK] unknown hash gives no player; revoking one player leaves the other alone
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tcharacters (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tcharacters (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] the name rule (DESIGN 8: one copy, used by every frame)
|
Nim Output [Suite] the name rule (DESIGN 8: one copy, used by every frame)
|
||||||
... [OK] an owner, a reveal_all and a per-player reveal each expose the actual name
|
... [OK] an owner, a reveal_all and a per-player reveal each expose the actual name
|
||||||
... [OK] visibleName picks the name the recipient knows
|
... [OK] visibleName picks the name the recipient knows
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
... [OK] player.remove hands the player's characters to the GM (DESIGN 3.2)
|
... [OK] player.remove hands the player's characters to the GM (DESIGN 3.2)
|
||||||
... [OK] a character still figured by a token is in use (6.5)
|
... [OK] a character still figured by a token is in use (6.5)
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tconfig (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tconfig (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] config defaults
|
Nim Output [Suite] config defaults
|
||||||
... [OK] defaults: dev origin, port 9000, state dir run
|
... [OK] defaults: dev origin, port 9000, state dir run
|
||||||
... [OK] state dir is joined, not concatenated
|
... [OK] state dir is joined, not concatenated
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
... [OK] --help is not an error and asks for usage, even with a broken env
|
... [OK] --help is not an error and asks for usage, even with a broken env
|
||||||
... [OK] usage lists the three keys and says the bind is fixed
|
... [OK] usage lists the three keys and says the bind is fixed
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tconns (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tconns (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] total cap
|
Nim Output [Suite] total cap
|
||||||
... [OK] 16 reservations succeed, the 17th is refused
|
... [OK] 16 reservations succeed, the 17th is refused
|
||||||
... [OK] a cancelled reservation gives the slot back
|
... [OK] a cancelled reservation gives the slot back
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
... [OK] a Pong is recorded on the right connection
|
... [OK] a Pong is recorded on the right connection
|
||||||
... [OK] a snapshot hands out every live connection without holding the lock afterwards
|
... [OK] a snapshot hands out every live connection without holding the lock afterwards
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tcrypto (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tcrypto (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] sha256
|
Nim Output [Suite] sha256
|
||||||
... [OK] FIPS 180-4 known answers
|
... [OK] FIPS 180-4 known answers
|
||||||
... [OK] padding boundaries: 55, 56 and 64 byte messages differ and are stable
|
... [OK] padding boundaries: 55, 56 and 64 byte messages differ and are stable
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
... [Suite] constant-time compare
|
... [Suite] constant-time compare
|
||||||
... [OK] equal only for identical strings, including the empty case
|
... [OK] equal only for identical strings, including the empty case
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tdb (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tdb (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] open
|
Nim Output [Suite] open
|
||||||
... [OK] creates the file, sets WAL, synchronous NORMAL, busy_timeout, foreign_keys
|
... [OK] creates the file, sets WAL, synchronous NORMAL, busy_timeout, foreign_keys
|
||||||
... [Suite] migrate
|
... [Suite] migrate
|
||||||
@@ -121,11 +121,30 @@
|
|||||||
... [OK] a failing step rolls back: no DDL, no history, version unchanged
|
... [OK] a failing step rolls back: no DDL, no history, version unchanged
|
||||||
... [OK] a slice-2 DB migrates on: the scene is seeded, players and keys survive
|
... [OK] a slice-2 DB migrates on: the scene is seeded, players and keys survive
|
||||||
... [OK] a schema-4 DB migrates on: explored_chunk and entity_status appear, the world survives
|
... [OK] a schema-4 DB migrates on: explored_chunk and entity_status appear, the world survives
|
||||||
|
... [Suite] step 8 wall CHECKs (DESIGN 4.4)
|
||||||
|
... [OK] every impossible wall row is rejected by the database
|
||||||
|
... [OK] a failing step 8 rolls back the rebuild, the history row and the version
|
||||||
|
... [OK] a malformed props_gm refuses step 8 and leaves the schema-7 DB untouched
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/testutil (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tdetach (from package fff_vtt) using c backend
|
||||||
|
Nim Output [Suite] detachedJson
|
||||||
|
... [OK] rebuilds nodes and string payloads
|
||||||
|
... [OK] mutating the source leaves the copy alone
|
||||||
|
... [OK] absent (nil) stays nil and null stays null
|
||||||
|
... [Suite] detachedString
|
||||||
|
... [OK] does not share the payload
|
||||||
|
... [OK] empty strings stay empty
|
||||||
|
... [Suite] detachedProps
|
||||||
|
... [OK] three independent buckets, keys and values included
|
||||||
|
... [Suite] the premise this guards (world.parseFlags)
|
||||||
|
... [OK] parseFlags returns the caller's node by reference, not a copy
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/texplored (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/testutil (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] chunk format
|
Success: Execution finished
|
||||||
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/texplored (from package fff_vtt) using c backend
|
||||||
|
Nim Output /home/davide/Projects/GDR/FFF_vtt-b36/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... [Suite] chunk format
|
||||||
... [OK] the chunk bitmap layout is pinned
|
... [OK] the chunk bitmap layout is pinned
|
||||||
... [OK] one chunk covers 64x64 cells
|
... [OK] one chunk covers 64x64 cells
|
||||||
... [OK] a dirty chunk carries the whole chunk, not just the new cells
|
... [OK] a dirty chunk carries the whole chunk, not just the new cells
|
||||||
@@ -139,10 +158,10 @@
|
|||||||
... [OK] restore: two players' explored never mix
|
... [OK] restore: two players' explored never mix
|
||||||
... [OK] restore: an empty store restores nothing and a removed player takes its chunks
|
... [OK] restore: an empty store restores nothing and a removed player takes its chunks
|
||||||
... [Suite] cost
|
... [Suite] cost
|
||||||
... chunk write: avg 0.021 ms, p99 0.054 ms over 200 commits
|
... chunk write: avg 0.016 ms, p99 0.033 ms over 200 commits
|
||||||
... [OK] a mutation-scale chunk write stays inside the 4.3 commit budget
|
... [OK] a mutation-scale chunk write stays inside the 4.3 commit budget
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tgeometry (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tgeometry (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] visibility
|
Nim Output [Suite] visibility
|
||||||
... [OK] open space is a circle
|
... [OK] open space is a circle
|
||||||
... [OK] wall blocks
|
... [OK] wall blocks
|
||||||
@@ -157,6 +176,9 @@
|
|||||||
... [OK] T-junction: no leak and correct shadow
|
... [OK] T-junction: no leak and correct shadow
|
||||||
... [OK] pillar mid-room casts a shadow, sides visible
|
... [OK] pillar mid-room casts a shadow, sides visible
|
||||||
... [OK] closed door blocks, open door passes
|
... [OK] closed door blocks, open door passes
|
||||||
|
... [OK] one-way: sight_dir names the blind side (left is the (-dy, dx) normal)
|
||||||
|
... [OK] one-way: flipping the direction swaps the blind side and moves nothing
|
||||||
|
... [OK] one-way: an open door blocks neither side whatever the direction says
|
||||||
... [OK] token exactly at wall endpoint
|
... [OK] token exactly at wall endpoint
|
||||||
... [OK] token at endpoint of free-standing wall sees along it
|
... [OK] token at endpoint of free-standing wall sees along it
|
||||||
... [OK] long thin corridor
|
... [OK] long thin corridor
|
||||||
@@ -183,12 +205,12 @@
|
|||||||
... [OK] random wall fields, cell 32 and 25
|
... [OK] random wall fields, cell 32 and 25
|
||||||
... [OK] negative control: the oracle notices a missing and an invented cell
|
... [OK] negative control: the oracle notices a missing and an invented cell
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tinstancelock (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tinstancelock (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] instance lock
|
Nim Output [Suite] instance lock
|
||||||
... [OK] acquires, creates the lock file, releases and re-acquires
|
... [OK] acquires, creates the lock file, releases and re-acquires
|
||||||
... [OK] release is idempotent
|
... [OK] release is idempotent
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tlogging (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tlogging (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] redaction by value
|
Nim Output [Suite] redaction by value
|
||||||
... [OK] a secret passed as a field value never appears in the output
|
... [OK] a secret passed as a field value never appears in the output
|
||||||
... [OK] a secret inside free text, the event name or a nested value is scrubbed too
|
... [OK] a secret inside free text, the event name or a nested value is scrubbed too
|
||||||
@@ -205,7 +227,18 @@
|
|||||||
... [OK] messages below the level are dropped
|
... [OK] messages below the level are dropped
|
||||||
... [OK] no fields is still one valid line
|
... [OK] no fields is still one valid line
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tmoverules (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tmarkers (from package fff_vtt) using c backend
|
||||||
|
Nim Output /home/davide/Projects/GDR/FFF_vtt-b36/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/server/markers.nim(29, 8) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... [Suite] player markers (5.8, #59/#60)
|
||||||
|
... [OK] a marked window seen by any part of its extent mints one anchor marker
|
||||||
|
... [OK] an untouched marker survives a refresh: it is memory, not current sight
|
||||||
|
... [OK] a geometry change retracts the marker and a re-earn gets a fresh id
|
||||||
|
... [OK] a placement change retracts too; height and label never do
|
||||||
|
... [OK] a solid wall with the switch on mints nothing; clearing the switch retracts
|
||||||
|
Success: Execution finished
|
||||||
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tmoverules (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] pathClear, r = 0 (ported prototype move tests)
|
Nim Output [Suite] pathClear, r = 0 (ported prototype move tests)
|
||||||
... [OK] crossing blocked, parallel ok
|
... [OK] crossing blocked, parallel ok
|
||||||
... [OK] grazing an endpoint is blocked
|
... [OK] grazing an endpoint is blocked
|
||||||
@@ -282,7 +315,7 @@
|
|||||||
... [OK] a wall added over a GM-locked token only adds the walls entry
|
... [OK] a wall added over a GM-locked token only adds the walls entry
|
||||||
... [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs)
|
... [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs)
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tprobing (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tprobing (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] probing (T8)
|
Nim Output [Suite] probing (T8)
|
||||||
... [OK] P1: probes longer than the cap get one fixed nack regardless of the scene
|
... [OK] P1: probes longer than the cap get one fixed nack regardless of the scene
|
||||||
... [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes
|
... [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes
|
||||||
@@ -290,7 +323,7 @@
|
|||||||
... [OK] P4: probing cannot unlock or move a locked token
|
... [OK] P4: probing cannot unlock or move a locked token
|
||||||
... [OK] doors beyond the bound: opening or closing them changes no reply
|
... [OK] doors beyond the bound: opening or closing them changes no reply
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tprops (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tprops (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] caps (6.1, numbers FIXED owner-delegated by #22)
|
Nim Output [Suite] caps (6.1, numbers FIXED owner-delegated by #22)
|
||||||
... [OK] 64 keys per bucket, the 65th is refused and nothing changes
|
... [OK] 64 keys per bucket, the 65th is refused and nothing changes
|
||||||
... [OK] an existing key can still be overwritten at the cap
|
... [OK] an existing key can still be overwritten at the cap
|
||||||
@@ -311,7 +344,7 @@
|
|||||||
... [OK] clone gives fresh buckets: editing the copy cannot reach the original
|
... [OK] clone gives fresh buckets: editing the copy cannot reach the original
|
||||||
... [OK] normalize repairs nil buckets
|
... [OK] normalize repairs nil buckets
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tprotocol (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tprotocol (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] envelope (6.5 step 2)
|
Nim Output [Suite] envelope (6.5 step 2)
|
||||||
... [OK] a well-formed intent parses and keeps its reqId and node
|
... [OK] a well-formed intent parses and keeps its reqId and node
|
||||||
... [OK] reqId boundaries: 0 and 2^31-1 pass, 2^31 and -1 are malformed
|
... [OK] reqId boundaries: 0 and 2^31-1 pass, 2^31 and -1 are malformed
|
||||||
@@ -339,18 +372,20 @@
|
|||||||
... [OK] error and closing frames have no reqId
|
... [OK] error and closing frames have no reqId
|
||||||
... [OK] the close-code table of 6.5 is the app range plus 1008
|
... [OK] the close-code table of 6.5 is the app range plus 1008
|
||||||
... [Suite] wall frames (6.1 `walls`, `wall`, `wall_gone`; GM only)
|
... [Suite] wall frames (6.1 `walls`, `wall`, `wall_gone`; GM only)
|
||||||
... [OK] one wall carries id, a, b, kind, open and flags in the 6.1 shape
|
... [OK] one wall carries the typed record plus the derived kind in the proto-2 shape
|
||||||
... [OK] `walls` is the full list plus the scene, `wall` is one upsert, `wall_gone` an id
|
... [OK] `walls` is the full list plus the scene, `wall` is one upsert, `wall_gone` an id
|
||||||
... [OK] the fan-out frames carry no n: the sender stamps it per recipient
|
... [OK] the fan-out frames carry no n: the sender stamps it per recipient
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tscenegen (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tscenegen (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] scenegen (bench scenes)
|
Nim Output [Suite] scenegen (bench scenes)
|
||||||
... [OK] exactly n walls, deterministic per seed, seeds differ
|
... [OK] exactly n walls, deterministic per seed, seeds differ
|
||||||
... [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter)
|
... [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter)
|
||||||
... [OK] walls are non-degenerate and axis-ish segments of room-edge length
|
... [OK] walls are non-degenerate and axis-ish segments of room-edge length
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/ttiles (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/ttiles (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] tile URL grammar
|
Nim Output /home/davide/Projects/GDR/FFF_vtt-b36/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... [Suite] tile URL grammar
|
||||||
... [OK] canonical numbers: digits only, bounded, no leading zero
|
... [OK] canonical numbers: digits only, bounded, no leading zero
|
||||||
... [OK] a canonical URL parses to its three integers
|
... [OK] a canonical URL parses to its three integers
|
||||||
... [OK] leading zero tile coordinates are malformed
|
... [OK] leading zero tile coordinates are malformed
|
||||||
@@ -366,7 +401,7 @@
|
|||||||
... [Suite] one scene record per request (#31)
|
... [Suite] one scene record per request (#31)
|
||||||
... [OK] a request built from one record stays internally consistent when the scene is swapped
|
... [OK] a request built from one record stays internally consistent when the scene is swapped
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/ttokens (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/ttokens (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] ids (DESIGN 8, FIXED #3: random, opaque, 12 chars)
|
Nim Output [Suite] ids (DESIGN 8, FIXED #3: random, opaque, 12 chars)
|
||||||
... [OK] 12 characters from the documented alphabet
|
... [OK] 12 characters from the documented alphabet
|
||||||
... [OK] freshId never returns an id that is taken
|
... [OK] freshId never returns an id that is taken
|
||||||
@@ -399,8 +434,10 @@
|
|||||||
... [OK] removing a token removes its status rows (FK cascade)
|
... [OK] removing a token removes its status rows (FK cascade)
|
||||||
... [OK] status helpers keep the entry set unique and ordered
|
... [OK] status helpers keep the entry set unique and ordered
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tviews (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tviews (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] GM view (3.1: everything, with the GM-only extras)
|
Nim Output /home/davide/Projects/GDR/FFF_vtt-b36/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... [Suite] GM view (3.1: everything, with the GM-only extras)
|
||||||
... [OK] every token, in token order, with controller and both names
|
... [OK] every token, in token order, with controller and both names
|
||||||
... [OK] a GM-controlled token shows controller null
|
... [OK] a GM-controlled token shows controller null
|
||||||
... [OK] the GM never gets vision polygons or explored cells
|
... [OK] the GM never gets vision polygons or explored cells
|
||||||
@@ -442,13 +479,16 @@
|
|||||||
... [OK] a player never receives another player's list
|
... [OK] a player never receives another player's list
|
||||||
... [Suite] egress borrows the world instead of copying it (#28)
|
... [Suite] egress borrows the world instead of copying it (#28)
|
||||||
... [OK] a Context is six addresses: in-place changes are visible through the borrow
|
... [OK] a Context is six addresses: in-place changes are visible through the borrow
|
||||||
... #28 context build, 262144 cells x 6 players: 0.008 us
|
... #28 context build, 262144 cells x 6 players: 0.007 us
|
||||||
... #28 egress, 262144 cells x 6 players x 40 entries: GM 0.788 ms, player 0.322 ms
|
... #28 egress, 262144 cells x 6 players x 40 entries: GM 0.824 ms, player 0.332 ms
|
||||||
... #28 egress, 16384 cells x 6 players x 40 entries: GM 0.806 ms
|
... #28 egress, 16384 cells x 6 players x 40 entries: GM 0.862 ms
|
||||||
... [OK] building a Context and egressing does not scale with the explored sets
|
... [OK] building a Context and egressing does not scale with the explored sets
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tvision (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tvision (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] polygons (5.1: one per controlled token with the `vision` flag)
|
Nim Output /home/davide/Projects/GDR/FFF_vtt-b36/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport]
|
||||||
|
... /home/davide/Projects/GDR/FFF_vtt-b36/tests/tvision.nim(4, 13) Warning: imported and not used: 'algorithm' [UnusedImport]
|
||||||
|
... [Suite] polygons (5.1: one per controlled token with the `vision` flag)
|
||||||
... [OK] only the player's own vision tokens produce one, in token order
|
... [OK] only the player's own vision tokens produce one, in token order
|
||||||
... [OK] a player with no vision token has no polygons at all
|
... [OK] a player with no vision token has no polygons at all
|
||||||
... [OK] the polygon is bounded by the token's range, and a closer wall cuts it
|
... [OK] the polygon is bounded by the token's range, and a closer wall cuts it
|
||||||
@@ -468,13 +508,14 @@
|
|||||||
... [OK] a gm_only token inside the LOS is not visible to anyone else
|
... [OK] a gm_only token inside the LOS is not visible to anyone else
|
||||||
... [OK] a player with no vision token sees only what they control
|
... [OK] a player with no vision token sees only what they control
|
||||||
Success: Execution finished
|
Success: Execution finished
|
||||||
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tworld (from package fff_vtt) using c backend
|
Compiling /home/davide/Projects/GDR/FFF_vtt-b36/tests/tworld (from package fff_vtt) using c backend
|
||||||
Nim Output [Suite] scene (migration step 3, Q3: exactly one scene)
|
Nim Output [Suite] scene (migration step 3, Q3: exactly one scene)
|
||||||
... [OK] the migration seeds scene 1 with the v1 defaults, no walls, next_wall_id 1
|
... [OK] the migration seeds scene 1 with the v1 defaults, no walls, next_wall_id 1
|
||||||
... [OK] an unknown scene id is not there (the wire answers not-found)
|
... [OK] an unknown scene id is not there (the wire answers not-found)
|
||||||
... [Suite] field parsing (6.1 field notes)
|
... [Suite] field parsing (6.1 field notes)
|
||||||
... [OK] a point is exactly two finite numbers, ints included
|
... [OK] a point is exactly two finite numbers, ints included
|
||||||
... [OK] kind, open and flags accept only their own shape
|
... [OK] position, sight_dir and flags accept only their own shape
|
||||||
|
... [OK] kind is derived from the switches, never stored (5.8)
|
||||||
... [OK] undefined and null are the same as an absent field
|
... [OK] undefined and null are the same as an absent field
|
||||||
... [Suite] wall ids (FIXED #3: per scene, monotonic, never reused)
|
... [Suite] wall ids (FIXED #3: per scene, monotonic, never reused)
|
||||||
... [OK] adds count from 1 and the counter advances
|
... [OK] adds count from 1 and the counter advances
|
||||||
@@ -482,14 +523,20 @@
|
|||||||
... [OK] the id counter survives a reload, even when the newest wall was removed
|
... [OK] the id counter survives a reload, even when the newest wall was removed
|
||||||
... [Suite] persistence (write-through, restart-identical)
|
... [Suite] persistence (write-through, restart-identical)
|
||||||
... [OK] add, update, door set and remove round-trip through a reload
|
... [OK] add, update, door set and remove round-trip through a reload
|
||||||
|
... [OK] door.set refuses to open a secret or locked door, closing either is allowed (#56)
|
||||||
|
... [OK] nullable height and label use SQL literals and round-trip as none, not 0 or ''
|
||||||
... [OK] authoring runs with synchronous=FULL and leaves NORMAL behind (Q12)
|
... [OK] authoring runs with synchronous=FULL and leaves NORMAL behind (Q12)
|
||||||
... [OK] a failing write leaves memory and the pragma alone
|
... [OK] a failing write leaves memory and the pragma alone
|
||||||
... [OK] walls load in id order whatever the insertion order was
|
... [OK] walls load in id order whatever the insertion order was
|
||||||
... [Suite] validation (DESIGN 6.1 `wall.*`)
|
... [Suite] validation (DESIGN 6.1 `wall.*`)
|
||||||
... [OK] a zero-length wall is invalid and writes nothing
|
... [OK] a zero-length wall is invalid and writes nothing
|
||||||
... [OK] both endpoints must be inside [0,w] x [0,h]; the border itself is allowed
|
... [OK] both endpoints must be inside [0,w] x [0,h]; the border itself is allowed
|
||||||
|
... [OK] presets expand to switches only through the one resolve path (#55)
|
||||||
|
... [OK] the switch-set invariants reject door-only settings on a non-door (#55)
|
||||||
|
... [OK] storable is the last gate: a secret or locked non-door is refused
|
||||||
|
... [OK] a label is 1..64 code points, trimmed and free of control characters (#55)
|
||||||
... [OK] a wall is never open: the stored row normalizes it
|
... [OK] a wall is never open: the stored row normalizes it
|
||||||
... [OK] update keeps the row's id and open flag unless the kind changes
|
... [OK] update keeps the row's id and open flag unless the door switch is cleared
|
||||||
... [OK] dot patching: only the given fields change
|
... [OK] dot patching: only the given fields change
|
||||||
... [Suite] lookup outcomes (main.nim's 6.5 mapping)
|
... [Suite] lookup outcomes (main.nim's 6.5 mapping)
|
||||||
... [OK] unknown ids are not-found, wrong kinds are their own outcome
|
... [OK] unknown ids are not-found, wrong kinds are their own outcome
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
// #36: the evidence half of the M3 group map. `GROUPS` (tools/groups.mjs) names, per acceptance
|
||||||
|
// group, the exact test that proves it plus the assertions/calls its body must keep. This module
|
||||||
|
// turns that claim into something checkable in two places:
|
||||||
|
//
|
||||||
|
// * `findTestBody` (static, used by tools/groups.test.mjs): the declaration exists exactly once,
|
||||||
|
// its body still holds at least `minAsserts` assertions and every required snippet;
|
||||||
|
// * this file's CLI (run by tools/test.sh AFTER the Node suite): the reporter output shows every
|
||||||
|
// registered test actually ran and passed, and none of them was skipped. A title substring in a
|
||||||
|
// comment, an emptied test body, or a registration that never runs cannot satisfy it.
|
||||||
|
import fs from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
import { GROUPS } from './groups.mjs'
|
||||||
|
|
||||||
|
const escapeRe = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||||
|
|
||||||
|
// A test title as written in the source, with `${...}` standing for the case it is built for.
|
||||||
|
export function titleToRegExp(title) {
|
||||||
|
const parts = String(title).split(/\$\{[^}]*\}/g).map(escapeRe)
|
||||||
|
return new RegExp(`^${parts.join('.*?')}$`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The source text of one test declaration: located by its exact title literal, bounded by the
|
||||||
|
// matching close of the `test(` call at the declaration's own indentation.
|
||||||
|
export function findTestBody(fileText, title) {
|
||||||
|
const needles = ['`', "'", '"'].map(q => `test(${q}${title}${q}`)
|
||||||
|
const hits = needles.map(n => fileText.indexOf(n)).filter(i => i >= 0)
|
||||||
|
if (hits.length !== 1) return null // absent, or declared under more than one quoting/title
|
||||||
|
const start = fileText.lastIndexOf('\n', hits[0]) + 1
|
||||||
|
const indent = fileText.slice(start, hits[0])
|
||||||
|
if (/\S/.test(indent)) return null
|
||||||
|
const closer = new RegExp(`^${escapeRe(indent)}\\}\\)\\s*$`, 'm')
|
||||||
|
const rest = fileText.slice(start)
|
||||||
|
const m = closer.exec(rest)
|
||||||
|
if (!m) return null
|
||||||
|
return { start, end: start + m.index, body: rest.slice(0, m.index) }
|
||||||
|
}
|
||||||
|
|
||||||
|
const GLYPH = /^\s*(✔|✖|﹣)\s+(.+?)\s+\((?:<1|\d+(?:\.\d+)?)ms\)(?:\s+#\s+(SKIP|TODO))?\s*$/
|
||||||
|
|
||||||
|
// The spec reporter's per-test lines, as `devbox run test` records them in results/node-test.log.
|
||||||
|
export function parseReporter(text) {
|
||||||
|
const out = []
|
||||||
|
for (const line of text.split('\n')) {
|
||||||
|
const m = GLYPH.exec(line)
|
||||||
|
if (!m) continue
|
||||||
|
const [, glyph, name, skipped] = m
|
||||||
|
const status = glyph === '✖' ? 'fail' : (skipped || glyph === '﹣') ? 'skipped' : 'pass'
|
||||||
|
out.push({ name, status })
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkLog(logText, groups = GROUPS) {
|
||||||
|
const ran = parseReporter(logText)
|
||||||
|
const errors = []
|
||||||
|
let checked = 0
|
||||||
|
for (const [group, spec] of Object.entries(groups)) {
|
||||||
|
for (const ev of spec.evidence) {
|
||||||
|
checked += 1
|
||||||
|
const rx = titleToRegExp(ev.test)
|
||||||
|
const hits = ran.filter(t => rx.test(t.name))
|
||||||
|
const passed = hits.filter(t => t.status === 'pass').length
|
||||||
|
const failed = hits.filter(t => t.status === 'fail').length
|
||||||
|
const skipped = hits.filter(t => t.status === 'skipped').length
|
||||||
|
const want = ev.minTests ?? 1
|
||||||
|
const where = `${group}: ${ev.file} "${ev.test}"`
|
||||||
|
if (passed < want) {
|
||||||
|
errors.push(`${where}: ${passed} passing run(s), expected at least ${want}` +
|
||||||
|
(hits.length ? ` (saw ${JSON.stringify(hits.slice(0, 4))})` : ' (never ran)'))
|
||||||
|
}
|
||||||
|
if (failed > 0) errors.push(`${where}: ${failed} failing run(s)`)
|
||||||
|
if (skipped > 0) errors.push(`${where}: ${skipped} skipped run(s)`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { checked, errors }
|
||||||
|
}
|
||||||
|
|
||||||
|
function main(argv) {
|
||||||
|
const root = path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
const logPath = argv[2] ?? path.join(root, '..', 'results', 'node-test.log')
|
||||||
|
let text
|
||||||
|
try {
|
||||||
|
text = fs.readFileSync(logPath, 'utf8')
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`evidence: cannot read ${logPath}: ${e.message}`)
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
const { checked, errors } = checkLog(text)
|
||||||
|
if (errors.length) {
|
||||||
|
console.error(`evidence: ${errors.length} group evidence problem(s) in ${logPath}:`)
|
||||||
|
for (const e of errors) console.error(` - ${e}`)
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
console.log(`evidence: ${checked} registered group evidence test(s) ran and passed (${logPath})`)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||||
|
process.exitCode = main(process.argv)
|
||||||
|
}
|
||||||
+75
-19
@@ -1,8 +1,14 @@
|
|||||||
// The nine M3 acceptance groups of DESIGN 13 (FIXED by owner decision #12) and the test that proves
|
// The nine M3 acceptance groups of DESIGN 13 (FIXED by owner decision #12) and the test that proves
|
||||||
// each one. `devbox run test` runs every `tools/*.test.mjs`; this map is the checklist the finish
|
// each one. `devbox run test` runs every `tools/*.test.mjs`; this map is the checklist the finish
|
||||||
// line (#25) records in DESIGN 14, and tools/groups.test.mjs fails if a group's file or its named
|
// line (#25) records in DESIGN 14.
|
||||||
// evidence test disappears. Slice-level test files that are not an accept group (smoke, walls,
|
//
|
||||||
// tokens, details, scene, wsheaders) still run; they are not listed here.
|
// #36: an evidence entry is not a title substring. It names the test's exact title (a `${...}`
|
||||||
|
// placeholder marks a title the file builds per case), the minimum number of `assert.*` calls its
|
||||||
|
// body must keep, and any distinctive call the body must keep executing. `tools/groups.test.mjs`
|
||||||
|
// checks those against the source statically; the final step of `tools/test.sh` parses the Node
|
||||||
|
// test runner's reporter output and fails unless every registered title actually ran and passed
|
||||||
|
// (tools/evidence.mjs). A test hollowed out to its title, or one that is registered but never runs,
|
||||||
|
// therefore fails the gate.
|
||||||
export const GROUPS = {
|
export const GROUPS = {
|
||||||
'leak+fault': {
|
'leak+fault': {
|
||||||
// The transcript checker and its negative controls, plus the two Walls r1 harnesses whose
|
// The transcript checker and its negative controls, plus the two Walls r1 harnesses whose
|
||||||
@@ -10,50 +16,100 @@ export const GROUPS = {
|
|||||||
// #56) and the player marker group (#59/#60). #61's scenario rewrite keeps all of them green.
|
// #56) and the player marker group (#59/#60). #61's scenario rewrite keeps all of them green.
|
||||||
files: ['leak.test.mjs', 'fault.test.mjs', 'doors.test.mjs', 'markers.test.mjs'],
|
files: ['leak.test.mjs', 'fault.test.mjs', 'doors.test.mjs', 'markers.test.mjs'],
|
||||||
evidence: [
|
evidence: [
|
||||||
['leak.test.mjs', 'leak test ${subject}: the subject\'s whole view matches the GM\'s truth'],
|
{ file: 'leak.test.mjs',
|
||||||
['fault.test.mjs', 'caught as exactly'],
|
test: "leak test ${subject}: the subject's whole view matches the GM's truth",
|
||||||
['doors.test.mjs', 'fault secretgap: the equivalence group fails as exactly SECRETGAP'],
|
minTests: 2, minAsserts: 8, requires: ['runChecker(transcript, subject)'] },
|
||||||
['markers.test.mjs', 'retraction: every cause sends del only, a re-earned marker gets a fresh id (#60)'],
|
{ file: 'fault.test.mjs',
|
||||||
|
test: "fault ${fault}: caught as exactly ${expected.join(' ')}",
|
||||||
|
minAsserts: 2, requires: ['classesOf(check.output)'] },
|
||||||
|
{ file: 'doors.test.mjs',
|
||||||
|
test: 'fault secretgap: the equivalence group fails as exactly SECRETGAP',
|
||||||
|
minAsserts: 1, requires: ["equivalenceClasses(a, b), ['SECRETGAP']"] },
|
||||||
|
{ file: 'markers.test.mjs',
|
||||||
|
test: 'retraction: every cause sends del only, a re-earned marker gets a fresh id (#60)',
|
||||||
|
minAsserts: 12, requires: ['assertMarkerShape(seen)'] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
tiles: {
|
tiles: {
|
||||||
files: ['tiles.test.mjs', 'oneway.test.mjs'],
|
files: ['tiles.test.mjs', 'oneway.test.mjs'],
|
||||||
evidence: [['tiles.test.mjs', 'tile gate: leak check (d) matches the independent explored oracle'],
|
evidence: [
|
||||||
['oneway.test.mjs', 'one-way sight: the blind side sees nothing across, the seeing side does (#58)']],
|
{ file: 'tiles.test.mjs',
|
||||||
|
test: 'tile gate: leak check (d) matches the independent explored oracle',
|
||||||
|
minAsserts: 6, requires: ['oracle'] },
|
||||||
|
{ file: 'oneway.test.mjs',
|
||||||
|
test: 'one-way sight: the blind side sees nothing across, the seeing side does (#58)',
|
||||||
|
minAsserts: 12, requires: ['withOneWayStack'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
probing: {
|
probing: {
|
||||||
files: ['probing.test.mjs'],
|
files: ['probing.test.mjs'],
|
||||||
evidence: [['probing.test.mjs', 'probing over WS: walls beyond cap + radius change no reply']],
|
evidence: [
|
||||||
|
{ file: 'probing.test.mjs',
|
||||||
|
test: 'probing over WS: walls beyond cap + radius change no reply',
|
||||||
|
minAsserts: 3, requires: ['assert.deepEqual(shape(ra), shape(rb)'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
protocol: {
|
protocol: {
|
||||||
files: ['protocol.test.mjs'],
|
files: ['protocol.test.mjs'],
|
||||||
evidence: [['protocol.test.mjs', 'an unknown type is refused, unknown fields are ignored']],
|
evidence: [
|
||||||
|
{ file: 'protocol.test.mjs',
|
||||||
|
test: 'an unknown type is refused, unknown fields are ignored, and every intent gets one ack',
|
||||||
|
minAsserts: 6, requires: ['assert.equal'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
files: ['auth.test.mjs'],
|
files: ['auth.test.mjs'],
|
||||||
evidence: [['auth.test.mjs', 'key.replace: old key and old sessions die']],
|
evidence: [
|
||||||
|
{ file: 'auth.test.mjs',
|
||||||
|
test: 'key.replace: old key and old sessions die, live connections close, the new key works',
|
||||||
|
minAsserts: 6, requires: ['assert.notEqual'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
'characters and names': {
|
'characters and names': {
|
||||||
files: ['characters.test.mjs'],
|
files: ['characters.test.mjs'],
|
||||||
evidence: [['characters.test.mjs', 'encountered: a sighting is kept under the name the player knows']],
|
evidence: [
|
||||||
|
{ file: 'characters.test.mjs',
|
||||||
|
test: 'encountered: a sighting is kept under the name the player knows, and survives everything',
|
||||||
|
minAsserts: 8, requires: ['encountered'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
restart: {
|
restart: {
|
||||||
files: ['restart.test.mjs'],
|
files: ['restart.test.mjs'],
|
||||||
evidence: [['restart.test.mjs', 'restart: full state, all CRUD, before and after SIGTERM'],
|
evidence: [
|
||||||
['restart.test.mjs', 'restart: full state, all CRUD, before and after SIGKILL']],
|
// #36: both variants take the baseline from the first (as-built) server, before the signal;
|
||||||
|
// the thin wrappers must keep calling the only code path that can prove it.
|
||||||
|
{ file: 'restart.test.mjs',
|
||||||
|
test: 'restart: full state, all CRUD, before and after SIGTERM',
|
||||||
|
minAsserts: 0, requires: ['restartGroup(false)'] },
|
||||||
|
{ file: 'restart.test.mjs',
|
||||||
|
test: 'restart: full state, all CRUD, before and after SIGKILL',
|
||||||
|
minAsserts: 0, requires: ['restartGroup(true)'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
persistence: {
|
persistence: {
|
||||||
// The schema-7 fixture driven through the real binary (migration mapping, explored round trip)
|
// The schema-7 fixture driven through the real binary (migration mapping, explored round trip)
|
||||||
// plus the behaviour-preservation pair: migrated walls vs the same walls authored through
|
// plus the behaviour-preservation pair: migrated walls vs the same walls authored through
|
||||||
// `wall.add`, byte-identical to a player (stories 29/30/77, #52).
|
// `wall.add`, byte-identical to a player (stories 29/30/77, #52).
|
||||||
files: ['persistence.test.mjs', 'wallbehaviour.test.mjs'],
|
files: ['persistence.test.mjs', 'wallbehaviour.test.mjs'],
|
||||||
evidence: [['persistence.test.mjs', 'explored round trip: a fresh connection gets the whole grid'],
|
evidence: [
|
||||||
['persistence.test.mjs', 'migration: a schema-4 DB (fixture) migrates under the real binary'],
|
{ file: 'persistence.test.mjs',
|
||||||
['wallbehaviour.test.mjs', 'behaviour preservation: a migrated schema-7 scene and the same scene authored via raw switches are byte-identical to a player']],
|
test: 'explored round trip: a fresh connection gets the whole grid the server accumulated',
|
||||||
|
minAsserts: 3, requires: ['exploredSnapshot(s.origin, alice)'] },
|
||||||
|
{ file: 'persistence.test.mjs',
|
||||||
|
test: 'migration: a schema-4 DB (fixture) migrates under the real binary to the latest schema',
|
||||||
|
minAsserts: 6, requires: ['assert.equal'] },
|
||||||
|
{ file: 'wallbehaviour.test.mjs',
|
||||||
|
test: 'behaviour preservation: a migrated schema-7 scene and the same scene authored via raw switches are byte-identical to a player',
|
||||||
|
minAsserts: 2, requires: ['assert.deepEqual'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
logs: {
|
logs: {
|
||||||
files: ['logs.test.mjs'],
|
files: ['logs.test.mjs'],
|
||||||
evidence: [['logs.test.mjs', 'logs: no key, session cookie or session hash reaches the log']],
|
evidence: [
|
||||||
|
{ file: 'logs.test.mjs',
|
||||||
|
test: 'logs: no key, session cookie or session hash reaches the log',
|
||||||
|
minAsserts: 8, requires: ['assert.equal'] },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+22
-6
@@ -1,12 +1,14 @@
|
|||||||
// The M3 acceptance checklist as a test: the nine groups of DESIGN 13 exist, each points at a real
|
// The M3 acceptance checklist as a test: the nine groups of DESIGN 13 exist, each points at a real
|
||||||
// harness in tools/, and each carries the named test that proves it (DESIGN 14, #12 / #25). This
|
// harness in tools/, and each carries the exact test that proves it (DESIGN 14, #12 / #25). #36:
|
||||||
// fails if someone renames a group test or deletes a group file, so `devbox run test` cannot go
|
// "proves it" is not a substring — the declaration and its body must still hold the assertions and
|
||||||
// green with a group silently unproven.
|
// the call the group claims, and `tools/test.sh` separately requires the reporter to show every one
|
||||||
|
// of these tests passing (tools/evidence.mjs), so a hollowed or unrun test cannot count.
|
||||||
import test from 'node:test'
|
import test from 'node:test'
|
||||||
import assert from 'node:assert/strict'
|
import assert from 'node:assert/strict'
|
||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { GROUP_COUNT, GROUPS } from './groups.mjs'
|
import { GROUP_COUNT, GROUPS } from './groups.mjs'
|
||||||
|
import { findTestBody } from './evidence.mjs'
|
||||||
import { projectRoot } from './lib.mjs'
|
import { projectRoot } from './lib.mjs'
|
||||||
|
|
||||||
const tools = path.join(projectRoot, 'tools')
|
const tools = path.join(projectRoot, 'tools')
|
||||||
@@ -24,9 +26,23 @@ test('M3 accept: the nine groups of DESIGN 13 are mapped to named harness tests'
|
|||||||
assert.ok(fs.statSync(full).size > 0, `${group}: ${file} is not empty`)
|
assert.ok(fs.statSync(full).size > 0, `${group}: ${file} is not empty`)
|
||||||
}
|
}
|
||||||
assert.ok(spec.evidence.length >= 1, `${group}: names its proving test`)
|
assert.ok(spec.evidence.length >= 1, `${group}: names its proving test`)
|
||||||
for (const [file, needle] of spec.evidence) {
|
for (const ev of spec.evidence) {
|
||||||
const text = fs.readFileSync(path.join(tools, file), 'utf8')
|
assert.ok(spec.files.includes(ev.file), `${group}: evidence file ${ev.file} is one of the group files`)
|
||||||
assert.ok(text.includes(needle), `${group}: ${file} contains the test "${needle}"`)
|
assert.equal(typeof ev.test, 'string', `${group}: evidence names an exact test title`)
|
||||||
|
assert.ok(!ev.test.includes('*'), `${group}: the evidence title is exact, not a glob`)
|
||||||
|
const text = fs.readFileSync(path.join(tools, ev.file), 'utf8')
|
||||||
|
const found = findTestBody(text, ev.test)
|
||||||
|
assert.ok(found,
|
||||||
|
`${group}: ${ev.file} declares exactly one test with the title "${ev.test}" ` +
|
||||||
|
'(a renamed, duplicated or absent evidence test fails the group)')
|
||||||
|
const asserts = (found.body.match(/\bassert\.[A-Za-z]+/g) ?? []).length
|
||||||
|
const min = ev.minAsserts ?? 1
|
||||||
|
assert.ok(asserts >= min,
|
||||||
|
`${group}: "${ev.test}" keeps its assertions (${asserts} found, at least ${min} required)`)
|
||||||
|
for (const needle of ev.requires ?? []) {
|
||||||
|
assert.ok(found.body.includes(needle),
|
||||||
|
`${group}: "${ev.test}" still executes \`${needle}\``)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Every *group* harness is run by `tools/test.sh` (one glob over tools/*.test.mjs).
|
// Every *group* harness is run by `tools/test.sh` (one glob over tools/*.test.mjs).
|
||||||
|
|||||||
+35
-20
@@ -201,15 +201,24 @@ function expectedEncounteredName(who, ids) {
|
|||||||
[ids.linked]: 'a cloaked figure', [ids.pc]: 'Wanderer' }
|
[ids.linked]: 'a cloaked figure', [ids.pc]: 'Wanderer' }
|
||||||
}
|
}
|
||||||
|
|
||||||
// The full before/after comparison: one fresh GM connection and one fresh connection per player.
|
// The full before/after comparison: one fresh connection per player and one fresh GM connection.
|
||||||
async function compareAcross(origin, gmKey, players, ids, expected) {
|
// #36: players connect first, so their live sight state is computed before the GM's per-player
|
||||||
const beforeGm = await snapshot(origin, gmKey, expected, true)
|
// `encountered` lists (whose `grey` is a live sight test, not stored state) are read. Connecting
|
||||||
const before = { gm: beforeGm }
|
// them only after the GM would compare a refreshed restarted server against an unrefreshed one.
|
||||||
|
async function snapshotAll(origin, gmKey, players, expected) {
|
||||||
|
const all = {}
|
||||||
for (const [who, p] of Object.entries(players)) {
|
for (const [who, p] of Object.entries(players)) {
|
||||||
// Only the character's owner is sent a `character` record (6.1).
|
// Only the character's owner is sent a `character` record (6.1).
|
||||||
before[who] = await snapshot(origin, p.key,
|
all[who] = await snapshot(origin, p.key,
|
||||||
{ ...expected, characters: who === 'alice' ? 1 : 0 }, false)
|
{ ...expected, characters: who === 'alice' ? 1 : 0 }, false)
|
||||||
}
|
}
|
||||||
|
all.gm = await snapshot(origin, gmKey, expected, true)
|
||||||
|
return all
|
||||||
|
}
|
||||||
|
|
||||||
|
async function compareAcross(origin, gmKey, players, ids, expected) {
|
||||||
|
const before = await snapshotAll(origin, gmKey, players, expected)
|
||||||
|
const beforeGm = before.gm
|
||||||
// The CRUD inventory is not empty: a restart test over an empty world would prove nothing.
|
// The CRUD inventory is not empty: a restart test over an empty world would prove nothing.
|
||||||
assert.ok(beforeGm.walls.walls.length >= 2, 'the wall and the door are there')
|
assert.ok(beforeGm.walls.walls.length >= 2, 'the wall and the door are there')
|
||||||
assert.equal(beforeGm.walls.walls.find(w => w.id === ids.door).open, true, 'the door is open')
|
assert.equal(beforeGm.walls.walls.find(w => w.id === ids.door).open, true, 'the door is open')
|
||||||
@@ -242,11 +251,10 @@ async function compareAcross(origin, gmKey, players, ids, expected) {
|
|||||||
return before
|
return before
|
||||||
}
|
}
|
||||||
|
|
||||||
async function restartAndCompare(stateDir, gmKey, players, ids, expected, hard) {
|
// Kill the server that holds the as-built world. SIGKILL is deliberate for the hard variant: every
|
||||||
let s = await startServer({ stateDir })
|
// ack is sent after COMMIT (4.2), so a hard kill cannot lose an acked mutation.
|
||||||
const before = await compareAcross(s.origin, gmKey, players, ids, expected)
|
async function stopWithSignal(s, hard) {
|
||||||
if (hard) {
|
if (hard) {
|
||||||
// Every ack is sent after COMMIT (4.2), so a hard kill cannot lose an acked mutation.
|
|
||||||
s.child.kill('SIGKILL')
|
s.child.kill('SIGKILL')
|
||||||
const deadline = Date.now() + 5000
|
const deadline = Date.now() + 5000
|
||||||
while (s.child.signalCode === null && s.child.exitCode === null && Date.now() < deadline) {
|
while (s.child.signalCode === null && s.child.exitCode === null && Date.now() < deadline) {
|
||||||
@@ -254,19 +262,22 @@ async function restartAndCompare(stateDir, gmKey, players, ids, expected, hard)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await stopServer(s)
|
await stopServer(s)
|
||||||
|
}
|
||||||
|
|
||||||
s = await startServer({ stateDir })
|
// #36: `before` is the snapshot of the *as-built* world on the first server instance, taken after
|
||||||
|
// the CRUD and before any restart. The old version took it after a restart, so a field silently
|
||||||
|
// dropped on the first load was missing from both sides and the deepEqual held.
|
||||||
|
async function restartAndCompare(stateDir, before, gmKey, players, ids, expected) {
|
||||||
|
let s = await startServer({ stateDir })
|
||||||
try {
|
try {
|
||||||
const afterGm = await snapshot(s.origin, gmKey, expected, true)
|
const after = await snapshotAll(s.origin, gmKey, players, expected)
|
||||||
assert.deepEqual(afterGm, before.gm, 'the GM resync after the restart is identical')
|
assert.deepEqual(after.gm, before.gm, 'the GM resync after the restart is identical')
|
||||||
for (const [who, p] of Object.entries(players)) {
|
for (const who of Object.keys(players)) {
|
||||||
const after = await snapshot(s.origin, p.key,
|
assert.deepEqual(after[who], before[who],
|
||||||
{ ...expected, characters: who === 'alice' ? 1 : 0 }, false)
|
|
||||||
assert.deepEqual(after, before[who],
|
|
||||||
`${who}'s resync after the restart is identical`)
|
`${who}'s resync after the restart is identical`)
|
||||||
// ... and the absolute truth, so two equally wrong snapshots cannot pass (#27).
|
// ... and the absolute truth, so two equally wrong snapshots cannot pass (#27).
|
||||||
for (const [id, name] of Object.entries(expectedEncounteredName(who, ids))) {
|
for (const [id, name] of Object.entries(expectedEncounteredName(who, ids))) {
|
||||||
assert.equal(after.encountered.set.find(e => e.id === id)?.name, name,
|
assert.equal(after[who].encountered.set.find(e => e.id === id)?.name, name,
|
||||||
`${who}'s encountered entry for ${id} after the restart`)
|
`${who}'s encountered entry for ${id} after the restart`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,6 +316,7 @@ async function restartGroup(hard) {
|
|||||||
let s = await startServer({ stateDir })
|
let s = await startServer({ stateDir })
|
||||||
let saved
|
let saved
|
||||||
let markerRows
|
let markerRows
|
||||||
|
let before
|
||||||
try {
|
try {
|
||||||
saved = await buildWorld(s.origin, gmKey)
|
saved = await buildWorld(s.origin, gmKey)
|
||||||
players.alice = saved.alice
|
players.alice = saved.alice
|
||||||
@@ -331,11 +343,14 @@ async function restartGroup(hard) {
|
|||||||
assert.equal(linkedRows[String(saved.bob.id)], '')
|
assert.equal(linkedRows[String(saved.bob.id)], '')
|
||||||
assert.equal(linkedRows[String(saved.carol.id)], '',
|
assert.equal(linkedRows[String(saved.carol.id)], '',
|
||||||
'the reveal to Alice did not write Bob\'s or Carol\'s row (#27)')
|
'the reveal to Alice did not write Bob\'s or Carol\'s row (#27)')
|
||||||
|
// #36: the baseline is this live server's full resync, built by the CRUD above and never
|
||||||
|
// reloaded from disk. A field lost when the first server reloads the DB fails the comparison.
|
||||||
|
before = await compareAcross(s.origin, gmKey, players, saved.ids, EXPECTED)
|
||||||
} finally {
|
} finally {
|
||||||
await stopServer(s)
|
await stopWithSignal(s, hard)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await restartAndCompare(stateDir, gmKey, players, saved.ids, EXPECTED, hard)
|
await restartAndCompare(stateDir, before, gmKey, players, saved.ids, EXPECTED)
|
||||||
assert.deepEqual(dbMarkerRows(stateDir, saved.ids.window), markerRows,
|
assert.deepEqual(dbMarkerRows(stateDir, saved.ids.window), markerRows,
|
||||||
'the marker_seen rows (player and opaque id) survive the restart unchanged')
|
'the marker_seen rows (player and opaque id) survive the restart unchanged')
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
+5
-2
@@ -11,7 +11,10 @@ fi
|
|||||||
cat results/nimble-test.log
|
cat results/nimble-test.log
|
||||||
# One file at a time: every harness builds and runs the same real binary (run/test/server) and
|
# One file at a time: every harness builds and runs the same real binary (run/test/server) and
|
||||||
# starts real servers; serialising removes build/write races. Ports and state dirs are isolated.
|
# starts real servers; serialising removes build/write races. Ports and state dirs are isolated.
|
||||||
node --test --test-concurrency=1 tools/*.test.mjs > results/node-test.log 2>&1
|
node --test --test-concurrency=1 --test-reporter=spec tools/*.test.mjs > results/node-test.log 2>&1
|
||||||
rc=$?
|
rc=$?
|
||||||
cat results/node-test.log
|
cat results/node-test.log
|
||||||
exit $rc
|
[ $rc -eq 0 ] || exit $rc
|
||||||
|
# #36: the group map's evidence is only proof if the named tests actually ran and passed. This is a
|
||||||
|
# separate post-run step because groups.test.mjs runs inside the suite it would have to inspect.
|
||||||
|
node tools/evidence.mjs results/node-test.log || exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user