feat(walls): door refusals and secret/locked equivalence gate (#56)

- door.set: opening a secret or locked door is invalid; closing either is
  allowed; a fixed window/non-door still has no open state.
- new tools/doors.test.mjs: two fresh servers, one identical script, three
  equivalence pairs (secret/wall, secret+locked/wall, locked/closed door),
  canonicalised frame + full per-player tile sweeps, an open-door positive
  control and a pinned zero-thickness close-push.
- secretgap fault hook (sight-only) makes the pair fail as exactly SECRETGAP;
  the clean pair passes and the shipped binary carries no fault hook.
- docs/TESTING.md T2/T17 and the door-equivalence/10.3 sections: built.

Ref #56
This commit is contained in:
2026-11-19 22:49:39 +01:00
parent 484275e8bb
commit 0f3aa2300f
6 changed files with 459 additions and 27 deletions
+26
View File
@@ -185,6 +185,32 @@ suite "persistence (write-through, restart-identical)":
check loadScene(conn).get.walls.len == 1
check loadScene(conn).get.nextWallId == 3
test "door.set refuses to open a secret or locked door, closing either is allowed (#56)":
let (conn, d) = freshScene()
defer:
close(conn)
removeDir(d)
var sc = loadScene(conn).get
var secret = wall(10, 10, 100, 10, door = true)
secret.secret = true
let secretId = addWall(conn, sc, secret).get
var locked = wall(10, 20, 100, 20, door = true)
locked.locked = true
let lockedId = addWall(conn, sc, locked).get
check setDoor(conn, sc, secretId, true) == waInvalid
check setDoor(conn, sc, lockedId, true) == waInvalid
check wallById(sc, secretId).get.open == false
check wallById(sc, lockedId).get.open == false
check loadScene(conn).get.walls[0].open == false
# Closing either is a no-op, never a refusal: the setting only refuses opening.
check setDoor(conn, sc, secretId, false) == waOk
check setDoor(conn, sc, lockedId, false) == waOk
# Clearing the setting makes the same door openable, and the lock/secret never leaks.
var clear = wallById(sc, lockedId).get
clear.locked = false
check updateWall(conn, sc, clear) == waOk
check setDoor(conn, sc, lockedId, true) == waOk
test "nullable height and label use SQL literals and round-trip as none, not 0 or ''":
let (conn, d) = freshScene()
defer: