# Review of `docs/ANALYSIS.md` Reviewed by the owner with the agent on 2026-11-17, against `main` at `287859d` (after #49/#50). `docs/ANALYSIS.md` was written against `409d2c8` / DESIGN v0.27 and is kept unchanged. This file records the decisions, the corrections to the analysis, and the technical items adopted into the build list. ## 1. Owner decisions (FIXED, 2026-11-17) ### D1 - Build order: playable M4 first; walls/height logic after the playtest Thick walls (#45/#50) and wall/token heights + see-over (#41/#44) stay **FIXED design** and are not cut. They 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 still lands **complete now**: `thickness`, `position` and `height` columns with "as today" defaults (`0`, `center`, `NULL`) and the #49 migration. The later build therefore adds behaviour, not a migration. ANALYSIS ref: §1.1, §4.5, §7 item 2. Recorded in DESIGN §1, §13. ### D2 - Split DESIGN.md before `/to-spec` - DONE 2026-11-17 The current spec (`docs/DESIGN.md`), 22 ADRs in `docs/adr/`, and the non-normative history (`docs/DESIGN-history.md`) are split; verification in `docs/research/design-split-check.md`. Tracking issue: #51 "Design doc split: current spec + ADRs + history". ANALYSIS ref: §1.3, §4.6, §7 item 8. ### D3 - Minimum zoom 0.5 for players v1 clamps player zoom-out at 0.5. That bounds the visible tile count (about 1.3k tiles at 0.5, about 5k at 0.25), which is the cheapest bound on phone tile requests. A per-player explored-masked overview image is a **possible later** feature, not v1. ANALYSIS ref: §4.8, §6.6. ### D4 - Walls-sourced `stuck`/`squeezed` visible to players: accepted A player seeing a `walls`-sourced status learns that some blocking wall touches that token. This is an **accepted, documented effect**: a refused move already reveals the same fact through the uniform nack. Leak note 6 (6.1) is **closed as accepted**; no source-free status is added. ANALYSIS ref: §4.7. ## 2. Corrections to ANALYSIS - **§4.5 is stale on #49/#50.** It says #49 (wire/schema/migration) and #50 (thick doors and push) are still open. Both are decided on `main` (#49 in v0.29, #50 in v0.28); thickness, height and the door leaf are settled design. - **§4.5, heights in the polygon: wrong.** Height never enters the sight polygon. DESIGN 5.9 keeps the polygon strict and applies height as a **per-target predicate** (`visibleTo` = `insideAny or predicate`); 5.10 evaluates it at every crossed face. The oracle-burden point (leakcheck needs its own height test, band cells are oracle-*maybe*) stands. - **§4.5, one-way "expensive in the ray fan": overstated/wrong.** #47 chose a per-viewer **sign test on the hoisted, viewer-independent face list** inside the fan: one cross-product sign per one-way wall per viewer, no per-viewer copy, no geometry. #43 measured the filter at +0.15 ms/polygon on 5k sparse (2.8x thin, 0.24 vs 0.08 ms) and 1.1x dense; it is a small inline predicate, not a fan rework. No separate one-way build item is needed. - **§6.2, "near-face variant costs about the same as thin walls [measured]": INCORRECT as applied.** Research §2.2's one-face row (0.174 ms sparse) includes building 5000 offset segments **inside the timed call** and is an approximation that leaves the far half of the band visible-ish; hoisted it is thin-like, but it is not the model DESIGN 5.10 needs. The decided near+caps silhouette has three faces, is observer-dependent and **cannot be hoisted**; `prototype-wall-sight/cost.txt` (branch `prototype/wall-sight`) measures: - 5k sparse: thin 0.083 ms; 3-face silhouette per query **0.699 ms (8.4x)**; 4-face quad per query 0.943 ms (11.3x), hoisted 0.263 ms (3.2x); - 5k dense: thin 1.254 ms; silhouette per query 7.851 ms (6.3x); 4-face quad per query 13.229 ms (10.6x), hoisted 12.721 ms (10.2x). So the near-face route is not thin-priced; the quad is affordable only when hoisted. DESIGN 5.10's citation "0.26 vs 0.94 ms on 5k sparse" compares hoisted vs per-query **4-face quad**; the 3-face silhouette is 0.70 ms. The citation is corrected in 5.10 to name the rows. - **§6.7, thick dense 6-token party 75.6 ms: correct.** Research §2.3: six thick polygons in one dense recompute = 75.6 ms vs 7.7 ms thin [MEASURED, #39] (about 6 x 12.8 ms quad per query vs 6 x 1.28 ms thin). The figure is per-query (not hoisted) and it is the stress layout, as stated. - Everything else checked against the tree (race §4.1, global lock/transactions §4.2, egress §4.4, leakcheck non-independence §4.7, tile count §4.8) still holds at `287859d`. Note that §4.1's quick fix is already in progress on branch `fix/jsonnode-race`. ## 3. Adopted technical items - build list Sizes are S/M/L. "When" uses the owner order: before-M4 / M4 / M5; decisions and later work are marked. | # | Item | Gist | ANALYSIS | Size | When | |---|---|---|---|---|---| | 1 | JsonNode race fix + small fixed `workerThreads` | Own/copy intent JSON before it enters the world; build referencing frames under the lock; pin a small worker pool instead of mummy's `10 x cores`. In progress on `fix/jsonnode-race`. | §4.1, §7.1 | S | before-M4 | | 2 | Circle-segment-per-sector ray test | Each ray tests only the 64-gon segment in its sector; same polygon, same tests. | §4.3, §6.2(1) | S | before-M4 | | 3 | Per-token polygon cache keyed `(pos, range, wallsVersion)` | A move recomputes one token's polygon, not the player's party; wall edits bump the version. | §4.3, §6.2(4) | M | M4 | | 4 | Incremental wall-edit refresh by bbox | Recompute only tokens whose vision circle overlaps the edited wall's bbox. | §4.3, §6.2(5) | S | M4 | | 5 | Angular sweep; keep the old ray fan as oracle | O(n log n) sweep for polygons; the old fan stays in leakcheck as an independent oracle, fixing §4.7's non-independence. | §4.3, §6.2(2-3), §4.7 | M | M5 | | 6 | Session cache + tile gate off the global lock; explored as bitmap | In-memory session table and per-player explored bitmap snapshot; no DB/SHA-256 per tile request; explored is the on-disk bitmap, not a `HashSet`. | §4.2, §4.3, §6.2(7), §6.6 | S/M | before-M4 | | 7 | World thread + group commit | One thread owns all ref-managed state; workers pass plain strings; one SQLite transaction per batch. Removes the race class and the M5 ordering work. | §4.1, §4.2, §6.1 | L | M5 | | 8 | Integer/fixed-point wire coords; per-entity version diffs; affected-recipient egress | Quantised coordinates; diff by versions, not JSON trees; build each frame once and visit only affected recipients. | §4.4, §6.3 | M | M5 | | 9 | Slow client: stop feeding + resync on pong lag | Stop feeding a lagging client and resync from `Known` on recovery; replaces "close when lag exceeds a bound" (impossible at the mummy pin). | §4.3, §6.4, §5 | S | M5 | | 10 | Table-driven intent schema | One field table (name, type, required, range) replaces hand-written validation per intent. | §4.7 | M | M5 | | 11 | Durability: one setting, measure first | Drop the FULL/NORMAL toggle if measurement shows no benefit; one setting for the home server. | §4.7, §5, §6.5 | S | M5 | | 12 | Verify nginx HTTP/2 before the phone gate | HTTP/2 must be live end-to-end before the Note 10 gate; HTTP/1.1 caps six connections per host. | §6.6 | S | before-M4 | | 13 | Thin sqlite3 binding replacing `db_connector` | **PROPOSED.** Prepared-statement cache, real NULL binding, `busy_timeout`, one transaction helper. Touches a [FIXED] stack item, so the owner decides at `/to-spec`. | §4.7, §5, §6.5 | M | at `/to-spec`, if accepted | Related to D3: the 0.5 minimum zoom is client work in M4; the explored-masked overview image is a possible later (post-M5) item and is not on this list. ## 4. Consequence for tickets Build tickets are generated from the split current spec at `/to-spec`, not from this review. Thick walls and heights get build tickets only after the M4 playtest (D1). No issue is created from the build list here; the only new tracker issue is the DESIGN split.