tools: the details group, the leak scenario's props and three fault classes (#22)
tools/details.test.mjs is the slice's WS acceptance: the five intents and their codes, a grow push clear of a wall, a squeeze in a corridor too narrow for the grown token, stuck from a wall and from a GM placement cleared by a removal and by a shrink, the GM source of a status, the caps and who reads which bucket, and a restart that brings size, props and statuses back. Waits use a cursor taken before the intent, so a repeated state cannot be matched by an older frame. The leak scenario gains a token in view with props in all three buckets, a GM-sourced status, a resize, a wall over it and the clears; leakcheck refuses the `gm` bucket (GM_PROP), the `owner` bucket on a non-controller (OWNER_PROP) and any `source` on a player status entry (STATUS_SOURCE), so `fault.test.mjs` now asserts all twelve classes. The schema-version fixtures in smoke/persistence move to 6, and mutation.sh gains am-au plus the renames.
This commit is contained in:
+19
-8
@@ -6,7 +6,7 @@
|
||||
# d1/d2: drop arm 1/2 of the shared-vertex fixture
|
||||
# e: cellsTouched without the fill spans | f: escape rule without the crossing check | g: GM moves checked against walls
|
||||
# h: capsule reduced to centre path + destination circle (prototype H10) | i: no step cap | j: blocked trigger needs centre-on-wall
|
||||
# k: wall removal / door open clears blocked unconditionally (no KEEP) | l: GM moves never set/clear blocked
|
||||
# k: wall removal / door open clears stuck unconditionally (no KEEP) | l: GM moves never set/clear stuck
|
||||
# m: door push goes to the wrong side first | n: door push skips the validity check | o: push ignores the previous-position rule
|
||||
# p: token bucket never refills | q: reqId upper bound dropped | r: malformed flood never fires | s: frame counter frozen
|
||||
# t: wall removal renumbers next_wall_id (the dense-id design, #3) | u: the id counter is not loaded from the DB
|
||||
@@ -72,7 +72,7 @@ NEW="shared endpoint: no leak at the vertex|'<' apex|every segment endpoint|rays
|
||||
D="shared vertex: both arms required"
|
||||
E="random visibility polygons|random simple polygons|corpus|prototype scene, all tokens|random wall fields|concave polygon|square polygon"
|
||||
F="exactly on a wall: can step off|overlapping 10 px off|escape from a closed door|GM placement and GM move onto a wall"
|
||||
G="GM: ignores walls, step cap and blocked"
|
||||
G="GM: ignores walls, step cap and the lock"
|
||||
H="corner clipping|leg of the path|diagonal squeeze past"
|
||||
I="step cap|over-cap, blocked-by-wall|P1:|P2:"
|
||||
J="wall added within r of the circle|Q14: a door closed"
|
||||
@@ -105,12 +105,12 @@ run d1 "shared-vertex fixture without arm 1" tests/tgeometry.nim 's/@\[arm1, arm
|
||||
run d2 "shared-vertex fixture without arm 2" tests/tgeometry.nim 's/@\[arm1, arm2\] *# SHARED-VERTEX/@[arm1]/' "$D"
|
||||
run e "cellsTouched without fill spans" server/geometry.nim '/for k in countup(0, xs\[row\].len - 2, 2)/d' "$E"
|
||||
run f "escape rule without the crossing check" server/moverules.nim 's/if pathCrosses(s, d, w.a, w.b) or segDist(d, w.a, w.b) < r: return false/if segDist(d, w.a, w.b) < r: return false/' "$F"
|
||||
run g "GM moves checked against walls" server/moverules.nim 's/^ if not inBounds(sc, d): return nack(s)$/ if not inBounds(sc, d) or not pathClear(sc.walls, s, d, sc.tokenRadius): return nack(s)/' "$G"
|
||||
run g "GM moves checked against walls" server/moverules.nim 's/^ if not inBounds(sc, d): return nack(s)$/ if not inBounds(sc, d) or not pathClear(sc.walls, s, d, sc.tokens[ti].radius): return nack(s)/' "$G"
|
||||
run h "capsule = centre path + destination circle (prototype)" server/moverules.nim 's/elif segsCross(s, d, w.a, w.b) or segSegDist(s, d, w.a, w.b) < r: return false/elif segsCross(s, d, w.a, w.b) or segDist(d, w.a, w.b) < r: return false/' "$H"
|
||||
run i "no step cap" server/moverules.nim '/if hypot(dd.x, dd.y) > stepCap(sc, sc.tokens\[ti\]): return nack(s)/d' "$I"
|
||||
run j "blocked trigger needs the centre on the wall" server/moverules.nim 's/segDist(t.pos, w.a, w.b) < sc.tokenRadius/segDist(t.pos, w.a, w.b) < 1e-9/' "$J"
|
||||
run k "removal/open clears blocked unconditionally (no KEEP)" server/moverules.nim 's/sc.tokens\[i\].blocked = overlapsAny(sc, sc.tokens\[i\])/sc.tokens[i].blocked = false/' "$K"
|
||||
run l "GM moves never set or clear blocked" server/moverules.nim '/^ if who.role == roleGM: sc.tokens\[ti\].blocked = /d' "$L"
|
||||
run j "stuck trigger needs the centre on the wall" server/moverules.nim 's/segDist(t.pos, w.a, w.b) < t.radius/segDist(t.pos, w.a, w.b) < 1e-9/' "$J"
|
||||
run k "removal/open clears stuck unconditionally (no KEEP)" server/moverules.nim 's/if not overlapsAny(sc, sc.tokens\[i\]): sc.tokens\[i\].clearWalls()/sc.tokens[i].clearWalls()/' "$K"
|
||||
run l "GM moves never set or clear stuck" server/moverules.nim '/^ if who.role == roleGM: sc.placeToken(ti)$/d' "$L"
|
||||
run m "door push: wrong side first" server/moverules.nim 's/for sg in \[(if side > 0: 1.0 else: -1.0), (if side > 0: -1.0 else: 1.0)\]:/for sg in [(if side > 0: -1.0 else: 1.0), (if side > 0: 1.0 else: -1.0)]:/' "$M"
|
||||
run n "door push: no validity check" server/moverules.nim 's/if inBounds(sc, p) and not overlapsAny(sc, tt): return (true, p)/return (true, p)/' "$N"
|
||||
run o "door push: previous position ignored on the line" server/moverules.nim 's/side = if t.hasPrev: dot(t.prev - w.a, n) else: 0.0/side = 0.0/' "$O"
|
||||
@@ -134,7 +134,7 @@ run aa "the egress ignores LOS, gm_only and ownership" server/views.nim 's/^
|
||||
run ab "gm_only ignored by the view rule" server/vision.nim '/^ if t\.gmOnly: return false$/d' "$AB"
|
||||
run ac "a controlled token is not always visible" server/vision.nim '/^ if t\.owner == playerId: return true$/d' "$AC"
|
||||
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 ae "a player token frame carries the GM-only kind" server/views.nim 's/ "statuses": statusKindsJson(v.statuses), "props": buckets/ "statuses": statusKindsJson(v.statuses), "props": buckets, "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"
|
||||
@@ -143,9 +143,20 @@ run ai "restore forgets the decoded cells" server/explored.nim 's/^ result\
|
||||
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"
|
||||
# slice 7 (#22): the bucket filter, the caps, the status set/clear and the resize/grow rules
|
||||
run am "the owner bucket reaches a non-controller" server/views.nim 's/propsOwner: (if mine: objectOf(t.props\[pbOwner\]) else: nil)/propsOwner: t.props[pbOwner]/' "never the gm bucket|gets the public bucket only"
|
||||
run an "a new wall does not stick a token" server/moverules.nim 's/sc.tokens\[i\].stuckWalls = true/discard/' "wall added within r of the circle"
|
||||
run ao "a shrink never clears the walls entries" server/moverules.nim 's/^ sc.tokens\[ti\]\.clearWalls()$/ discard/' "a squeeze from a failed grow clears|a shrink that still overlaps keeps"
|
||||
run ap "the property cap is not enforced" server/props.nim '/and p\[bucket\]\.len >= MaxPropKeys/d' "64 keys per bucket|the 65th"
|
||||
run aq "the grow push is skipped" server/moverules.nim 's/^ if not grew:$/ if true:/' "grow inside r of a wall pushes it out"
|
||||
run ar "a failed grow is not flagged squeezed" server/moverules.nim '/^ sc.tokens\[ti\]\.squeezedWalls = true$/d' "grow with no room on either side squeezes"
|
||||
run as "a failed door push sticks instead of squeezing" server/moverules.nim 's/^ sc.tokens\[i\]\.squeezedWalls = true$/ sc.tokens[i].stuckWalls = true/' "push: both sides invalid"
|
||||
run at "one bucket budget shared by all buckets" server/props.nim 's/and p\[bucket\]\.len >= MaxPropKeys/and p[pbPublic].len >= MaxPropKeys/' "64 keys per bucket"
|
||||
run au "a grow that already fits still pushes" server/moverules.nim 's/^ if not overlapsAny(sc, sc.tokens\[ti\]):$/ if false:/' "a grow that already fits does not move the token"
|
||||
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 ag ah ai aj ak al; 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 am an ao ap aq ar as at au; 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