tools: the persistence group and six explored mutations (#21)
tools/persistence.test.mjs proves the store end to end over the real binary: a fresh resync round trip, strict per-player separation, SIGTERM and SIGKILL restart equality, a wall removal's revealed cells surviving after the wall returns, chunk rows decoded independently (512 B, blobs), move-ack timing (avg 0.8 ms, p99 2 ms) and a schema-4 fixture DB migrated by the binary. Mutations ag-al pin the bit layout, the chunk coordinate, the restore, the per-player key, the upsert and the dirty-chunk dedupe. smoke.test.mjs moves to version 5.
This commit is contained in:
+10
-1
@@ -15,6 +15,8 @@
|
||||
# aa: the egress sends every token (LOS and gm_only ignored) | ab: gm_only ignored in the view rule
|
||||
# ac: a controlled token is not always visible | ad: no token_gone when a token leaves view
|
||||
# ae: a player token frame carries the GM-only `kind` | af: explored forgets the cells outside the current polygon
|
||||
# ag: the chunk row stride is dropped | ah: a cell coordinate used as a chunk coordinate | ai: restore forgets rows
|
||||
# aj: chunks keyed by scene, not player | ak: a chunk rewrite ignored (INSERT OR IGNORE) | al: dirty chunks keyed by row only
|
||||
# Parallel: MUTATION_JOBS (default nproc/4) jobs, each in its own temp copy + nimcache; output collected, printed in fixed order.
|
||||
# Tests run with FFF_MUTATION=1 (iteration counts ~/10, see tests/testutil.nim scaled()); only test files holding an expected
|
||||
# test are run per mutation (control runs all). Debug build. Wrapped in systemd-inhibit (sleep:idle) when that works.
|
||||
@@ -134,9 +136,16 @@ run ac "a controlled token is not always visible" server/vision.nim '/^ if t\.o
|
||||
run ad "no token_gone when a token leaves the view" server/views.nim 's/^ result\.add tokenGoneFrame(id)$/ discard/' "$AD"
|
||||
run ae "a player token frame carries the GM-only kind" server/views.nim 's/ "statuses": \[\], "props": props/ "statuses": [], "props": props, "kind": "npc"/' "$AE"
|
||||
run af "explored forgets cells outside the current polygon" server/vision.nim 's/^ for idx in added: pv\.explored\.incl idx$/ pv.explored = added/' "$AF"
|
||||
# slice 6 (#21): the chunk format, the per-player keying, the upsert and the startup restore
|
||||
run ag "the chunk row stride is dropped" server/explored.nim 's/((cy mod ChunkCells) \* ChunkCells) + (cx mod ChunkCells)/(cy mod ChunkCells) + (cx mod ChunkCells)/' "bitmap layout is pinned"
|
||||
run ah "a cell coordinate is used as a chunk coordinate" server/explored.nim 's/^ cell div ChunkCells$/ cell/' "bitmap layout is pinned|one chunk covers 64x64"
|
||||
run ai "restore forgets the decoded cells" server/explored.nim 's/^ result\.mgetOrPut(pid, PlayerVision())\.explored\.incl idx$/ discard/' "stored cells come back exactly"
|
||||
run aj "explored chunks keyed by scene, not player" server/explored.nim 's/db\.exec(ps, c\.playerId, sceneId, c\.cx, c\.cy, c\.bits)/db.exec(ps, sceneId, sceneId, c.cx, c.cy, c.bits)/' "never mix"
|
||||
run ak "a chunk rewrite is ignored" server/explored.nim 's/DO UPDATE SET bits = excluded\.bits"""$/DO NOTHING"""/' "replaces the bitmap"
|
||||
run al "dirty chunks keyed by row only" server/explored.nim 's/^ let key = ccy \* sc\.chunkCols + ccx$/ let key = ccy/' "two chunks in one chunk row are both written"
|
||||
wait
|
||||
rc=0; : > "$LOG"
|
||||
for id in control a b c d1 d2 e f g h i j k l m n o p q r s t u v w x y z z2 aa ab ac ad ae af; do
|
||||
for id in control a b c d1 d2 e f g h i j k l m n o p q r s t u v w x y z z2 aa ab ac ad ae af ag ah ai aj ak al; do
|
||||
[ -f "$T/$id/res" ] && cat "$T/$id/res" >> "$LOG"
|
||||
if [ -f "$T/$id/verdict" ]; then tee -a "$LOG" < "$T/$id/verdict"; [ "$(cat "$T/$id/rc")" = 0 ] || rc=1
|
||||
else echo "$id: NO RESULT (job killed?)" | tee -a "$LOG"; rc=1; fi
|
||||
|
||||
Reference in New Issue
Block a user