From b4bddf1d52dbe45e8dc643c065d3c8115165aa72 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sun, 15 Nov 2026 14:26:23 +0100 Subject: [PATCH] design: record the #27-#31 rules and the measured egress numbers (#27-#31) 6.1: a link patch hands the token's names over; the encountered snapshot is written by one path in both stores, and a reveal is scoped to its player. 4.3: egress borrows (never copies) under the lock, and the scene is a value swapped under the lock that each request reads once. 10.3: STALE_NAME is a leakcheck class. 14: the five fixes, their tests and mutations, with the before/after egress measurements (context build 4.87 ms -> 0.008 us at 262144 cells; GM egress 142.8 ms -> 0.80 ms). Doc bumped to v0.20. --- docs/DESIGN.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 0711f10..04bb158 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -1,6 +1,6 @@ # FFF_vtt design -Status: draft v0.19, 2026-11-15 (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. All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN). Audience: the owner and coding agents. +Status: draft v0.20, 2026-11-15 (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. 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. @@ -222,6 +222,8 @@ Second limitation [INFERRED]: a fast drag sampled at ~50 ms can produce a straig - Forking mummy (per-socket depth, forced close) is fallback only, not planned. - `WebSocket` **does** have generic field-wise `==` and `hash` at the pin (fields `server`, `clientSocket`, `clientId`; Nim 2.2 stdlib) [MEASURED reading, `docs/research/q13-mummy-slow-clients.md`, Corrections]. The earlier "no `==`/hash, keyed by raw bytes" note is stale. Prototype keys connections by the raw bytes of the ref (`key(ws)`), flagged as shortcut. Real build: assign an app `connId` at upgrade and key the outbox table by `connId`, not by `WebSocket` [PROPOSED, per Q13 research]; add a test that fails if mummy's `WebSocket` fields change (the pin makes this stable, the test makes it explicit) [PROPOSED]. - Handler discipline: no blocking I/O under the lock except the one SQLite COMMIT; no logging formatting of large structures under the lock; metrics are O(1) updates (section 11). +- **Borrow, do not copy, under the lock** (#28): the egress reads the live tables through `views.Context`, six pointers into the `App`, because a per-mutation copy of `visions` costs a whole explored `HashSet` per player (~4.9 ms at 262144 cells on the review build, measured). Nothing that egress holds may outlive the lock hold. +- **The scene is a value swapped, never mutated, under the lock** (#31): every reader takes one snapshot under `dbLock` and uses it for the whole request — `tileGate` (parse, explored check and `X-Accel-Redirect` from one record), `checkScene` (the id), the wall/door handlers (the post-lock log and effect frame). A handler that reads `app.scene` twice can see two records; one that reads it outside the lock races the assignment and ORC's free of the old `walls`. - SQLite tail: server worst ~20 ms is the COMMIT (WAL autocheckpoint / OS scheduling [INFERRED]) and every other mutation queues behind it as `lock_wait` (`results/spike/investigation.md`). Accepted for v1. Moving persist out of the lock breaks ack-after-commit and order; not done. - 583 ms intent->ack outlier: **not reproduced**, cause undetermined (host stall or node harness pause; not proven either way, `results/spike/investigation.md`). Production logging (section 11) must make a recurrence diagnosable (SLOW lines with breakdown). @@ -437,12 +439,13 @@ Validation for `wall.*`: `a != b`, both in bounds, `kind` in `wall|door`, `flags - `character.create` takes `descriptive_name`, `actual_name` (the 6.5 text rule, 1..64 code points), an optional `owner` (a player id, default the GM's own) and optional `props`; a missing name, an unknown prop bucket or a mistyped field is `invalid`, an owner player that does not exist is `not-found`. - `character.update` patches `descriptive_name`/`actual_name` only, at least one of them; `props` is an unknown field there (6.2) and so cannot smuggle a bucket past `prop.*`. - `character.remove` answers `in-use` while any token links the character (6.5). `character.reassign` takes an existing player id and **never** touches a token's controller (3.1, 8); it also keeps every reveal (8: reveals are not revoked by an owner change). +- **A link is a name handover** (#29): `token.update {id, character_id: }` with no names drops the token's own `descriptive_name`/`actual_name` as part of the link patch, because a linked token carries no names of its own. Supplying names alongside a link stays `invalid`, and unlinking still requires both names on the same patch. Without this a plain token could never be linked by update: validation requires a linked token to have empty names, while the patch kept the plain token's own. - `name.reveal` / `name.reveal_all` carry `subject:"character"|"token"` and the subject id; a token that has a character is `invalid` (reveal through the character, 6.1), an unknown subject or player is `not-found`. A reveal writes one `(player, subject)` row; `reveal_all` writes the subject's `reveal_all` flag instead, so it covers players who join later and is idempotent. There is no un-reveal (8). - `encountered.remove` takes `player` and a token id; a missing player and a missing entry are both `not-found`. - **The name rule lives once** (`characters.knowsActual` + `visibleName`): a player is told a subject's actual name when the subject is a character they own, when `reveal_all` is set, or when the GM revealed it to them. The token frame, the character frame and every `encountered.name` call it; nothing else re-derives it. - **`token` frames** gain `character_id` (string for a joined token, `null` for a plain one) **to the GM only**, plus `character_id` for a player who *owns* that character (6.1 leak note 2), and `cprops:{public:{…}}` — the character's `public` bucket for a player who sees a token of a character they do not own, `{}` for a plain token and for the owner, always present so its presence marks nothing (6.1 leak note 3). The GM frame of a linked token carries no `descriptive_name`/`actual_name`/`reveal_all`/`revealed`: those live on the character record. A plain token keeps all four. - **A token's wire `name`** is `visibleName` of its subject: the character's names when linked, its own when plain. It is no longer always the descriptive name (that was slice 5's placeholder, 6.1 "Names"). -- **`encountered`** is per player and is recorded when a token enters that player's view (main.recordEncounters, before the ack, NORMAL durability like explored): one row per `(player, token)` holding the names that player knows *at that moment*, `grey` = the token is not in that player's view now (moved, removed, or `gm_only`) and never deletes it. `character.update` and a plain-token rename follow the snapshots; `name.reveal`/`reveal_all` fill in the actual name. On a diff the message carries only the entries that changed plus a `del` list (the only way an entry disappears is `encountered.remove`); on connect/resync it is `full:true`. +- **`encountered`** is per player and is recorded when a token enters that player's view (main.recordEncounters, before the ack, NORMAL durability like explored): one row per `(player, token)` holding the names that player knows *at that moment*, `grey` = the token is not in that player's view now (moved, removed, or `gm_only`) and never deletes it. **One rewrite path** (`characters.rewriteEncountered`) updates the SQLite row and the live in-memory entry together for `character.update`, a plain-token rename, a link change and an owner change, applying the 8 name rule per player, so the wire and a post-restart reload cannot disagree (#30). `name.reveal` rewrites exactly the revealed player's snapshot and `name.reveal_all` every player's (#27). On a diff the message carries only the entries that changed plus a `del` list (the only way an entry disappears is `encountered.remove`); on connect/resync it is `full:true`. - **`roster`** is sent on connect (first, 6.3), after `player.setname`/`player.rename`, and after `key.create`/`key.replace`/`player.remove`: the full list every time, `connected` = that player has a live connection. Players receive named players only (6.1 leak note 4); the GM receives every player with `name:null` for an unused key. - **`player.setname`** is a normalise-then-store intent (trim, then 6.5): `invalid` for a name that is empty or has a control character or exceeds 32 code points, `name-taken` regardless of case ("GM" included: it is an ordinary name in the `player` table), `not-allowed` for the GM, for a player that is already named, or for an unknown player. On success every connection of that player gets `hello` again with `me.name`, then the full resync, and everyone gets `roster`. - **`player.rename`** (G) takes `id` + `name` and answers `invalid`, `not-found`, `name-taken`; the whole table is in 6.1. **`key.show`** (G) answers `{key}` with the stored plaintext secret (Q11) and refuses the GM's own key with `not-allowed` (CLI only, 3.2). @@ -717,7 +720,7 @@ Principles carried from the prototype: the checker must be independent of the co - Leak checker oracle initially only checked "nothing extra", not "everything visible shows"; completeness check is kept (assert (b)). ### 10.3 New -- **Fault classes** for new data: `GMONLY_TOKEN`, `OWNER_PROP`, `GM_PROP`, `GLOBAL_COUNTER` (gseq side channel), `WALL_DELTA` (wall.add reaches player), `KEY_IN_LOG`, `CHAR_OWNER_PROP`, `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE` (#14). Each with an injected fault and exact-class assertion, same as existing. **Slice 5 built** the classes that exist at this slice: `HIDDEN_TOKEN`, `GMONLY_TOKEN`, `WALLDATA`, `WITHHELD`, `NO_REMOVE`, `OWN_VIEW`, `OTHER_PLAYER`, `EXPLORED` (`-d:leakfault` + `LEAK_FAULT=`, `tools/fault.test.mjs`, exact class set per fault, and the shipped binary asserted to contain no `LEAK_FAULT`). `OWNER_PROP`, `GM_PROP` and the new `STATUS_SOURCE` arrive with slice 7 (#22): the leak scenario writes props into all three buckets and sets a GM-sourced status on a token the subject can see, and `tools/leakcheck.nim` refuses the `gm` bucket, the `owner` bucket on a non-controller and any `source` on a player status entry. `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE` and `CHAR_OWNER_PROP` **arrive with slice 8 (#23)**: the leak scenario creates a character, puts a token of it next to the subject, writes the character's three prop buckets, renames it, reveals it to one player and to all, reassigns it twice, reveals a plain token, flips a `gm_only` token that the subject had met, removes a token the subject had met and removes one encountered entry. `tools/leakcheck.nim` adds the four classes: an actual name a player may not see in a `token` or an `encountered` frame (`ACTUAL_NAME`); another player's `character` record, a `character_id` on somebody else's token, or an encountered entry the subject never saw (`CHAR_LIST`); a token controller that moved in a group whose intents asked for no controller change — the transcript logs every intent, so `token.create`/`token.update{controller}`/`player.remove` are the only allowed causes (`CONTROLLER_CHANGE`); a `cprops` object carrying anything but the character's `public` bucket (`CHAR_OWNER_PROP`). Two consequences worth recording: the `hidden` and `gmOnly` faults now also produce `NO_REMOVE`, because a leaked token whose frame never changes leaves the client holding it with no message to correct it, which is indistinguishable from a withheld `token_gone` at the client (both invariants really are broken, so both classes are asserted); and the tile gate is HTTP-plane, so it is proven by `tools/tiles.test.mjs` against the test nginx (10.3 Tiles), not by the WS transcript checker. `GLOBAL_COUNTER` is already structurally impossible (per-connection `n`). +- **Fault classes** for new data: `GMONLY_TOKEN`, `OWNER_PROP`, `GM_PROP`, `GLOBAL_COUNTER` (gseq side channel), `WALL_DELTA` (wall.add reaches player), `KEY_IN_LOG`, `CHAR_OWNER_PROP`, `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE` (#14). Each with an injected fault and exact-class assertion, same as existing. **Slice 5 built** the classes that exist at this slice: `HIDDEN_TOKEN`, `GMONLY_TOKEN`, `WALLDATA`, `WITHHELD`, `NO_REMOVE`, `OWN_VIEW`, `OTHER_PLAYER`, `EXPLORED` (`-d:leakfault` + `LEAK_FAULT=`, `tools/fault.test.mjs`, exact class set per fault, and the shipped binary asserted to contain no `LEAK_FAULT`). `OWNER_PROP`, `GM_PROP` and the new `STATUS_SOURCE` arrive with slice 7 (#22): the leak scenario writes props into all three buckets and sets a GM-sourced status on a token the subject can see, and `tools/leakcheck.nim` refuses the `gm` bucket, the `owner` bucket on a non-controller and any `source` on a player status entry. `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE` and `CHAR_OWNER_PROP` **arrive with slice 8 (#23)**: the leak scenario creates a character, puts a token of it next to the subject, writes the character's three prop buckets, renames it, reveals it to one player and to all, reassigns it twice, reveals a plain token, flips a `gm_only` token that the subject had met, removes a token the subject had met and removes one encountered entry. `tools/leakcheck.nim` adds the four classes: an actual name a player may not see in a `token` or an `encountered` frame (`ACTUAL_NAME`), plus `STALE_NAME` (v0.20, #30: an encountered entry whose name is neither the actual nor the descriptive name that player knows, e.g. a snapshot a rename failed to update); another player's `character` record, a `character_id` on somebody else's token, or an encountered entry the subject never saw (`CHAR_LIST`); a token controller that moved in a group whose intents asked for no controller change — the transcript logs every intent, so `token.create`/`token.update{controller}`/`player.remove` are the only allowed causes (`CONTROLLER_CHANGE`); a `cprops` object carrying anything but the character's `public` bucket (`CHAR_OWNER_PROP`). Two consequences worth recording: the `hidden` and `gmOnly` faults now also produce `NO_REMOVE`, because a leaked token whose frame never changes leaves the client holding it with no message to correct it, which is indistinguishable from a withheld `token_gone` at the client (both invariants really are broken, so both classes are asserted); and the tile gate is HTTP-plane, so it is proven by `tools/tiles.test.mjs` against the test nginx (10.3 Tiles), not by the WS transcript checker. `GLOBAL_COUNTER` is already structurally impossible (per-connection `n`). - **Characters and names (#14)**: tests for reveal per player and reveal to all; owner sees own actual name; character owner change leaves token controllers unchanged; encountered entries survive token removal and scene change and are removed only by the GM; `gm_only` tokens never enter an encountered list. Fault classes: `ACTUAL_NAME` = unrevealed actual name sent to a player; `CHAR_LIST` = another player's character or encountered entry sent; `CONTROLLER_CHANGE` = owner change altering controllers; `CHAR_OWNER_PROP` = character owner-bucket prop sent to a non-owner. **Built in slice 8** as the `tools/characters.test.mjs` group, which also carries the two checks 10.3 was missing: "a status source is not shown to a non-GM" (the controller included) and "an encountered entry survives a `gm_only` flip and a token removal" (greyed, never deleted). - **Tiles (#24)**: `tools/tiles.test.mjs` is the group's leak check (d) and the smoke tile-steal checks, through the real binary and a test nginx (`tools/nginx.mjs`, nginx from devbox; config generated per run in the state dir). An **independent explored oracle** (born in 10.2) recomputes visibility per cell from the GM's walls and the token's vision radius with its own clear-segment maths (inscribed 64-gon radius - 0.5 px for "sure", radius + 0.5 px and proper crossings for "maybe"): a `200` must be oracle-maybe (no invented disclosure) and oracle-sure must be `200` (no withheld tile). The 32x32-tile sweep is 1024 requests; slice 9's scene allows 283, all 283 oracle-sure, 0 maybe-refused. Also checked: a player with no sight state gets `403`; another player gets `403` on a tile its neighbour sees; direct `/_tiles/` is `404` (the file exists) for every identity; malformed/canonical/out-of-range/stale-version/scene paths are `404` (with and without a session, including the GM); traversal and encoded shapes never reach a file; the direct-from-Nim answer carries `X-Accel-Redirect: /_tiles/1/v1/_.png`, `Cache-Control: private` and an empty body. Fixture tiles are 32 px PNGs written by `tools/tilefixture.mjs` under the state dir at test time; the test asserts the repo tracks no `.png` at all. - **Probing test (T8)**: M2, in-process against the move-rules module (5.5): arbitrary far moves; assertion: facts about walls/doors beyond LOS recoverable from replies <= a bounded amount (step cap), and uniform nack shape. M3: same test over WS with a hostile client (moved from M2). @@ -924,6 +927,8 @@ Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #23)]: charac Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #21)]: explored persistence (M3 slice 6). Schema is migration step 5 (`explored`): `explored_chunk` keyed by `(player_id, scene_id, cx, cy)` with a 512-byte blob, both FKs cascading (4.4). Chunk format and size are fixed at 64x64 cells = 512 B, row-major LSB-first bits, `(cx, cy)` = chunk coordinates; the layout is pinned by tests and re-read independently by the Node harness. **Write timing**: a mutation writes only the chunks its refresh dirtied, each encoded from the whole explored set, with `NORMAL` durability; a move writes position and chunks in one transaction, a GM authoring write adds a second `NORMAL` chunk transaction under the same lock, both before the ack — the two commits are deliberately not atomic with each other, and the only loss they can cause after a crash is cells no client was acked about, which the next refresh re-adds. Measured: 0.015 ms avg / 0.035 ms p99 per chunk write, 0.7 ms avg / 1-2 ms p99 per move ack (4.3's budget is untouched). **Load**: `explored.restore` fills every player's set at startup from the chunk rows and logs `explored_loaded players= chunks=`; polygons stay recomputed (8). **Tests** (10.1, 10.3): `tests/texplored.nim` (format, whole-chunk encoding, upsert replacement, per-player keying, restore, cost) and `tools/persistence.test.mjs` (fresh-resync round trip, per-player isolation, SIGTERM and SIGKILL restart equality, wall-removal cells surviving after the wall returns, chunk rows decoded independently, move-ack timing, and a schema-4 fixture DB migrated by the real binary). Mutations ag-al pin the bit layout, the chunk coordinate, the restore, the per-player key, the upsert and the dirty-chunk dedupe. See 4.4, 8, 10.3. +Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #27-#31)]: five M3 correctness and cost fixes found by review, all owner-authorized to land on `main` with a regression test each. (1) **`name.reveal` is per player on disk too** (#27): the persisted snapshot write took only the subject, so every player who had met the subject got the actual name in their `encountered` row and saw it only after a restart; the write is now scoped by `player_id` and a reveal to one player changes exactly one row. `name.reveal_all` keeps all-players scope through the same helper. (2) **`token.update {character_id}` links a plain token** (#29): the link patch now drops the token's own two names, so the candidate satisfies `validToken`; names supplied *with* a link stay `invalid`, unlinking still needs both names (6.1). (3) **One encountered rewrite path** (#30): `characters.rewriteEncountered` takes the subject's `SubjectNames` plus the reveal set and rewrites every matching snapshot in SQLite *and* in `app.encountered` from the 8 name rule, so a rename, a link change and an owner change reach the live list immediately and the DB never disagrees with the wire. The old DB-only `renameEncountered*`/`revealEncountered*` helpers are gone, which is what let the two stores drift. (4) **Egress borrows the world** (#28): `views.Context` now holds six pointers (`contextOf`/`borrow`) instead of owning copies of `scene`, `tokens`, `characters`, `reveals`, `encountered` and `visions`, `playerView`/`gmView` read a `ptr PlayerVision` instead of `getOrDefault`, and a view computes each player's visible-id set once per frame so `grey` is a set test rather than a token scan plus a `PlayerVision` copy per encountered entry. Measured on this build's types (debug, 6 players, 40 encountered entries, 40 world tokens): context construction 0.227 ms / 4.87 ms at 16384 / 262144 explored cells before, 0.008 us after; one `getOrDefault` of a `PlayerVision` 28.8 us / 591 us before (gone); a GM egress pass 8.0 ms / 142.8 ms before, 0.79 ms / 0.80 ms after; a player pass 1.45 ms / 25.7 ms before, 0.32 ms after. Behaviour is unchanged and pinned by `tests/tviews.nim` (identity: a borrow sees a later in-place mutation; six pointers, no container; both sizes inside the M5 7.5 ms budget) plus the unchanged leak/fault suites. (5) **One scene read per request** (#31): `tileGate` reads `app.scene` once under `dbLock` and uses that local for the URL parse, the explored check and the redirect; `checkScene` reads the scene id under the lock; `scene.set` patches under the lock; the wall/door handlers capture `sceneId` inside their lock for the log and the effect frame. `tests/ttiles.nim` pins that one record gives one whole answer, and `tools/tiles.test.mjs` pins the handler shape (source scan) and interleaves 20 `scene.set` + wall edits with 200 tile fetches (only whole tiles, no crash). **Tests added**: `tests/tcharacters.nim` (per-player reveal row, one rewrite path, link handover), `tests/ttokens.nim`-style `patched` unit (in `tcharacters.nim`), `tools/characters.test.mjs` (link via update end to end), `tools/restart.test.mjs` (three named players + per-player reveals across SIGTERM/SIGKILL, with a direct `encountered` row assertion and a name oracle; a mid-session rename for a plain token and a character), `tools/leak.mjs`/`leakcheck.nim` (a second player meets the same subject; `STALE_NAME` pins each entry's expected name), `tests/tviews.nim` and `tests/ttiles.nim` as above. Mutations e1-e3 and the repointed b2 pin the reveal scope, the live snapshot update and the link handover. + Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #25)]: the M3 finish line. `scene.set` is built as the 29th and last catalogue intent; its payload rules are in 6.1 ("Scene payload rules"), with the decision that `hello` also resets the server-side per-connection diff base (otherwise a resync after `hello` would skip state the client just reset). The two missing accept groups are built: **restart** = `tools/restart.test.mjs` (full 6.3 resync equality over SIGTERM and SIGKILL, every CRUD path) and **logs** = `tools/logs.test.mjs` (every key, session cookie and session hash absent from both runs' log, with a `LEAK_FAULT=keylog` negative control). `tools/groups.mjs` + `tools/groups.test.mjs` map the nine groups of 13 to their named proving tests, so the checklist cannot silently go stale. Fixture clean-up (acceptance 5): `tests/fixtures/scene.json` loses the stale `tileSize: 256`, the scene-wide `tokenRadius` (now a fixture constant, the server has per-token radius, #4) and its index token ids (`A`/`M1`); the geometry/corpus fixture keeps its walls, radii and positions. The `blocked` boolean is already gone from code (`stuck`/`squeezed`, #4). **M3 acceptance checklist (all nine groups, `devbox run test`, measured on the final tree):** | # | group (13 M3 Accept) | proving test | status |