docs: analysis review and decisions

This commit is contained in:
2026-11-17 22:45:58 +01:00
parent 287859d890
commit 7b804f4e5e
3 changed files with 526 additions and 8 deletions
+12 -8
View File
@@ -1,6 +1,6 @@
# FFF_vtt design
Status: draft v0.29, 2026-11-17 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14; v0.22 records #42 (the wall model: independent sight/movement switches with door settings and a sight-only direction, kinds as presets, a derived `kind` label, the v1 preset table, and secret/locked unobservable to players) in 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14; v0.23 records #44 (low walls: see-over as a per-target predicate over the strict fog polygon, movement blind to height, the floor behind a low wall left unexplored, and the GM-only who-sees-it view) in 5.7, 5.8, 5.9, 7.4, 14; v0.24 records #46 (secret and locked doors: doors stay GM-only in v1, a locked door refuses to open, and the differential door-equivalence oracle with its fault, leakcheck and tile sweeps) in 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3, 14; v0.25 records #45 (thick walls: the rectangular body and its placement, the shared sight/collider rectangle with square ends, see-over at every crossed face, no push on a wall edit, and the shape seam) in 1, 5.1, 5.3, 5.5, 5.7, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 13, 14; v0.26 records #47 (windows as see-through wall pieces with no sill or top and the `window` preset, one-way direction wording, the body opaque from both sides, and the one-way oracle and fault class) in 1, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14; v0.27 records #48 (`terrain` dropped, four presets, the `player_marker` switch and its player-wire exception, the GM-only wall `label`, and the "fewest things" principle) in 1, 3.1, 3.4, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14; v0.28 records #50 (door geometry: the door leaf is the wall's own body, an open door is only a gap, and the thick-door push geometry) in 5.4, 5.5, 5.8, 5.10, 10.3, 14; v0.29 records #49 (the wall record's wire fields, typed columns with CHECK constraints, migration step 8 with the legacy `kind` dropped and `marker_seen` added, existing heights backfilled to 1.8 m, the player `marker` message, and `proto` 2) in 3.1, 4.4, 5.7, 5.8, 5.9, 5.10, 6.1, 6.2, 6.3, 8, 10.3, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
Status: draft v0.30, 2026-11-17 (owner decisions recorded in section 14; v0.4 records Q4 (tile_size 32 px), the outbox lock invariant (4.2, 4.3), and the follow-ups in 3.4, 8, 11.1, 12, 13; v0.5 records the M2 move-rule decisions in 5.5 and updates 3.4, 4.2, 5.1, 5.4, 6.1, 7.4, 8, 10.3, 12, 13; v0.6 records #14 (characters and player data) in 3.1, 3.4, 4.1, 4.4, 6.1, 8, 9, 10.3, 13, 14; v0.7 records #6 (players and invites) in 3.1, 3.2, 3.4, 4.4, 6.1, 8, 12, 13, 14; v0.8 records #7 (map tiles) in 3.3, 3.4, 11.1, 13, 14; v0.9 records #9 (test tools) in 2, 10.4, 13, 14; v0.10 records #12 (what M3 done means) in 13, 14; v0.11 records #15 (M3 limits) in 4.3, 6.4, 10.1, 13, 14; v0.12 records #11 (M3 message list) in 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13, 14; v0.13 records the owner review of #11 flags in 1, 3.1, 5.5, 6.1, 8, 14; v0.14 records #17 (getting in: keys, sessions, the auth slice) in 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13, 14; v0.15 records #18 (talking safely: the protocol shell and the `closing` close-reason message) in 3.2, 4.3, 6, 6.1, 6.2, 6.4, 6.5, 10.3, 13, 14; v0.16 records #19 (walls and doors: the scene/wall schema, the wall payload rules and the slice-4 rollout) in 4.4, 6.1, 8, 13, 14; v0.17 records #20 (tokens and sight: the `entity` step, the typed views and the single egress, vision and explored, and the slice-5 rollout) in 4.4, 6.1, 6.3, 8, 10.3, 13, 14; v0.18 records #23 (characters and names: the `character`/`name_reveal`/`encountered` step, the name rule, the players' names and the `roster` frame, and the four name/character fault classes) in 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13, 14; v0.19 records the owner confirmation of the #22 property-schema registry (keep the empty registry with the permissive fallback in v1; strict mode comes with the FFF seam, post-v1) in 6.1, 14; v0.20 records the #27-#31 correctness and cost fixes (per-player reveal persistence, one encountered rewrite path, link-by-update, the borrowed egress context, one scene read per request) in 4.3, 6.1, 10.3, 14; v0.21 records #41 (the height model: metres, `height` and `eye_height` as GM-only registered props with a token override, eye height 93% by default, walls full height unless the GM gives a height) in 5.7, 6.1, 8, 9, 14; v0.22 records #42 (the wall model: independent sight/movement switches with door settings and a sight-only direction, kinds as presets, a derived `kind` label, the v1 preset table, and secret/locked unobservable to players) in 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14; v0.23 records #44 (low walls: see-over as a per-target predicate over the strict fog polygon, movement blind to height, the floor behind a low wall left unexplored, and the GM-only who-sees-it view) in 5.7, 5.8, 5.9, 7.4, 14; v0.24 records #46 (secret and locked doors: doors stay GM-only in v1, a locked door refuses to open, and the differential door-equivalence oracle with its fault, leakcheck and tile sweeps) in 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3, 14; v0.25 records #45 (thick walls: the rectangular body and its placement, the shared sight/collider rectangle with square ends, see-over at every crossed face, no push on a wall edit, and the shape seam) in 1, 5.1, 5.3, 5.5, 5.7, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 13, 14; v0.26 records #47 (windows as see-through wall pieces with no sill or top and the `window` preset, one-way direction wording, the body opaque from both sides, and the one-way oracle and fault class) in 1, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14; v0.27 records #48 (`terrain` dropped, four presets, the `player_marker` switch and its player-wire exception, the GM-only wall `label`, and the "fewest things" principle) in 1, 3.1, 3.4, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14; v0.28 records #50 (door geometry: the door leaf is the wall's own body, an open door is only a gap, and the thick-door push geometry) in 5.4, 5.5, 5.8, 5.10, 10.3, 14; v0.29 records #49 (the wall record's wire fields, typed columns with CHECK constraints, migration step 8 with the legacy `kind` dropped and `marker_seen` added, existing heights backfilled to 1.8 m, the player `marker` message, and `proto` 2) in 3.1, 4.4, 5.7, 5.8, 5.9, 5.10, 6.1, 6.2, 6.3, 8, 10.3, 14; v0.30 records the 2026-11-17 review of `docs/ANALYSIS.md` (build order after the M4 phone playtest, minimum zoom 0.5, walls statuses accepted, slow-client close superseded by stop-feed + resync, and the DESIGN split note) in 1, 4.3, 5.10, 6.1, 7.4, 13, 14. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents.
Legend:
- **[FIXED]** owner decision, not up for debate here.
@@ -26,6 +26,7 @@ A browser virtual tabletop for one table (1 GM + up to 6 players [FIXED, Q1]), s
- **Do the most with the fewest things: one object, switches on top, names are only labels.** A wall is one record; its behaviour is a small set of independent switches; preset names (`wall`, `door`, `window`, `one-way`) are editor shortcuts and labels over those switches, never storage and never a second kind of object. Apply this principle to future cards: prefer a new switch or field on the existing object over a new object, a new message or a new enum. Corollary: if two features have the same switches, they have the same rules and the same name — no parallel implementations.
### v1 scope [PROPOSED, trimmed to what the prototypes proved plus the minimum to be usable]
- **Build order [FIXED (owner decision), 2026-11-17, `docs/ANALYSIS-review.md` D1]:** all wall design stays FIXED, but thick walls (5.10) and wall/token heights with see-over (5.7, 5.9) are **built after the first playable M4 client and a phone playtest**. The v1-first build is thin walls with the 5.8 switches, doors, secret/locked, windows, one-way and player markers. The #49 schema lands complete now - `thickness`/`position`/`height` columns with today's defaults (`0`, `center`, `NULL`) - so the later build needs no migration.
- One table, 1 GM + up to 6 players (max 6 [FIXED, owner decision 2026-11-08, Q1]), a shared site link and per-player keys, no accounts.
- Exactly one scene in v1 (Q3, FIXED): large tiled map image, optional visual grid, walls and doors, tokens. A wall's behaviour is a set of switches (blocks sight, blocks movement, sight direction, player marker) plus door settings; the editor's four presets (`wall`, `door`, `window`, `one-way`) are one-drag defaults over them, and `secret`/`locked` are checkboxes on any door (5.8; supersedes Q6's `wall`|`door` only and #42/#47's longer preset list). A wall also has a per-wall thickness and height (5.10, 5.7).
- GM tools: author walls, doors, windows and one-way barriers in the browser (Q6, FIXED; presets plus an advanced toggle, 5.8, 7.4), create/move/delete tokens, toggle doors, edit token properties, manage players and player keys.
@@ -223,8 +224,8 @@ Second limitation [INFERRED]: a fast drag sampled at ~50 ms can produce a straig
- Worker threads: prototype uses 8; one table needs 2-4 [INFERRED].
- **Slow client [FIXED (owner decision), 2026-11-08, Q13 option A]**. mummy's send queue is one unbounded deque and per-socket backlog is invisible to app code (no forced close, no depth API at this pin). No mummy patch. Research: `docs/research/q13-mummy-slow-clients.md`.
- **Bounded outbox per connection** (keyed by app `connId`), with byte and message caps. State messages (vision, token, explored, wall) are **latest-state-wins coalesced per key** (MQTT-retained-like). The diff against `known` is computed at **flush time**, not enqueue time, so a dropped intermediate state cannot desynchronise the client.
- **Ack by Ping/Pong**: server sends WS `Ping(seq)` (payload <= 125 B) on a timer; the client's Pong echoes `seq` (RFC 6455 §5.5.2-5.5.3; browsers answer without JS). Acks give bytes in flight and lag per connection. Interval [FIXED (owner-delegated), #18]: every 20 s, plus one Ping immediately after `hello` on each connection. Slice 3 sends the Ping and records the Pong per connection (`Conn.pongSeq`, `Conn.lastPongMs`); the lag measurement itself, the stop-feeding rule and the forced close of a silent peer stay M5. A Ping/Pong is a control frame and carries no `n` (6).
- **Lagging client** (outbox over cap, or no Pong within a bound): stop feeding it, keep the connection. On recovery, full resync (6.3).
- **Ack by Ping/Pong**: server sends WS `Ping(seq)` (payload <= 125 B) on a timer; the client's Pong echoes `seq` (RFC 6455 §5.5.2-5.5.3; browsers answer without JS). Acks give bytes in flight and lag per connection. Interval [FIXED (owner-delegated), #18]: every 20 s, plus one Ping immediately after `hello` on each connection. Slice 3 sends the Ping and records the Pong per connection (`Conn.pongSeq`, `Conn.lastPongMs`); the lag measurement and the stop-feeding + resync rule stay M5. A Ping/Pong is a control frame and carries no `n` (6). There is no application-level forced close for lag at this pin; only nginx proxy timeouts close a dead peer (below).
- **Lagging client** (outbox over cap, or no Pong within a bound): stop feeding it, keep the connection. On recovery, full resync (6.3). **This supersedes the earlier "close a slow client when lag exceeds a bound" rule** [FIXED (owner-delegated), 2026-11-17, `docs/ANALYSIS-review.md` §6.4]: lag never closes a connection; a client that never recovers is closed only by the nginx proxy timeout, because a forced close is impossible at the mummy pin anyway.
- **Dead or stuck peers**: closed by nginx proxy timeouts [PROPOSED mechanism; verify in M5 that `/ws` goes through nginx and which directive fires, `send_timeout` is the candidate]. `close(ws)` cannot force-close at this pin (it queues behind the backlog).
- Connection limits [FIXED (owner-delegated, 2026-11-14, #15)]: 4 connections per player (a 5th closes that player's oldest); 16 total (1 GM + 6 players x ~2 devices + headroom); the 17th is refused. Replaces the PROPOSED cap of 8. Enforced in `websocketHandler` (mummy's inbound queue is unbounded). Frame and intent limits: 6.4.
- Forking mummy (per-socket depth, forced close) is fallback only, not planned.
@@ -345,7 +346,7 @@ Normative for M2. Replaces the prototype move validation (5.1) and the move-rela
Notation: token centre `c`, radius `r` (entity `radius` if set, else scene `token_radius_default`; 5.6), start `s`, destination `d`. Blocking wall: segment with `blocks_movement` on, and for a door only while it is closed (5.8); open doors do not block, and a one-way wall blocks movement both ways. `dist(X, W)` = distance from point or segment `X` to `W`'s body: the segment itself, or the rectangle of 5.10 when the wall has thickness (a centre inside the rectangle is distance 0). "Overlaps" = `dist < r` (strict; touching at exactly r is clear).
**Statuses `stuck` and `squeezed`** (replace the M2 `blocked` bool) [FIXED, owner (B), Q14, refined 2026-11-08; FIXED, owner 2026-11-10, #4]. Both are cause-agnostic lock conditions: a locked token cannot be moved by its player; the GM always can. `stuck` = held in place (wall through it, ropes, magic grasp); `squeezed` = pressed, no room (walls around it, closing hand).
- Storage: a token holds a set of `(status, source)` entries (stored on the entity, persisted); the same status may come from several sources. Locked while any entry exists. Both statuses may show at once. Sources: `walls` (set by the rules below) and `GM` (GM sets either status by hand for any reason; GM can clear any single entry at any time). Visibility: every recipient who sees the token gets `status` only; `source` is GM-only (6.1, amended 2026-11-14).
- Storage: a token holds a set of `(status, source)` entries (stored on the entity, persisted); the same status may come from several sources. Locked while any entry exists. Both statuses may show at once. Sources: `walls` (set by the rules below) and `GM` (GM sets either status by hand for any reason; GM can clear any single entry at any time). Visibility: every recipient who sees the token gets `status` only; `source` is GM-only (6.1, amended 2026-11-14). The `walls`-sourced case is an accepted, documented effect (6.1 leak note 6, 2026-11-17).
- Overlap: `dist(c, W) < r` for a blocking wall `W`. An open door stops blocking, so opening = removing that wall for this rule; closing = adding it. Centre-on-wall is not required, and a centre inside a thick body is distance 0, so it overlaps (5.10).
- Set (source `walls`): a wall is added or updated -> every token overlapping that wall gets `stuck`. (A door CLOSING on a token does not set it: push rule below.) The GM places or moves a token to a position overlapping any blocking wall -> `stuck`.
- Keep: while any blocking wall still overlaps the token, its `walls`-sourced entries stay (opening a door does not free it if another wall overlaps).
@@ -460,7 +461,7 @@ What a wall's thickness does to the floor it covers, the vision fan and the coll
- **Unit and limits** [FIXED (owner-delegated), 2026-11-15, #45]. Thickness is **px**, a map distance like length and token radius: heights are metres (5.7) and no scale converts between the two (5.7). `0 <= thickness <= 256` px (8 tiles): 0 is the line, and 256 is already a room-sized block better drawn as several walls; the cap bounds the quad. The body may cross the map edge (a border wall thickened outward); only the map area exists, so nothing is drawn or explored outside it.
- **The body is opaque floor [FIXED (owner decision), #45; both sides for a one-way wall, #47].** It is never inside a player's polygon and its own area is never newly explored, so a player's fog stays black under it and no tile is newly revealed there. This holds on both sides of a one-way wall (5.8). Explored only grows (5.4), so cells explored before a body was thickened over stay explored and tiles already held stay held; the rule is that a body reveals nothing, ever.
- **One shape, two readers [FIXED (owner decision), #45].** Sight and movement read the same exact rectangle, with the same square ends, so a corner cannot be generous to one and tight to the other. A wall with `blocks_sight: false` contributes nothing to sight, body included (a window's thickness is movement-only, 5.8); its collider still uses the thickness.
- **Sight: the body quad.** A sight-blocking thick wall enters the vision input as the four faces of its rectangle (two long, two square ends), hoisted once per wall edit and reused for every viewer and frame — viewer-independent, so it caches [#43 measured: 0.26 vs 0.94 ms on 5k sparse and 12.7 vs 13.2 dense, against the 3-face near+caps silhouette that is observer-dependent and cannot be hoisted]. The fan and `cellsTouched` are otherwise unchanged, and zero thickness is the segment of today. A one-way wall's own body is opaque floor on **both** sides (5.8, #47): the blind side gets no face at all, and the seeing side sees up to the near face — never into or past the body's floor.
- **Sight: the body quad.** A sight-blocking thick wall enters the vision input as the four faces of its rectangle (two long, two square ends), hoisted once per wall edit and reused for every viewer and frame — viewer-independent, so it caches [#43 measured: 4-face quad 0.263 ms hoisted vs 0.943 ms per query on 5k sparse, 12.721 vs 13.229 ms dense; the 3-face near+caps silhouette is observer-dependent, cannot be hoisted, and costs 0.699 ms per query sparse (8.4x thin), so the hoisted quad is the cheaper exact model]. The fan and `cellsTouched` are otherwise unchanged, and zero thickness is the segment of today. A one-way wall's own body is opaque floor on **both** sides (5.8, #47): the blind side gets no face at all, and the seeing side sees up to the near face — never into or past the body's floor.
- **Movement: exact circle-vs-rectangle.** `dist(c, body)` is the true Euclidean distance from the token's centre to the rectangle, and a centre **inside** the body is distance 0, so it overlaps (`0 < r`). One rectangle-distance primitive, in one place, serves every reader: `pathClear` (the capsule/segment check and the escape rule of 5.5), the `stuck`/`squeezed` overlap check, the door push, `pushOutOfWalls` and resize/grow push. Movement still never reads height (5.9).
- **See-over across a body [FIXED (owner decision), #45].** 5.9's comparison is evaluated at **every face the eye -> target-top line crosses**: entering and leaving a body is two crossings (near and far), and an oblique line may cross an end face instead, so the rule is "every crossed face of the rectangle", strictly above the wall's height at each. Both must clear: a target shorter than the viewer's eye has the line falling, so the far face is stricter; a taller one has it rising, so the near face is. With zero thickness the two faces coincide with the wall line, and 5.9 is unchanged. The visible fraction's per-wall minimum becomes a minimum over that wall's crossed faces, so the number cannot drift from the binary answer. Candidate walls still come from the radius-bbox cull, now over the body's box.
- **A viewer inside a sight-blocking body sees nothing [FIXED (owner decision), #45].** A token whose vision origin (its centre) lies inside such a body gets an empty polygon until it leaves: no cells, no other tokens, no tiles. It normally overlaps the body and is `stuck` too, so it cannot walk out by itself; the GM moves it out.
@@ -651,7 +652,7 @@ All are built per recipient at egress (single egress rule, 2). "Sent" always mea
Count: 16 server messages (15 M3 + `marker`, 6.2 `proto` 2). Reserved, not built: `event` (9). The player marker of 5.8 (#48/#49) is the only player-bound wall frame.
Leak notes (R5 review, #11): (1) `kind` is GM-only because a value like `npc` would tell a player what a visible token is; the client names tokens from `name` and `props`. (2) `character_id` goes only to the character's owner and the GM; showing it to others would link two tokens of one character and mark a token as "a character, not a monster". (3) `cprops` is public bucket only and always present (even empty) for non-owners so presence does not mark a token as character-linked. (4) The roster omits unnamed players for players so an unused key (or the number of keys) is not visible. (5) `hello` carries `vision_radius_default` so the client can respect the step cap (5.5); it states a distance only, no wall fact. (6) `statuses[].source` goes to the GM only (amends #4, 2026-11-14): viewers see the status, not its cause, so a player does not learn that a wall or GM action caused it. Open: a `walls`-sourced status still tells a viewer that some blocking wall touches the token; #4 argued LOS covers that, owner to confirm. (7) `encountered.grey` flipping and `token`/`token_gone` carry the same fact (the token left view), so deletion and moving away look identical to the player.
Leak notes (R5 review, #11): (1) `kind` is GM-only because a value like `npc` would tell a player what a visible token is; the client names tokens from `name` and `props`. (2) `character_id` goes only to the character's owner and the GM; showing it to others would link two tokens of one character and mark a token as "a character, not a monster". (3) `cprops` is public bucket only and always present (even empty) for non-owners so presence does not mark a token as character-linked. (4) The roster omits unnamed players for players so an unused key (or the number of keys) is not visible. (5) `hello` carries `vision_radius_default` so the client can respect the step cap (5.5); it states a distance only, no wall fact. (6) `statuses[].source` goes to the GM only (amends #4, 2026-11-14): viewers see the status, not its cause, so a player does not learn that a wall or GM action caused it. A `walls`-sourced status still tells a viewer that some blocking wall touches the token; **CLOSED as accepted [FIXED (owner decision), 2026-11-17, `docs/ANALYSIS-review.md` D4]**: a refused move already reveals the same fact, so this is a documented, accepted effect, not a leak to fix. (7) `encountered.grey` flipping and `token`/`token_gone` carry the same fact (the token left view), so deletion and moving away look identical to the player.
### 6.2 Versioning [PROPOSED]
- `proto` is an integer compiled into both client and server. `proto = 1` is M3 as shipped. **`proto = 2` is the wall-model build [FIXED (owner decision), 2026-11-17, #49]**: `wall.add`/`wall.update` take `thickness`, `position`, `height`, `label` and the typed switches/`preset` instead of `kind`, `walls`/`wall` carry `height`, and the `marker` message exists. This is breaking because an old client sends `{"kind":"door"}` and the server, which ignores unknown fields, would silently create a solid wall; nothing else in the catalogue changes. The client announces it in the upgrade request (`/ws?proto=N`), and the parameter is required: absent or not a plain integer is HTTP 400, no upgrade (6.5 row 3). Any mismatch, older or newer, is refused (6.5 row 5): the upgrade completes and the server sends `closing {reason:"proto-mismatch", code:4003}` and closes, because a browser `WebSocket` cannot read an HTTP status, only a close code (and the code itself cannot be sent at the mummy pin, 3.2). The client then shows "reload" (assets are content-hashed by Vite, so a reload fetches the matching client). No `hello` and no state are sent on a mismatch. `hello.proto` is checked again on receipt as a backstop.
@@ -768,7 +769,8 @@ Prototype `client/src/main.ts`: explored rects appended to a `Graphics` mask for
### 7.4 Input and UI
- Mouse: wheel zoom, drag pan, drag token. Touch: one finger drag/pan, two-finger pinch/pan [MEASURED works on Note 10].
- Wall editor (GM) [FIXED, Q6, extended by 5.8, 5.10, #47, #48]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row of **four** buttons (`wall` (default), `door`, `window`, `one-way`) sets the switches for a one-drag default, so a window is authoring `wall | window | wall`; `secret` and `locked` are **checkboxes on any door**, so a secret door is the door preset with `secret` ticked (no separate preset), and an opening window can be locked. A **fixed window** is the window preset with `door` unticked. A **`player_marker` checkbox** ("players see a marker", on by default for a window, off otherwise) and a free-text **`label`** field (GM-only, at most 64 characters) sit beside the preset row; neither changes vision or movement. An **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `player_marker`, `door`, `open`, `secret`, `locked`) for a custom wall. A thickness control and a **position flip** (`center|left|right`) sit beside them, the flip previewing the body live and never moving `a`/`b`; a new wall starts at the GM's last-used thickness (0 in a fresh editor). A **one-way wall is drawn as an arrow at the wall's middle** pointing the way the view goes — from the seeing side toward the watched side — with a **direction flip** that swaps `sight_dir` `left`/`right` and never moves `a`/`b`, the same flip control as the position flip. Arrow, flip, marker and label are GM-only like every wall fact and never on a player wire, except the marker itself (3.1, 5.8); the editor draws `kind` (the derived label) only, and no preset is a stored kind. The height control is M4's (5.7). A locked door's open action is the `invalid` case of 5.8, so the editor shows the hint "locked: unlock first" and offers the one click that clears `locked`; no door action is offered to players (#46).
- **Minimum zoom [FIXED (owner decision), 2026-11-17, `docs/ANALYSIS-review.md` D3]:** player zoom-out clamps at 0.5, which bounds the visible tile requests (about 1.3k at 0.5; about 5k at 0.25). A per-player explored-masked overview image is a possible later feature, not v1.
- Wall editor (GM) [FIXED, Q6, extended by 5.8, 5.10, #47, #48]: click-click segments, snap to grid/endpoints optional, delete, undo of last edit [PROPOSED]; submits `wall.*` intents; server is the validator. A preset row of **four** buttons (`wall` (default), `door`, `window`, `one-way`) sets the switches for a one-drag default, so a window is authoring `wall | window | wall`; `secret` and `locked` are **checkboxes on any door**, so a secret door is the door preset with `secret` ticked (no separate preset), and an opening window can be locked. A **fixed window** is the window preset with `door` unticked. A **`player_marker` checkbox** ("players see a marker", on by default for a window, off otherwise) and a free-text **`label`** field (GM-only, at most 64 characters) sit beside the preset row; neither changes vision or movement. An **advanced** toggle exposes the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `player_marker`, `door`, `open`, `secret`, `locked`) for a custom wall. A thickness control and a **position flip** (`center|left|right`) sit beside them, the flip previewing the body live and never moving `a`/`b`; a new wall starts at the GM's last-used thickness (0 in a fresh editor). A **one-way wall is drawn as an arrow at the wall's middle** pointing the way the view goes — from the seeing side toward the watched side — with a **direction flip** that swaps `sight_dir` `left`/`right` and never moves `a`/`b`, the same flip control as the position flip. Arrow, flip, marker and label are GM-only like every wall fact and never on a player wire, except the marker itself (3.1, 5.8); the editor draws `kind` (the derived label) only, and no preset is a stored kind. The height control is not M4's: height and thickness controls are built after the M4 playtest (build order, 1; 5.7, 5.10). A locked door's open action is the `invalid` case of 5.8, so the editor shows the hint "locked: unlock first" and offers the one click that clears `locked`; no door action is offered to players (#46).
- Grid snap on drop: client option, off by default [FIXED, Q18]. Server accepts any in-bounds position within the step cap and clear of walls (5.5; step cap = effective vision radius, Q18 FIXED).
- Who-sees-it view (GM only) [FIXED (owner decision), 2026-11-15, #44]: for each token, which player(s)/characters see it and its visible fraction (5.9, 100 % when unobstructed). GM-only and never on a player wire; the panel's shape belongs to the M4 editor/fog work.
@@ -981,7 +983,7 @@ Each is small, ends with a green gate, and no milestone depends on browser UI be
8. **persistence**: explored chunks round trip; old DB migrates to new (H13, 4.4, 10.3; migrations are PROPOSED in 4.4).
9. **logs**: no secret in any log; the test greps the logs for every key and session value it used (T6, 11.3 PROPOSED). **Built by slice 10 (#25):** `tools/logs.test.mjs` (two runs incl. a GM-key rotation, keys/sessions/hashes, and a `keylog` leak-fault negative control; details in 10.3).
- **M4 - Client v1.**
- Scope: new `client/` dir (first real client build): Vite + TS + Pixi v8 client: layers, tiles, grid, tokens (BitmapText), character list, encountered list (greyed), reveal buttons (#14 UI; server side in M3), fog textures, wall editor with presets (5.8) and thickness/position (5.10), token drag with prediction/rollback, DOM overlay, reconnect backoff, reducer tests; after the client port, archive `prototype-*` dirs (Q24).
- Scope: new `client/` dir (first real client build): Vite + TS + Pixi v8 client: layers, tiles, grid, tokens (BitmapText), character list, encountered list (greyed), reveal buttons (#14 UI; server side in M3), fog textures, wall editor with presets and switches (5.8) and player markers, token drag with prediction/rollback, DOM overlay, reconnect backoff, reducer tests; after the client port, archive `prototype-*` dirs (Q24). Thickness and height controls (5.10, 5.7) are **not** in M4: they follow the phone playtest (build order, 1).
- Accept: headless e2e: fog pixel checks, player traffic audit clean, reconnect restores; manual run on laptop and Note 10 at 60 fps with 50 tokens, 16384 px map (tiled; PROPOSED test target, Q2), fog active.
- Tile-size gates [FIXED, Q4]: (a) automated headless-Chromium test with mobile emulation (viewport, dpr, CPU + network throttle) against the real server path (nginx HTTP/2 + caching): viewport fills in < 1 s at zoom 1; (b) one manual run on the owner's 5-year-old Android phone (worst-case reference). If either fails: `tile_size` 64 px (per-scene config, no code change). The 2026-11-08 prototype phone run (`prototype-tile-leak/README.md`) is evidence, not the gate: HTTP/1.1, no-store, zoom 0.5 only, first cold load up to 3.3 s.
- **M5 - Robustness and observability.**
@@ -1099,3 +1101,5 @@ Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #48]: terrain
Owner also decided 2026-11-17 [FIXED (owner decision), 2026-11-17, #50]: door geometry. (1) **The door leaf is the wall's own body** [FIXED (owner decision)]: a door is a wall like any other, and its leaf is the 5.10 body rectangle with the same `thickness` and `position` fields — no separate leaf inside a deep opening, no clamp to the neighbouring pieces. The jambs are ordinary walls, so the doorway is the gap between wall pieces. A thick door bulges out of its doorway or leaves a step behind the jambs, exactly as drawn (authoring, not a rule), and a deep opening between thick jambs keeps the tunnel/keyhole view accepted in #43. Opening and closing add and remove that body and nothing else: no swing, no slide, no hinge, no arc, and an open door is absent from sight and movement as today. (2) **The close push** [FIXED (owner decision)]: each token whose centre is within `r` of the door's **body** is pushed out of the side its centre is on, by the minimal distance that ends `>= r` from the body (+ `PushEps`); a centre inside the body takes the side of `prev` (its position before the most recent move or push), and the left side of `a -> b` when that is undetermined; if the first side's position is invalid (out of bounds or within `r` of any blocking body) the other side is tried; if both are invalid the token stays and gets `squeezed`, and the door still closes. No axial slide, no chain, no retry. Each token is pushed independently, tokens never block tokens, and scene order only rewrites `prev`. Edits never push (5.10) and height never enters (5.9). (3) **Delegated and picked** [FIXED (owner-delegated)]: within the body's axial span the target is the face offset by `r`; past an end it is the offset from the nearest end corner **keeping the along-axis coordinate**, i.e. today's `foot + n·sqrt(r^2 - e^2)` generalised to the end face — a radial displacement from the corner was rejected because it also moves the token along the axis and would break the zero-thickness gate. A centre "inside the body" for the side test means inside the body or past an end but within the body's normal span, which reduces to today's centre-on-the-line test at zero thickness. The target and the validity check use the same rectangle-distance primitive as the collider (other thick bodies included), and `PushEps` = 1e-6 px is reused. **Zero thickness must return byte-identical values to today's `pushFrom` on the same inputs**, and the existing push tests are the regression gate, unchanged (10.3). (4) **Settled consequences** [FIXED (owner decision)]: a locked door and an opening window push exactly like a plain closed door; a fixed window (`door:false`) never closes, so it never pushes; a secret door pushes exactly as a solid wall, so #46's equivalence holds for thick doors too; the independent-per-token, no-token-collision, `prev`-rewriting order rule above is final and not a later "fix". (5) **Downstream**: #49 needs **no new wire field for doors** — the leaf is the existing `thickness`/`position` body and the existing switch set, and an open door changes no geometry, only `open`. See 5.4, 5.5, 5.8, 5.10, 10.3.
Owner also decided 2026-11-17 [FIXED (owner decision), 2026-11-17, #49]: the wall record's wire format, storage and migration. (1) **Wall height is a typed wall field** [FIXED (owner decision)]: metres, optional, `> 0` and `<= 100`, absent/`null` = full height; GM-only, carried on the GM `wall`/`walls` frames and never on a player frame (`WALLDATA`). This resolves the old contradiction — 5.7's "no dedicated column and no wire field" (narrowed there with a dated tag to tokens and characters, which have `props` buckets; a wall has none), 6.1's wall frames (which already carried the other fields) and 5.8's "no behaviour in `flags`". The property registry is unchanged: still `height` and `eye_height` for tokens and characters. (2) **Migration** [FIXED (owner decision)]: every existing token and character gets `height: 1.8 m` in `props_gm` (the 93 % eye rule is unchanged and `eye_height` is not written); every existing wall migrates to today's behaviour exactly — `thickness 0`, `position center`, `blocks_sight`/`blocks_movement` 1, `sight_dir both`, `player_marker` 0, `label` NULL, `height` NULL, `secret`/`locked` 0, `kind='door'` -> `door=1` with the same `open`, `kind='wall'` -> `door=0`. No real user data exists (pre-M4), so correctness is fixture/history hygiene plus byte-identical behaviour gates (5.8 player frames, #50 zero-thickness push). (3) **Storage: typed columns with CHECK constraints** [FIXED (owner-delegated)]: one column per field, CHECKs for the switch invariants, `flags` kept for uninterpreted GM data; chosen by precedent (interpreted data is always a column, `flags`/`props_*` are for unread data), because CHECKs can reject an impossible switch set, and because `loadScene` then has no second parse/validate path. 5.8's "one object" is the domain/wire object; the columns are its storage. (4) **Migration step 8, forward-only** [FIXED (owner-delegated)]: the `Migration` entry gains a `data` hook for the height backfill; the `wall` table is rebuilt and the legacy `kind` column is **dropped** (`kind` is output-only derived); the rebuild is preferred to `ALTER TABLE ... DROP COLUMN` because it must drop `kind` and add six NOT NULL CHECKed columns atomically and SQLite refuses to drop a column named in a CHECK. (5) **Wire** [FIXED (owner-delegated)]: `wall.add`/`wall.update` carry `thickness`, `position`, `height`, `label` and the switches; a preset XOR raw switches, raw switches patch only what is present, a preset replaces the whole switch set, and a preset never implies geometry; `wall.update` stays absolute and `door.set` unchanged; add, update and the M6 UVTT importer share one expand-and-validate path; `walls`/`wall` gain `height` and keep the derived `kind`. (6) **`proto` 2** [FIXED (owner decision)]: the input `kind` disappears and an old client's `{"kind":"door"}` would silently create a solid wall, so the version goes up with a 6.2 changelog line; `marker` is the one new server message. (7) **The `marker` message** [FIXED (owner-delegated)]: `{full:bool, set:[{id,pos}], del:[id]}`, mirroring `encountered`; `pos` is the drawn midpoint in integer px; `id` is an opaque per-player 12-character string, never the wall id; emission needs `player_marker` on **and** the wall deriving `window`; the full set goes after `explored` in the 6.3 player order; the GM never receives marker frames (a player's markers are their own memory, like explored); storage is `marker_seen` with cascades on player and wall (and through the scene via the wall). (8) **Label NULL** [FIXED (owner-delegated)]: `label` and `height` are written as SQL literals (`NULL` when absent) by one helper, because db_connector cannot bind NULL and neither `''` nor `0` is a legal value, unlike `encountered.actual_name`'s `''`. (9) **UVTT importer** [FIXED (owner-delegated)]: `thickness 0`, `center`, both blocks on, `sight_dir both`, `player_marker` false, no label/height; a portal is `door:true, open = not closed`; recorded in 6.1/8, no ticket. (10) **Oracles and tests**: `BannedAlways` gains every wall field name and `marker` joins the allowed types; the marker oracle's shape is fixed; the migration gets a schema-7 fixture, the mapping assertions and a byte-identical behaviour gate against a freshly built scene (10.3). See 3.1, 4.4, 5.7, 5.8, 5.9, 5.10, 6.1, 6.2, 6.3, 8, 10.3.
Owner also decided 2026-11-17 [FIXED (owner decision), 2026-11-17, after review of `docs/ANALYSIS.md`; review in `docs/ANALYSIS-review.md`]: four decisions and one process note. (1) **Build order**: thick walls (5.10, #45/#50) and wall/token heights with see-over (5.7, 5.9, #41/#44) stay FIXED design but are **built after the first playable M4 client and a phone playtest**; the v1-first build is thin walls with the 5.8 switches, doors, secret/locked, windows, one-way and player markers; the #49 schema lands complete now with `thickness 0`, `position center`, `height NULL` defaults, so the later build needs no migration. (2) **Split DESIGN.md before `/to-spec`**: a short current spec, ADRs in `docs/adr/`, and history out to their own file; tracking issue "Design doc split: current spec + ADRs + history". (3) **Minimum zoom 0.5** for players in v1, which bounds tile requests (about 1.3k at 0.5, about 5k at 0.25); a per-player explored-masked overview image is possible later, not v1. (4) **Walls-sourced statuses accepted**: a player seeing `stuck`/`squeezed` source `walls` is an accepted, documented effect, not a leak to fix; leak note 6 is closed because a refused move already reveals the same fact. Technical, owner-delegated: "close a slow client when lag exceeds a bound" is superseded by **stop feeding on Pong lag and full resync on recovery**; only nginx proxy timeouts close a dead peer (4.3). See 1, 4.3, 5.5, 5.10, 6.1, 6.5, 7.4, 13.