feat(walls): one-way sight per-viewer filter and ONEWAY fault (#58)

The vision fan blocks a sight-blocking one-way wall only for a viewer on
its blind side (sight_dir names it; left is the (-dy,dx) normal of a->b),
one sign test inline after the radius cull, so the hoisted wall list stays
viewer-independent. Movement never reads the direction: one-way walls block
both ways. Explored and tiles therefore differ by side and only ever grow.

- geometry: WallDir + Wall.sightDir + blindTo, filter in visibilityPolygon.
- worldmap: sight_dir mapping (movement mapping unchanged).
- vision: the ONEWAY leak-fault build drops sight_dir player-side.
- leakcheck: own side test for the fan and the clear-segment oracle; ONEWAY
  class detected against the sight_dir-dropped fan.
- leak scenario gains a one-way wall the subject sees across; fault test
  asserts exactly ONEWAY.
- oneway.test.mjs: both sides, tile sweep with its own oracle, flip with
  fixed endpoints, monotone explored/tiles, restart, two-way movement.
- docs: DESIGN 5.8 mechanism sentence corrected; TESTING #58 markers built.
- nginx harness: temp dirs created recursively (restart on one state dir).
This commit is contained in:
2026-11-19 22:57:39 +01:00
parent 0f3aa2300f
commit 9fcbe885c1
14 changed files with 649 additions and 78 deletions
+6 -4
View File
@@ -1115,16 +1115,18 @@ What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sig
marker carries no type).
- **What a one-way wall does to the floor [FIXED (owner decision), 2026-11-16, #47].** Explored
cells and tiles differ per side **by construction, not by a new mechanism**: each viewer's sight
wall list drops the one-way walls whose blind side that viewer stands on, so polygon,
`cellsTouched`, explored and therefore tiles differ between the two sides with no extra state.
wall list drops every one-way wall the viewer sees across (the viewer is not on its blind side),
so polygon, `cellsTouched`, explored and therefore tiles differ between the two sides with no
extra state.
Explored only grows (5.4), so flipping the direction or `a`/`b` never un-explores a cell and never
revokes a tile; a flip only widens what the newly-seeing side may explore next. Movement is
two-way (above). With a low wall the direction filters first, then 5.9/5.10 evaluate every crossed
face of the walls that remain.
- **Per-viewer filter [FIXED (owner-delegated), 2026-11-16, #47].** Nothing per-viewer is stored or
copied: the 5.10 quad faces stay hoisted and viewer-independent, and the fan skips a
sight-blocking wall inline when it is one-way and the viewer is on its blind side — one sign test
per **one-way** wall per viewer (cross product with `(-dy, dx)`), after the radius-bbox cull;
sight-blocking one-way wall inline for a viewer on the seeing side (it blocks only a viewer on its
blind side) — one sign test per **one-way** wall per viewer (cross product with `(-dy, dx)`),
after the radius-bbox cull;
two-way walls pay only a type check. Rejected: a per-viewer copy of the wall list (the prototype
measured ~0.15 ms per viewer per frame for the copy, times tokens) and two prebuilt left/right
lists (choosing between them needs the same per-viewer side test, and they duplicate the list).
+19 -13
View File
@@ -226,6 +226,9 @@ How to run: `devbox run test` = Nim in-process tests first, then the Node black-
(§10.3, DESIGN §3.4 T17, #46).
- A wall `label` is in the leak checker's `BannedAlways` key scan (§10.3), so a player frame carrying
`label` is `WALLDATA`.
- One-way sight (built, #58): the two sides, the direction flip, monotone explored/tiles and the
restart are proven by `tools/oneway.test.mjs`; the checker's own side test and the `ONEWAY` fault
are in §10.3.
### 5.9 Low walls: see-over
@@ -347,10 +350,10 @@ from the prototype, what was missing, what the M3 build added, and the tools it
exact-class assertion; the shipped binary must contain no `LEAK_FAULT`. Built: `HIDDEN_TOKEN`,
`GMONLY_TOKEN`, `WALLDATA`, `WITHHELD`, `NO_REMOVE`, `OWN_VIEW`, `OTHER_PLAYER`, `EXPLORED`,
`OWNER_PROP`, `GM_PROP`, `STATUS_SOURCE`, `ACTUAL_NAME`, `STALE_NAME`, `CHAR_LIST`,
`CONTROLLER_CHANGE`, `CHAR_OWNER_PROP`, `KEY_IN_LOG`. Walls r1 built: `secretgap` (#56), asserted
as exactly `SECRETGAP` by `tools/doors.test.mjs` (the differential group, not the transcript
checker). Planned: Walls r1 — `ONEWAY` (#58), `MARKER_EARLY`/`MARKER_EXTRA`/`MARKER_OFF`
(#59/#60). `tools/leakcheck.nim`
`CONTROLLER_CHANGE`, `CHAR_OWNER_PROP`, `KEY_IN_LOG`, `ONEWAY` (#58). Walls r1 built: `secretgap`
(#56), asserted as exactly `SECRETGAP` by `tools/doors.test.mjs` (the differential group, not the
transcript checker). Planned: Walls r1 — `MARKER_EARLY`/`MARKER_EXTRA`/`MARKER_OFF` (#59/#60).
`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
`gmOnly` faults also produce `NO_REMOVE` (a leaked token whose frame never changes leaves the client
@@ -422,19 +425,22 @@ from the prototype, what was missing, what the M3 build added, and the tools it
thick locked door vs thick plain door), byte-identical. Also pinned: a fixed window and an open door
never push, and no wall edit pushes. **Mutations:** push from the drawn line; push ignoring the normal
span; ambiguous side ignoring `prev`; validity check on the door only — each fails at least one test.
- **One-way direction (#47; planned: Walls r1 #58)**: `tools/leakcheck.nim` and the independent
- **One-way direction (#47; built: Walls r1 #58)**: `tools/leakcheck.nim` and the independent
explored/tile oracle apply
**their own** side test — sign of the cross product of `viewer - a` with the `(-dy, dx)` normal of
`a -> b`, positive = left — never by calling `vision.nim`: a sight-blocking one-way wall is dropped
from the oracle's wall list for a viewer on its blind side, and a wall that is `blocks_sight:false`
is dropped for everyone. Assertions: a token on the blind side gets no polygon point, explored cell
or tile beyond the wall, and a token across it gives no `token` frame, no name and no encountered
entry; a viewer on the seeing side does see across (the positive control, so the oracle can fail).
`a -> b`, positive = left — never by calling `vision.nim`: a sight-blocking one-way wall stays in
the oracle's wall list only for a viewer on its blind side (the side `sight_dir` names), and a
wall that is `blocks_sight:false` is dropped for everyone. Assertions: a token on the blind side
gets no polygon point, explored cell or tile beyond the wall, and a token across it gives no
`token` frame, no name and no encountered entry; a viewer on the seeing side does see across (the
positive control, so the oracle can fail). `tools/oneway.test.mjs` runs the two sides, the
`sight_dir` flip with fixed endpoints, the monotone explored/tile set across flips and a restart,
and the per-tile sweep with the same own side test.
Tolerances as elsewhere: the 0.5 px boundary band along the blind side is oracle-*maybe* (a `200`
there is legitimate, but never *sure*), and anything clearly behind the blind wall is
oracle-refused (a withheld proof cell still fails). New fault class `ONEWAY` — the player-facing
computation drops `sight_dir` and lets the blind side see across — with its injected fault and
exact-class assertion, shaped like the existing classes.
oracle-refused (a withheld proof cell still fails). Fault class `ONEWAY` (built) — the
player-facing computation drops `sight_dir`, so the one-way wall becomes two-way — with its
injected fault (`LEAK_FAULT=oneWay`) and exact-class assertion, shaped like the existing classes.
- **Player marker (#48; shape fixed by #49; planned: Walls r1 #59/#60).** Once planned Walls r1 #59
lands, `leakcheck.nim` allows the `marker` type and, with its own code (never calling `vision.nim`),
checks that a marker exists for a player exactly when some