docs: extract DESIGN history (change log, decision log, superseded text)
The v0.4-v0.30 change log, the old §12 HANDOFF table and the whole §14 owner-decision log (Q1-Q24) move here verbatim, with the superseded statements removed from the spec quoted with their surviving rule. Non-normative.
This commit is contained in:
@@ -0,0 +1,910 @@
|
||||
# FFF_vtt design history
|
||||
|
||||
**Not normative.** Nothing in this file is binding. The current rules are in
|
||||
[`docs/DESIGN.md`](DESIGN.md); the reasoning behind the durable decisions is in
|
||||
[`docs/adr/`](adr/). This file preserves, verbatim and for reference only:
|
||||
|
||||
- A. the v0.4-v0.30 change log that used to be the status line of `DESIGN.md`;
|
||||
- B. the HANDOFF traceability table (old DESIGN §12);
|
||||
- C. the dated owner-decision log (old DESIGN §14), Q1-Q24;
|
||||
- D. the superseded statements that were removed from the current spec, with the
|
||||
surviving rule named.
|
||||
|
||||
Split made on 2026-11-17 under issue #51 (`docs/ANALYSIS-review.md` D2). Section
|
||||
numbers cited below are the old DESIGN v0.30 numbers; the current spec keeps the
|
||||
same numbering.
|
||||
|
||||
## A. Change log (old status line, v0.4-v0.30)
|
||||
|
||||
- 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.
|
||||
|
||||
## B. HANDOFF traceability (old DESIGN §12)
|
||||
|
||||
Source: `prototype-server-vision/HANDOFF.md` (and README/NOTES worries). Every
|
||||
row is resolved; the current rules are in the sections each row names.
|
||||
|
||||
<!-- BEGIN old section 12 verbatim -->
|
||||
## 12. HANDOFF items -> decisions / open questions
|
||||
|
||||
Source: `prototype-server-vision/HANDOFF.md` (and README/NOTES worries).
|
||||
|
||||
| # | Item | Decision / open | Milestone |
|
||||
|---|---|---|---|
|
||||
| H1 | Port geometry + tests as-is | Decision: port `geometry.nim`, `tgeometry.nim`, mutation check, leak harness first | M1 |
|
||||
| H2 | Token on a wall can't leave (inclusive `segsCross`); closing a door or editing a wall on a token | Decision [FIXED, Q14; door case revised by owner 2026-11-08]: wall add/edit on a token gives it `stuck` (player moves refused, GM moves allowed); a door closing on a token pushes it aside instead (5.5; `squeezed` only if no side is valid; status names per #4, was `blocked`). Set/Keep/Clear per 5.5: stays while any blocking wall overlaps; clears on wall removal or door open only if no other wall overlaps, on a GM move to a free spot, or on GM clear; GM placements/moves onto a wall set it. Trigger = circle overlap [FIXED, owner]; escape + capsule rule [FIXED, accepted default]; both in 5.5. Pin tests replaced in M2. | M2 |
|
||||
| H3 | O(rays x walls) vision | Decision: radius-bbox cull now; uniform spatial grid over walls only if the 5k-wall bench misses target (5.5) | M2 |
|
||||
| H4 | `cellsTouched` ~12x polygon | Decision: scanline rasterization, differential test vs ported version | M2 |
|
||||
| H5 | Shared-endpoint test gap | Decision: port with a test that fails if either arm is removed; new mutation (d) | M1 |
|
||||
| H6 | Single machine, loopback, power-save timings | Decision: keep as baseline only; real-network run required | M7 |
|
||||
| H7 | Boundary epsilon ambiguity | Decision: keep `RayEps`, 0.5 px tolerance in checkers; documented | M1 |
|
||||
| H8 | Tile leak: whole 256 px tile | Decision [FIXED, Q4]: `tile_size` = explored cell = 32 px; residual leak <= one cell, never revoked; no server masking; M4 gates (headless mobile-emulation + phone run); fallback 64 px per-scene config | M4 |
|
||||
| H9 | Prototype secret = cookie = permanent bearer, no expiry, binds 0.0.0.0, needs HTTPS | Decision: session != key, key replace (GM, live), remove player, log redaction, bind 127.0.0.1, HTTPS via nginx. Sessions never expire; one player key usable across devices (Q10 FIXED); keys plaintext (Q11 FIXED); no key-entry rate limit (owner, #6) | M3 |
|
||||
| H10 | Move collision: centre path + dest circle, not swept circle | Decision: capsule (swept-circle) check + escape rule, 5.5; step cap = effective vision radius, 5.5 (T8) | M2 |
|
||||
| H11 | Leak test explored/tile checks self-consistent | Decision: add independent explored oracle | M2 |
|
||||
| H12 | Full vision polygon (~3 KB) per player move | Decision [FIXED, Q16]: full polygon, integer px, only on change; delta/binary post-v1 | M3 |
|
||||
| H13 | Explored sent whole + one SQLite row per cell | Decision: chunked bitmaps in DB; RLE on connect | M3 |
|
||||
| H14 | No SIGTERM handler | Decision: add; durability independent of it | M5 |
|
||||
| H15 | `synchronous=NORMAL` vs FULL | Decision [FIXED, Q12]: NORMAL; FULL around GM authoring transactions | M3 |
|
||||
| H16 | Timing instrumentation unbounded and under lock | Decision: do not port; ring buffer/histogram, snapshot outside lock | M5 |
|
||||
| H17 | 583 ms spike unexplained | Open: not reproduced; production SLOW logging to catch recurrence | M5/M7 |
|
||||
| H18 | mummy: unbounded send queue, no backpressure | Decision [FIXED (owner decision), Q13]: app-level bounded per-client outbox, coalescing, WS Ping(seq)/Pong lag tracking, stop feeding + full resync; no mummy patch; fork is fallback only (4.3) | M5 |
|
||||
| H19 | `WebSocket` keyed by raw bytes | Decision: app `connId` table (not raw bytes; `WebSocket` has field-wise `==`/hash at pin, Q13 research) + layout test | M3 |
|
||||
| H20 | Fog masks Graphics grow unbounded | Decision: fixed-size baked fog texture (7.3) | M4 |
|
||||
| H21 | Pixi `Text` per token heavy | Decision: BitmapText; glyph set Latin incl. accents + Nerd Font icons (Q17 FIXED) | M4 |
|
||||
| H22 | Browser rendering never verified | Decision: headless browser e2e | M4 |
|
||||
| H23 | Tiles don't update on door change | Decision: by design (static art); doors never part of art | -- |
|
||||
| H24 | Prototype `gmOnly` unused (my finding, not in HANDOFF) | Decision: enforce + fault class | M3 |
|
||||
| H25 | Player-visible `gseq` side channel (my finding) | Decision: per-connection counter | M3 |
|
||||
| H26 | Move-validation wall-probing oracle (my finding) | Decision: step cap + rate limit + uniform nack + test (in-process M2, over WS M3; 5.5) | M2/M3 |
|
||||
|
||||
---
|
||||
|
||||
<!-- END old section 12 -->
|
||||
|
||||
## C. Dated owner-decision log (old DESIGN §14)
|
||||
|
||||
<!-- BEGIN old section 14 verbatim -->
|
||||
## 14. Open questions for the owner
|
||||
|
||||
1. Q1 - Table size and device mix: how many players max, and which devices (phones, tablets, iOS)?
|
||||
Drives iOS testing priority and token/message budgets. **RESOLVED [FIXED (owner decision),
|
||||
2026-11-08]:** devices are phones, tablets and laptops. Max players: 6 [FIXED, owner decision
|
||||
2026-11-08] (section 1). Connection cap 8 (6 players + GM + headroom) stays [PROPOSED] (sections
|
||||
4.3, 13).
|
||||
2. Q2 - Largest map you plan to use (px), and typical wall count per scene? Drives tile size,
|
||||
spatial grid priority and explored chunking. **DEFERRED [FIXED (owner decision), 2026-11-08]:**
|
||||
owner does not know yet. 16384 px map and 5k walls stay [PROPOSED] test targets; revisit with real
|
||||
maps.
|
||||
3. Q3 - Multiple scenes in v1 (GM switches the active scene, per-scene explored grids), or exactly
|
||||
one scene per table to start? **RESOLVED [FIXED (owner decision), 2026-11-08]:** exactly one scene
|
||||
in v1; schema may stay `scene_id`-keyed.
|
||||
4. Q4 - Tile-edge leak: accept as documented, or reduce it (smaller tiles = more requests; gate
|
||||
tiles only when explored cells cover a minimum fraction; or server-side masked tiles at the cost
|
||||
of image processing in Nim)? What detail do you paint in map art that must stay secret? **RESOLVED
|
||||
[FIXED (owner decision), 2026-11-08]:** `tile_size` = explored cell size = 32 px. Residual leak is
|
||||
at most one cell, never revoked; no server-side masking. Authoring rule shrinks from ~256 px to
|
||||
~32 px. M4 acceptance: (a) headless mobile-emulation test on the real server path, (b) one manual
|
||||
phone run; fallback 64 px (per-scene config). Evidence: `prototype-tile-leak/README.md`. Applied
|
||||
in 3.3, 3.4 (T5), 8, 12 (H8), 13 (M4, M6).
|
||||
5. Q5 - Map import: CLI-only for v1, or upload + tiling from the browser (GM) from the start?
|
||||
**RESOLVED [FIXED (owner decision), 2026-11-08]:** map import is CLI-only in v1; browser upload is
|
||||
post-v1.
|
||||
6. Q6 - Wall/door authoring: is an in-browser GM wall editor required in v1 (no generator feeds in),
|
||||
or is hand-edited/imported wall data acceptable at first? What other wall kinds are needed soon
|
||||
(windows, one-way, secret doors, locked doors)? **RESOLVED [FIXED (owner decision), 2026-11-08]:**
|
||||
in-browser GM wall editor in v1; wall kinds `wall` and `door` only. **Kind set SUPERSEDED [FIXED
|
||||
(owner decision), 2026-11-15, #42]** by 5.8: a wall's behaviour is independent switches and named
|
||||
kinds are presets; v1 presets are `wall`, `door`, `secret door`, `locked door`, `terrain` and
|
||||
`one-way wall`, and `window` was added by #47 (2026-11-16) as a see-through opening, its fixed
|
||||
form being `terrain`. **Preset list SUPERSEDED AGAIN [FIXED (owner decision), 2026-11-16, #48]:**
|
||||
there are four presets (`wall`, `door`, `window`, `one-way`), `secret` and `locked` are checkboxes
|
||||
on any door rather than presets, and `terrain` is dropped entirely (the name, the preset and the
|
||||
kind); the derived kinds are `wall`, `door`, `window`, `one_way`, `custom`. The editor requirement
|
||||
is unchanged.
|
||||
7. Q7 - Vision model: single radius per token or per-token property from day one? Is any
|
||||
"darkvision/light" concept needed before FFF? **RESOLVED [FIXED (owner decision), 2026-11-08]:**
|
||||
per-entity numeric `vision_radius` plus scene default; no light sources or darkvision.
|
||||
8. Q8 - Which "table convenience" features come first after v1, if any: freehand drawing (exists in
|
||||
the perf prototype), pings, ruler, chat, dice, token images/portraits, initiative tracker?
|
||||
**DEFERRED [FIXED (owner decision), 2026-11-08]:** decided at M7.
|
||||
9. Q9 - Should players see each other's names/presence, and should party members share vision
|
||||
(shared explored/LOS) or is it strictly per player? **RESOLVED [FIXED (owner decision),
|
||||
2026-11-08]:** vision and explored strictly per player; player names visible to all.
|
||||
10. Q10 - Session lifetime and invite policy: session expiry, how often invites rotate, single-use
|
||||
vs reusable invite links, can one player use multiple devices at once? **RESOLVED [FIXED (owner
|
||||
decision), 2026-11-08]:** sessions never expire; one player key is usable on multiple devices
|
||||
(wording amended #6: was invite link).
|
||||
11. Q11 - Invite secrets: stored hashed (shown once, GM regenerates to re-share) or stored plaintext
|
||||
so the GM can re-copy a link? **RESOLVED [FIXED (owner decision), 2026-11-08]:** player and GM key
|
||||
secrets stored plaintext so the GM can re-show them (wording amended #6: was invite secrets).
|
||||
12. Q12 - Durability: is `synchronous=NORMAL` (can lose the last few commits on power loss/OS crash,
|
||||
never corrupts) acceptable, or should it be FULL for some or all writes? **RESOLVED [FIXED (owner
|
||||
decision), 2026-11-08]:** `synchronous=NORMAL`; `FULL` around GM authoring transactions.
|
||||
13. Q13 - Slow/dead client policy: acceptable to disconnect clients that fall behind? Willing to
|
||||
patch/fork the pinned mummy commit if per-socket queue depth cannot be read from outside?
|
||||
**RESOLVED [FIXED (owner decision), 2026-11-08]:** option A: app-level bounded per-client outbox,
|
||||
latest-state-wins coalescing per key (MQTT-retained-like), diff at flush time, server
|
||||
Ping(seq)/Pong ack tracking for lag, stop feeding lagging clients + full resync on recovery; no
|
||||
mummy patch. Dead/stuck peers closed by nginx proxy timeouts (mechanism PROPOSED; verify WS goes
|
||||
through nginx in M5). Fork of mummy (option B) is fallback only, not planned. Research:
|
||||
`docs/research/q13-mummy-slow-clients.md`; detail in 4.3.
|
||||
14. Q14 - Moving tokens when walls change: what should happen if the GM closes a door (or edits a
|
||||
wall) on top of a token? Allow the token to walk out, auto-nudge it, or refuse the edit?
|
||||
**RESOLVED [FIXED (owner decision), 2026-11-08]:** a GM edit that lands on a token gives it status
|
||||
`blocked`: server refuses that token's player moves; GM can still move it; status clears when the
|
||||
wall is removed or the door opened, or when the GM clears it. **Door case revised [FIXED (owner
|
||||
decision), 2026-11-08]:** spell walls and wall edits stay stuck; a door closing on a token pushes
|
||||
the token aside (5.5), stuck only if neither side is valid. Status names superseded by #4
|
||||
(2026-11-10): `blocked` is now `stuck`/`squeezed` (5.5); door-push failure is `squeezed`.
|
||||
15. Q15 - Reconnect: is a full resync on every reconnect fine up to what explored/state size, or do
|
||||
you want `resume since N` later? **RESOLVED [FIXED (owner decision), 2026-11-08]:** full resync on
|
||||
every reconnect; revisit if a measured snapshot exceeds ~100 KB.
|
||||
16. Q16 - Vision payload: OK with full polygon per move (~3.4-3.7 KB per mover delivery, measured on
|
||||
loopback) for v1, or do you want deltas/binary earlier (e.g. for mobile data plans)? **RESOLVED
|
||||
[FIXED (owner decision), 2026-11-08]:** full vision polygon, integer px, sent only on change;
|
||||
deltas post-v1.
|
||||
17. Q17 - Names/labels: which character sets must labels support (Latin only, accents, non-Latin,
|
||||
emoji)? Affects BitmapText glyph atlas vs Text/HTMLText. **RESOLVED [FIXED (owner decision),
|
||||
2026-11-08]:** labels in Latin incl. accented characters plus Nerd Font icon glyphs.
|
||||
18. Q18 - Grid and movement: snap to grid on drop? Any server-side speed/distance limit per move,
|
||||
given there are no rules yet? **RESOLVED [FIXED (owner decision), 2026-11-08]:** grid snap off by
|
||||
default (client option); server step cap = token vision radius.
|
||||
19. Q19 - FFF engine: implementation language/runtime, current maturity, and whether it should run
|
||||
inside the VTT server process, as a sidecar, or in the browser for display only? Does it need
|
||||
hidden/secret state beyond the three property buckets (public / owner / GM)? **RESOLVED for hidden
|
||||
state [FIXED (owner decision), 2026-11-08]:** no hidden state beyond the `public`/`owner`/`gm`
|
||||
buckets and `gm_only` flag in v1; revisit when FFF starts (schema change accepted then). Engine
|
||||
language, runtime and location: **DEFERRED** to FFF start (section 9 options a/b/c; no decision
|
||||
now).
|
||||
20. Q20 - Nix packaging: how do you want the Nim server built (nimble lock + `buildNimPackage` or a
|
||||
vendored deps approach), and which repo hosts the NixOS module (this repo or your
|
||||
nixos-configuration repo)? **RESOLVED [FIXED (owner decision), 2026-11-08]:** `buildNimPackage`
|
||||
with a committed `nix/lock.json` (`nim_lk` JSON lock). `nix/package.nix` and `nix/module.nix`
|
||||
(`services.fffVtt`) live in this repo and are imported from the owner's server NixOS config, like
|
||||
`foundryvtt.nix`. nixpkgs input pinned to match devbox Nim (2.2.12). Fallback: vendored deps if
|
||||
`nim_lk` cannot resolve the mummy pin. `nix/` un-ignored in `.gitignore` when M6 starts, not now.
|
||||
mummy pinned to tag `0.4.8` (same `src/` as `01deb1ff`). Research:
|
||||
`docs/research/q20-nix-packaging.md`; detail in 11.1.
|
||||
21. Q21 - Backups: where should off-box backups go (existing mechanism on the server?), and how many
|
||||
dated copies to keep? **RESOLVED [FIXED (owner decision), 2026-11-08]:** v1 backups go to a backup
|
||||
folder the server creates under its data root; off-box backups out of v1 scope.
|
||||
22. Q22 - Observability: journald lines only, or also an internal metrics endpoint scraped by
|
||||
something you run? **RESOLVED [FIXED (owner decision), 2026-11-08]:** journald lines only;
|
||||
`/healthz` stays.
|
||||
23. Q23 - Public exposure: reachable from the internet (domain, rate-limiting, fail2ban
|
||||
expectations) or LAN/VPN only? **RESOLVED [FIXED (owner decision), 2026-11-08]:** network exposure
|
||||
and access are out of project scope (owner handles reachability). Built-in protections stay
|
||||
(127.0.0.1 bind, connection cap, frame/rate limits, Origin check); internet-only hardening
|
||||
(fail2ban etc.) not in scope.
|
||||
24. Q24 - Repo conventions: should this design live in `docs/DESIGN.md` plus ADRs under `docs/adr/`
|
||||
and a `GLOSSARY.md` (AGENTS.md references both, neither exists yet)? Should prototypes remain
|
||||
in-tree or move to an archive branch once ported? **RESOLVED [FIXED (owner decision),
|
||||
2026-11-08]:** `GLOSSARY.md` and `docs/adr/` per AGENTS.md; prototypes stay in-tree until the M4
|
||||
client port, then archived.
|
||||
|
||||
Owner also decided 2026-11-08 [FIXED (owner decision)]: restore drill belongs in M6 (sections 11.2,
|
||||
13).
|
||||
|
||||
Owner also decided 2026-11-08 (M2): move rules, `blocked` trigger and GM move bypass are recorded in
|
||||
5.5; M2 scope and accept criteria in 13.
|
||||
|
||||
Owner also decided 2026-11-10 [FIXED (owner decision), #14]: characters are separate records from
|
||||
tokens (one owner: a player or the GM; a token may link to one character; token controller is
|
||||
independent of the character owner); character holds identity, token holds the state of the figure;
|
||||
descriptive and actual names, revealed per player or to all; per-player encountered list, persisted,
|
||||
removed only by the GM; storage on the server only (SQLite). Character export/import as a file is
|
||||
future, not M3. See 3.1, 4.4, 8.
|
||||
|
||||
Owner also decided 2026-11-10 [FIXED (owner decision), #6]: one shared site link (alone it shows
|
||||
only the sign-in page); each player has a personal player key, generated by the GM with no name,
|
||||
identifying the player and granting access to their data. The player types their display name at
|
||||
first sign-in; names are unique among players; the GM can rename. The GM signs in the same way with
|
||||
a GM key printed by `fff-vtt gm-key` (replaces `gm-link`, #5; rest of #5 unchanged). The GM can
|
||||
replace a player's key at any time while the server runs: old key invalid, all that player's
|
||||
sessions revoked, live connections closed; identity, characters and encountered list kept; no name
|
||||
re-prompt. Removing a player: key invalid, sessions revoked, connections closed; their characters
|
||||
and controlled tokens pass to the GM; name and slot freed; encountered list deleted. Defaults
|
||||
accepted: one key on many devices; sessions never expire; keys stored plaintext; 20-character key in
|
||||
groups of 4 with dashes, no look-alikes, CSPRNG (~100 bits); 6-player cap counts unused keys;
|
||||
sign-in sets the session cookie as in 3.2. No rate limit or lockout on key entry (owner rejected
|
||||
guessing protection). Rejected: per-person invite links; GM types the name at key creation;
|
||||
delete-and-reinvite only; deleting characters with the player; shared-link visit creates a player;
|
||||
separate GM link path. Terms: "player key" and "GM key"; "token" stays reserved for map figures.
|
||||
Message names: #11.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner decision), #7]: map tiles in M3. The tile gate
|
||||
(`/tiles/`, Nim, `X-Accel-Redirect`) and a minimal local test nginx with generated 32 px fixture
|
||||
tiles are M3 scope; tile import CLI and the production nginx vhost stay M6. Tile URLs carry
|
||||
`art_version` from M3 (always 1 in M3); responses are `Cache-Control: private`; malformed or
|
||||
out-of-range paths get 404, unexplored tiles 403. The gate reuses the server's explored-area logic,
|
||||
checked against the independent oracle (10.2). On-disk layout
|
||||
`<state>/tiles/<scene>/v<art_version>/` fixed in M3. See 3.3, 11.1, 13.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner decision), #9]: test tools. Black-box WS/HTTP harnesses
|
||||
are Node 26 only (repo-root `tools/`, built-ins and `node:net` for raw frames, `node:test`, no npm
|
||||
deps), ported from the prototype; no Nim rewrite. In-process tests stay Nim. Root devbox pins nodejs
|
||||
26; `devbox run test` runs Nim then Node. Browser e2e details stay open (M4). See 2, 10.4, 13.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner decision), #12]: what M3 done means. Done = `devbox run
|
||||
test` green on a clean checkout, with the nine named groups in 13 (M3 Accept), each pointing to its
|
||||
details in 10.3, 3.4, 5.5 and 6. Concurrency moves to M5 and the 127.0.0.1 bind check to M6 deploy.
|
||||
Protocol limits (frame size, intent rate, connection caps) are a separate open card, "M3 limits",
|
||||
not decided here. See 10.3, 13.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner-delegated, 2026-11-14, #15)]: M3 limits. The owner
|
||||
delegated the numbers to the agent and accepted the set. Max inbound WS message 64 KB (mummy
|
||||
default; inbound only; no config). Intent rate: token bucket per connection, 30/s sustained, burst
|
||||
100, same for GM and players; excess refused with `rate limited`, no rollback (each intent atomic),
|
||||
connection stays open. Connections: 4 per player (a 5th closes the oldest), 16 total (the 17th is
|
||||
refused); replaces the PROPOSED cap of 8. Consequence: the M5 concurrency port spreads load across
|
||||
connections (10.1). See 4.3, 6.4, 10.1, 13.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner-delegated, 2026-11-14, #11)]: M3 message list. The owner
|
||||
delegated the wire shapes; the set is the complete M3 catalogue in 6 (29 client intents, 14 server
|
||||
messages, 15 with #18's `closing`). Client `t` is `<noun>.<verb>` (GLOSSARY nouns: `token`, never
|
||||
"entity"), server `t` is a dotless state noun, so they never collide. Every intent carries `reqId`
|
||||
and gets exactly one `ack` (`ok`, new `id`, `pos` for moves); a refused player move stays the
|
||||
uniform nack (old position, no code), every other refusal has a static code (`rate-limited`,
|
||||
`not-allowed`, `not-found`, `invalid`, `name-taken`, `cap-reached`, `in-use`, `no-rules`,
|
||||
`unknown-type`); frames without a readable `reqId` get `error` (`malformed`, `rate-limited`).
|
||||
`invite.*`, `gmClearBlocked` and `blocked` are retired: `key.*`/`player.*` for player keys and
|
||||
players, `status.set`/`status.clear` and `token.resize` for #4. Connection outcomes: HTTP 403
|
||||
(Origin), 401 (no session), 400, 503 (17th connection); WS close 4001 revoked, 4002 evicted (5th
|
||||
connection), 4003 proto mismatch, 1008 malformed flood; oversize closes TCP with no frame. `POST
|
||||
/join` is HTTP (6.6). Server `door` is folded into `wall`; `presence` into `roster`; `pong` into the
|
||||
ping `ack`. See 3.1, 3.2, 3.4, 4.2, 4.3, 5.5, 5.6, 6, 7.5, 13.
|
||||
|
||||
Owner also decided 2026-11-14 (review of #11 flags) [FIXED (owner decision)]: (1) players cannot
|
||||
create or edit characters or props in v1 (GM only); opening that later is a permission change on the
|
||||
existing intents, not a redesign (1). (2) A revealed name cannot be un-revealed: no un-reveal intent
|
||||
(8, 6.1). (3) `character.remove` is refused with `in-use` while tokens link the character (6.1,
|
||||
6.5). (4) Encountered stays encountered: a `gm_only` flip leaves the entry, greyed (8, 6.1). (5)
|
||||
Status markers do not reveal their cause to non-GM viewers: `statuses[].source` goes to the GM only
|
||||
(3.1, 5.5, 6.1; amends #4). The controlling owner is not given `source` either, as the doc has no
|
||||
owner-view rule for statuses; revisit if wanted.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner-delegated, 2026-11-14, #17)]: M3 slice 2 ("getting in").
|
||||
Storage is migration step 2 (`auth`): `player`, `player_key`, `session`, a single-GM partial unique
|
||||
index, cascading deletes (4.4). Players/keys/sessions: 3.2 and 8. Cookie `fff_session`, `POST /join`
|
||||
as in 6.6. `fff-vtt gm-key [--new]` and the `<stateDir>/instance.lock` fcntl lock with exit 3 are
|
||||
recorded in 3.2/11.1. Slice 2 implements only the three GM intents auth needs (`key.create`,
|
||||
`key.replace`, `player.remove`) with the 6.1 ack shape; the rest of the envelope, error frames, rate
|
||||
limits and unknown-type answers stay slice 3 (#18). The application close codes of 6.5 are not
|
||||
expressible at the mummy pin (3.2); slice 3 decides. See 3.2, 4.4, 6.5, 6.6, 8, 11.1, 13.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), #18]: close codes at the mummy pin, option A.
|
||||
Mummy 0.4.8 cannot send an application close code (`close(ws)` -> an empty close frame -> the
|
||||
browser sees 1005); mummy is not forked or patched for it. Every server-initiated close is preceded
|
||||
by exactly one `closing {reason, code}` message carrying the reason of 6.5, then the close frame; a
|
||||
client treats 1005 plus that last message as the reason. `closing` is a catalogue message (server ->
|
||||
client, dotless noun) and the catalogue count is 15. Slice 2's eviction and revocation paths send
|
||||
it. Also recorded FIXED here: the server Ping interval (20 s, plus one right after `hello`; lag
|
||||
enforcement stays M5), the per-connection `n` rule (server frames only, no number for Ping/Pong, no
|
||||
global counter), the own `maxMessageLen` (64 KB) rather than mummy's default, and the slice-3
|
||||
rollout note that catalogue intents whose slice has not landed answer `unknown-type`. See 3.2, 4.3,
|
||||
6, 6.1, 6.2, 6.4, 6.5, 10.3.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #19)]: walls and doors (M3 slice
|
||||
4). Schema is migration step 3 (`world`): `scene` and `wall`, with the single v1 scene seeded at `id
|
||||
1` (4096x4096, tile 32 = cell 32, no grid, vision 400, token radius 20, art_version 1,
|
||||
`next_wall_id` 1) (4.4). Wall ids are per scene from `next_wall_id`, monotonic and never reused
|
||||
across removal or restart (#3). The four intents `wall.add`/`wall.update`/`wall.remove`/`door.set`
|
||||
are GM-only and answer the 6.1 acks; the payload rules 6.1 left open are fixed there: integer
|
||||
`scene` (else `not-found`), `a`/`b` finite and in bounds with `a != b`, `open` boolean and never
|
||||
true on a plain wall, `flags` an object (default `{}`), `wall.update` patches only
|
||||
`a`/`b`/`kind`/`flags` and needs at least one, `door.set` on a non-door is `invalid`, fields before
|
||||
lookup. Effects: `wall`/`wall_gone` to every GM connection only, and a `walls` snapshot right after
|
||||
`hello` on a GM connection; players never receive wall data in any message (3.1, T2). Every wall
|
||||
write is one transaction with `synchronous=FULL` (Q12) and memory follows COMMIT, so a restart
|
||||
reloads exactly what was acked. See 4.4, 6.1, 6.3, 8, 10.3.
|
||||
|
||||
Owner also decided 2026-11-14 [FIXED (owner-delegated, 2026-11-14, #16)]: M3 slice 1 groundwork
|
||||
("bare server"). Config keys, defaults, precedence and the canonical origin: 11.1. Migration history
|
||||
DDL, the agreement/contiguity rule and one-transaction-per-step: 4.4. Secret redaction (value
|
||||
registry plus sensitive field names, minimum secret length 8): 11.3. `GET /healthz` answers `200
|
||||
{"status":"ok"}` from slice 1; the lock-bounded health check stays M5: 6.6, 11.3. `devbox run test`
|
||||
runs `nimble test` first and only then `node --test tools/*.test.mjs` (10.4); both logs land in
|
||||
`results/`. The server's listen address is the constant `config.BindAddress` = `127.0.0.1`, not a
|
||||
config key (T15). Dependencies: `fff_vtt.nimble` requires `mummy == 0.4.8` and `db_connector ==
|
||||
0.1.0`; devbox adds nodejs 26 and sqlite (`out`+`bin`, with
|
||||
`LD_LIBRARY_PATH=$DEVBOX_PACKAGES_DIR/lib` for the dlopen). Node 26 `{headers}` re-check: 10.4.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #20)]: tokens and sight (M3 slice
|
||||
5). Schema is migration step 4 (`tokens`): `entity` as listed in 4.4, no
|
||||
`radius`/props/`character_id` columns yet (slices 7-8 add them, `entity_status` with slice 7,
|
||||
`explored_chunk` with slice 6). Token ids are 12 random characters from `[A-Za-z0-9_-]` (a 64-symbol
|
||||
alphabet, so 6 uniform bits per character, 72 bits) from `std/sysrand`, collision-checked against
|
||||
every loaded token. The token payload rules 6.1 left open are fixed in 6.1 ("Token payload rules");
|
||||
the load-bearing ones are: plain tokens only, `radius`/`props`/`character_id` refused `invalid`
|
||||
rather than dropped, effective radius = the scene default, the wire `name` is always the descriptive
|
||||
name, `controller: null` is the only GM spelling, and `explored` on connect is RLE rows.
|
||||
**Modules**: `server/tokens.nim` (records, validation, write-through persistence with FULL for GM
|
||||
authoring and NORMAL for moves), `server/vision.nim` (per-player polygons, explored set, the one
|
||||
copy of the visibility rule), `server/views.nim` (the single egress: typed `GmView`/`PlayerView`,
|
||||
then frames, then the per-connection diff), `server/worldmap.nim` (records -> geometry/move-rule
|
||||
inputs), `server/faults.nim` (test-only hook). `main.nim` holds the state (`tokens`, `visions` per
|
||||
player, `known` per connection keyed by app connId) and never builds a state frame itself, so raw
|
||||
world state has no path to a socket outside the egress (2, 10.1). **Egress timing**: a mutation's
|
||||
ack and its per-recipient diffs are enqueued under the global lock, in that order, and every frame
|
||||
is built from the state at enqueue time (mummy's `send` only appends to its deque, 4.3). Exact
|
||||
per-connection ordering between two concurrent mutations, and the coalescing that keeps that cheap,
|
||||
stay the M5 outbox. **Runtime rules**: polygons exist only for tokens a player controls that carry
|
||||
the `vision` flag, with the token's `vision_radius` or the scene default; only their token centres
|
||||
count for visibility; explored is the union of `cellsTouched` over history, only grows, drops cells
|
||||
outside the world, and the `fresh` set is cleared after one egress fan-out. A door closing pushes
|
||||
tokens aside (5.5) and persists the new positions; `stuck`/`squeezed` are slice 7's status model, so
|
||||
a failed push leaves the token overlapped and unflagged for now. `token.move` maps the move rules to
|
||||
the wire exactly: `ack {pos}`, the uniform nack for locked/over-cap/collision and for an
|
||||
out-of-bounds GM move, and `not-allowed` (players, one code for unknown and not-yours) or
|
||||
`not-found` (GM) before any geometry runs; accepted moves are persisted with NORMAL durability.
|
||||
`hello` carries the scene block for every named recipient and `extra` for the GM; an unnamed player
|
||||
still gets only `proto, role, me` and is not fed any state at all (6.3), so slice 5's player-side
|
||||
acceptance is reached through a harness fixture that writes the name into the DB before connecting:
|
||||
`player.setname` is slice 8 (#23) and the unnamed gate itself is pinned by `tools/tokens.test.mjs`.
|
||||
**Tests** (10.1, 10.3): `tools/leak.mjs` builds a 27-group scene over the real wire (enter/leave by
|
||||
movement, a closed door, create/remove, `gm_only`, a controller hand-over, another player walking in
|
||||
and out, a wall added and removed, a door push) and records every frame; `tools/leakcheck.nim`
|
||||
replays it with the GM socket as truth, recomputes polygons from `geometry.nim`, and checks explored
|
||||
against both that recomputation and an independent clear-segment sampler; A and B both pass with
|
||||
zero failures. `tools/fault.test.mjs` catches `hidden`, `gmOnly`, `walls`, `withhold`, `otherOwner`,
|
||||
`otherVision`, `otherExplored`, `noremove` and `explored` under their exact class sets and asserts
|
||||
the shipped binary contains no `LEAK_FAULT` string. `tools/probing.test.mjs` re-runs T8/H26 over WS:
|
||||
over-cap probes give the one uniform nack, two scenes differing only beyond cap + token radius
|
||||
produce identical reply sequences over 90 hostile probes inside the 6.4 burst, and a wall inside
|
||||
that bound does change the replies. Nim units: `tests/ttokens.nim`, `tests/tvision.nim`,
|
||||
`tests/tviews.nim`. Mutations aa-af pin the view rule, the egress `token_gone`, the absence of
|
||||
GM-only fields in a player frame and the "explored only grows" rule.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #22)]: token details (M3 slice
|
||||
7). Schema is migration step 6 (`token details`): the three prop buckets on `entity` and
|
||||
`entity_status` (4.4). Intents: `token.resize`, `status.set`, `status.clear`, `prop.set`,
|
||||
`prop.unset`, all GM-only in v1 (6.1; owner-bucket writes by players come with FFF actions, 9, and
|
||||
are a permission change, not a redesign). The payload rules 6.1 left open are fixed in 6.1: the
|
||||
status set and its `source`, the three-bucket caps (64 keys, 1..64-char keys, 8 KB values, per
|
||||
bucket), the property-schema registry (empty at start with a permissive fallback, so v1 accepts any
|
||||
key in any bucket because 8 says the server never interprets props; a registered key is enforced)
|
||||
and the grow-push search. **Modules**: `server/props.nim` (buckets, caps, registry, parsing),
|
||||
`server/moverules.nim` (the status model replaces the M2 `blocked` bool:
|
||||
`stuckWalls`/`squeezedWalls` are the `walls` source, `locked` is the caller's "any entry" bit,
|
||||
per-token radius everywhere, `resizeToken` with the grow search, `placeToken` for GM
|
||||
placement/move), `server/text.nim` (the one copy of the 6.5 text rule, shared by names and prop
|
||||
keys), `server/tokens.nim` (statuses and props on the record and in the row), `server/worldmap.nim`
|
||||
(`ruleToken`/`ruleWall`/`applyOutcome`/`wallsStatuses`: the bridge between the record's entry set
|
||||
and the rules' two booleans), `server/views.nim` (typed per-recipient statuses and buckets). **One
|
||||
rule, one place**: every wall/door edit and every resize runs the pure rules on a snapshot taken
|
||||
*before* the write, then the write, then `applyRuleOutcome` (positions and `walls` statuses in one
|
||||
`NORMAL` transaction, memory after COMMIT); `token.create` computes the placement status before
|
||||
writing the row, so a new token is born with `stuck` if it lands on a wall. Status sources are owned
|
||||
by different layers on purpose: the rules never see `GM` entries, the record never derives `walls`
|
||||
entries. **Tests** (10.1, 10.3): `tests/tprops.nim` (caps, key/value rules, registry enforcement,
|
||||
set/unset, clone isolation), `tests/ttokens.nim` (radius, buckets, statuses round trip, the FK
|
||||
cascade), `tests/tmoverules.nim` (per-token radius, shrink/grow/squeeze, the no-crossing rule, the
|
||||
source independence), `tests/tviews.nim` (bucket and source filtering, one `token` frame per
|
||||
change), `tools/details.test.mjs` (the five intents' acks and codes, grow push and squeeze,
|
||||
stuck/clear, prop caps, who reads which bucket, restart equality), plus the leak scenario's
|
||||
prop/status groups and the `OWNER_PROP`, `GM_PROP`, `STATUS_SOURCE` faults. Mutations am-au pin the
|
||||
bucket filter, the per-bucket cap, the status set/clear, the shrink/grow rules and the push. See
|
||||
4.4, 5.5, 5.6, 6.1, 8, 10.3.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), #22]: the property-schema registry of 6.1 is
|
||||
confirmed as the agent specified it — v1 ships the registry **empty with a permissive fallback**
|
||||
(`pkAny`), so any key is accepted in any bucket and only a registered key is enforced, which matches
|
||||
8's "the server never interprets props in v1". **Strict mode comes with the FFF seam (post-v1)**,
|
||||
where the rules module registers every key it uses; flipping the fallback is a one-line change and
|
||||
no v1 payload, wire shape or test changes. **[amended 2026-11-15, #41: the v1 registry is no longer
|
||||
empty — `height` and `eye_height` are registered (`number`, `gm`, 5.7); the rest of this entry
|
||||
stands]**. The rest of the #22 token-details decisions stay owner-delegated.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner-delegated, 2026-11-15, #23)]: characters and names (M3
|
||||
slice 8). Schema is migration step 7 (`characters`, 4.4): `character`, `name_reveal`, `encountered`,
|
||||
plus `entity.character_id` and `entity.reveal_all`. The decisions 4.4 leaves open are recorded there
|
||||
and the wire rules in 6.1 ("Character and name payload rules"): one id namespace for tokens and
|
||||
characters, an owner that never dangles (`player.remove` transfers to the GM first), an encountered
|
||||
entry with no FK that outlives everything, a linked token that stores `''` names, and
|
||||
`character_id`/`cprops` on the token frame with the ownership rules of 6.1 leak notes 2-3.
|
||||
**Modules**: `server/characters.nim` (records, the name rule, the reveal set, the encountered
|
||||
snapshots, their rows), `server/views.nim` (the typed character and encountered views plus the
|
||||
token-frame additions), `server/tokens.nim` (`characterId`/`revealAll`, the linked-token validation
|
||||
and `sqlLitId`), `server/text.nim` (`normalizedPlayerName`, `validPlayerName`, `sameName`),
|
||||
`server/auth.nim` (`allPlayers`, `nameTaken`, `setName`, `renamePlayer`), `server/main.nim`
|
||||
(`recordEncounters` in every mutation path before the ack, the roster fan-out, `sendHello`/`resync`
|
||||
for `player.setname`). Also fixed here: `protocol.withN` deep-copies before stamping `n`, because
|
||||
the stored diff base was being mutated and every state frame was re-sent on every mutation.
|
||||
**Tests** (10.1, 10.3): `tests/tcharacters.nim` (the name rule, the reveal set, the encounter
|
||||
snapshot, validation, persistence incl. the GM transfer and the `in-use` count), `tests/tviews.nim`
|
||||
(character frames, the owner/non-owner split, `cprops`, `character_gone`, the encountered diff),
|
||||
`tools/characters.test.mjs` (the acceptance group of 13), the leak scenario's ten
|
||||
character/name/encountered groups and the `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE`,
|
||||
`CHAR_OWNER_PROP` faults. Mutations av-b4 pin the name rule, the encountered snapshot, the
|
||||
linked-token validation, `in-use`, the GM transfer, the snapshot rename and the `cprops` bucket. See
|
||||
3.1, 4.1, 4.4, 6.1, 6.3, 6.4, 6.5, 8, 10.3, 13.
|
||||
|
||||
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 |
|
||||
|---|---|---|---|
|
||||
| 1 | leak+fault | `tools/leak.test.mjs` (leak A/B), `tools/fault.test.mjs` (exact class sets incl. `ACTUAL_NAME`, `CHAR_LIST`, `CONTROLLER_CHANGE`, `CHAR_OWNER_PROP`) | pass |
|
||||
| 2 | tiles | `tools/tiles.test.mjs` (oracle sweep through the test nginx, refusal/path matrix, no committed PNG) | pass |
|
||||
| 3 | probing | `tools/probing.test.mjs` (hostile client over WS, bounded replies) | pass |
|
||||
| 4 | protocol | `tools/protocol.test.mjs` (proto, unknown type, envelope, flood, rate limit, 64 KB, cap, closing) | pass |
|
||||
| 5 | auth | `tools/auth.test.mjs` (cookie flags, Origin, devices, key replace, remove, gm-key) | pass |
|
||||
| 6 | characters and names | `tools/characters.test.mjs` (names, reveals, reassign, in-use, encountered, status source) | pass |
|
||||
| 7 | restart | `tools/restart.test.mjs` (full state, all CRUD, SIGTERM and SIGKILL) | pass |
|
||||
| 8 | persistence | `tools/persistence.test.mjs` (chunk round trip, migration, restart, write cost) | pass |
|
||||
| 9 | logs | `tools/logs.test.mjs` (keys/sessions/hashes across two runs, `keylog` control) | pass |
|
||||
|
||||
Out of M3 accept, unchanged: concurrency (M5) and the 127.0.0.1 bind check (M6 deploy) [FIXED, #12].
|
||||
**Measured 2026-11-15 on the final tree:** `devbox run test` exit 0 (Nim suite all pass; 103 Node
|
||||
harness tests, 0 fail) and `devbox run mutation` exit 0 (control passes, all 63 mutations fail >= 1
|
||||
expected test, the new `d3` included; log `results/mutation.log`). See 6.1, 10.3, 10.4, 13.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #41]: the height model. Heights
|
||||
are metres, decimal; map distances stay px and no map scale is introduced, because see-over compares
|
||||
heights with heights (research #39 3.3). `height` and `eye_height` are properties, not fields: a
|
||||
character carries the base value, a plain token must carry its own (`token.create` without one is
|
||||
refused), a linked token uses the character's value and may carry a temporary on-map override that
|
||||
never writes the character. Effective token height = token override, else character, else the plain
|
||||
token's own. Eye height follows the same pattern; if nobody set one by hand anywhere it is 93% of
|
||||
the effective token height and follows changes live [93% FIXED (owner-delegated)]. A wall is full
|
||||
height (nobody sees over it) unless the GM gives it one in metres; existing walls are unchanged.
|
||||
Both keys live in the `gm` bucket, so players see only the outcome, their sight. They are the first
|
||||
two keys of the property-schema registry (`number`, `gm`), so "the server never interprets props in
|
||||
v1" becomes "the server interprets only registered keys used by core sight rules". Limits [FIXED
|
||||
(owner-delegated)]: all heights > 0; `height` <= 100 m; `eye_height` <= 100 m and may exceed
|
||||
`height`; a wall's height > 0 and <= 100 m. Deferred: the target's height in see-over (#44) and the
|
||||
height existing tokens and characters get at migration (#49); wall kinds were settled afterwards by
|
||||
#42 (5.8, v0.22), and what a low wall hides (#44) and thickness (#45) were settled afterwards in 5.9
|
||||
and 5.10. See 5.7, 6.1, 8, 9.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #42]: the wall model. A wall's
|
||||
behaviour is **independent switches**, and a named kind is only a **preset** over them: never a
|
||||
fixed kind enum in the record, and never client-interpreted free flags (the client may send a preset
|
||||
name; the server expands and validates it). v1 switches are `blocks_sight` and `blocks_movement`
|
||||
plus the door settings `door`, `open`, `secret`, `locked` and one direction field `sight_dir`
|
||||
(`both|left|right`); no light or sound axis. Direction is **sight only**: movement is two-way
|
||||
governed by its switch. A door is a wall with `door` set and independent `open`/`secret`/`locked`
|
||||
settings, not a separate kind or a state enum, and `door.set` keeps working as "set `open`". The
|
||||
switches describe the closed wall: an open door blocks neither sight nor movement. A secret door is
|
||||
always closed and two-way (`open:true` or `sight_dir != both` on it is `invalid`), so it can look
|
||||
exactly like a solid wall. `secret` and `locked` are GM-only and never observable to a player in any
|
||||
form; the obligations are byte-identical player frames and refusals for a closed secret door against
|
||||
a solid wall, and one uniform move nack. v1 presets (one-drag editor defaults and the GM's label)
|
||||
are `wall` (default), `door`, `secret door`, `locked door`, `terrain` (blocks movement, not sight:
|
||||
railing, bushes) and `one-way wall`; windows were left to #47, which added the `window` preset
|
||||
(2026-11-16), and "blocks nothing" is not a preset. The record stores the switches; `kind` survives
|
||||
on the wire as a derived read-only label (exact preset match, else `custom`), never an input and
|
||||
never the authority [FIXED (owner-delegated)]. The switches are typed validated fields on the record
|
||||
and in the payloads, not entries in the never-interpreted `flags`; columns vs one validated object,
|
||||
and the existing-row migration, are #49's [FIXED (owner-delegated)]. The GM editor has a preset row
|
||||
plus an **advanced** toggle that exposes the raw switches [FIXED (owner decision)]. Thickness and
|
||||
height compose through the switches (a wall with `blocks_sight=false` never reaches the sight
|
||||
predicate) and are decided in 5.10 and 5.9. See 1, 3.1, 5.1, 5.5, 5.8, 6.1, 7.4, 8, 14.
|
||||
**[Superseded 2026-11-16, Q6/#48: the preset list is `wall`|`door`|`window`|`one_way`, `terrain` is
|
||||
dropped, and `kind` is derived by shape rather than by exact preset match; the switch model itself
|
||||
stands.]**
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #44]: low walls. A token is
|
||||
visible iff **its top clears every sight wall the line from the viewer's eye crosses**, strictly:
|
||||
the sight line's height at the wall (`h_e + (h_t - h_e)·d_W/d_T`) must exceed the wall's height, and
|
||||
one failing wall hides it. The target's own height therefore matters (a giant's head over a fence, a
|
||||
crouched figure hidden next to the wall it would clear from further away); there is no
|
||||
adjacent-visible exception and no distance rule. The visibility polygon stays **strict**, so the
|
||||
floor behind a low wall stays unexplored and black, no tile is sent, and a visible token may stand
|
||||
on a black cell; no per-cell height is tested anywhere. Movement never reads height:
|
||||
`blocks_movement` alone decides, so a knee-high wall with the switch on stops a walker. Players get
|
||||
a binary answer and the whole token, with no clipping and no cover percentages (a rules-engine
|
||||
judgement, still a non-goal). The GM gets a GM-only **who-sees-it** view: per token, which
|
||||
player(s)/characters see it and its visible fraction (the share of its height above the highest
|
||||
blocking sight line, 100 % unobstructed), derived from data the GM already receives, never on a
|
||||
player wire, its panel shape M4's. Knobs delegated: strict comparison with equality hidden,
|
||||
evaluated at the wall near face (a thick wall: every crossed face, 5.10, #45); every crossed wall
|
||||
must clear; the hook sits at `visibleTo` as `insideAny or predicate` with heights never entering
|
||||
`visibilityPolygon`; no "see-over" switch on the wall; the hidden band's cells and tiles are
|
||||
oracle-*maybe*, a band-hidden token gives no frame, name or churn, and the leak checker's clear-line
|
||||
oracle gets its own height test. See 5.7, 5.8, 5.9, 7.4.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #46]: secret and locked doors.
|
||||
(1) **Player door opening is out of v1** [FIXED (owner decision)]: only the GM opens or closes a
|
||||
door; `door.set` stays G-only and a player sender is `not-allowed` at the role step (6.5) whatever
|
||||
the door's settings. Player-opened doors, lock refusals addressed to players and player discovery of
|
||||
secret doors (searching, revealing, finding a way in) are future effort, not v1 and not this map;
|
||||
the lock is GM authoring state. (2) **A locked door does not open** [FIXED (owner decision)]:
|
||||
`door.set open:true` on a door with `locked` is `invalid`, exactly like a secret door, and the GM
|
||||
unlocks first (editor hint "locked: unlock first"); any write that would store `open:true` with
|
||||
`locked` or `secret` — `wall.add`, `wall.update`, a preset expansion — is `invalid`; closing a
|
||||
locked door is allowed. Otherwise a locked door is an ordinary closed door. (3) **The equivalence
|
||||
oracle** [FIXED (owner-delegated)]: `tools/doors.test.mjs` is a new Node accept group (built-ins
|
||||
only, 10.4) in the shape of `tools/probing.test.mjs` — two servers, fresh state, one identical
|
||||
script, scenes differing only in one segment (solid wall vs secret door; solid wall vs
|
||||
secret+locked; closed door vs locked closed door), player frames and per-tile statuses identical
|
||||
after canonicalisation with **no** normalisation; the positive control is the same script against an
|
||||
open door, which must differ; the negative control is `LEAK_FAULT=secretgap` (a secret door not
|
||||
blocking the player-facing computation), which must fail the doors group while a clean build passes
|
||||
and ships no fault string; `tools/leakcheck.nim`'s banned-key scan grows `secret`, `locked`, `door`,
|
||||
`blocks_sight`, `blocks_movement`, `sight_dir` (and #49's names) into `WALLDATA`, with a new fault
|
||||
leaking one door setting key and asserting exactly `WALLDATA`; a GM `door.set` on a secret or locked
|
||||
door is `invalid` and a player `door.set` is `not-allowed` for every door; timing and size side
|
||||
channels (T11) stay accepted and untested. See 1, 3.4, 5.8, 6.1, 6.5, 7.4, 10.3.
|
||||
|
||||
Owner also decided 2026-11-15 [FIXED (owner decision), 2026-11-15, #45]: thick walls. (1)
|
||||
**Placement** [FIXED (owner decision)]: `position` is `center` (default), `left` or `right` of the
|
||||
drawn `a -> b` line, using 5.8's side convention; the line is the room's interior, the body grows
|
||||
outward, and a flip changes only the body, never `a`/`b`. (2) **Body** [FIXED (owner decision)]: a
|
||||
rectangle `|ab|` x `thickness` with square ends, offset per `position`; `thickness: 0` is today
|
||||
exactly and every existing wall migrates to zero and unchanged. It is opaque floor: never in a
|
||||
player polygon, never newly explored, no tile newly revealed under it. (3) **One shape** [FIXED
|
||||
(owner decision)]: sight footprint and movement collider are the same exact rectangle, sight as the
|
||||
4-face quad hoisted per wall edit (#43 measured) and movement as exact circle-vs-rectangle distance
|
||||
with a centre inside the body counting as overlap; one rectangle-distance primitive serves
|
||||
`pathClear`, the overlap/`stuck` check, the door push, `pushOutOfWalls` and resize; a
|
||||
`blocks_sight:false` wall contributes nothing to sight, body included, while its collider keeps the
|
||||
thickness. (4) **Default thickness** [FIXED (owner decision)]: a new wall starts at the GM's
|
||||
last-used thickness, 0 in a fresh editor. (5) **See-over** [FIXED (owner decision)]: 5.9's line must
|
||||
clear **every crossed face** of the body, near and far, strictly; the faces coincide at zero
|
||||
thickness, so 5.9 stands. (6) **Edits never push** [FIXED (owner decision)]: a thickness change,
|
||||
flip or move that covers a token leaves it in place and `stuck`; only a door close pushes. (7) **A
|
||||
viewer inside a sight-blocking body sees nothing** [FIXED (owner decision)]: empty polygon until it
|
||||
leaves. (8) **No dead end** [FIXED (owner decision)]: v1 walls stay straight rectangles (a cave is a
|
||||
chain of walls; joints overlap with a small outer notch and no crack), the shape sits behind one
|
||||
seam, and curved/freeform walls and tracing walls from a map image are future effort. Delegated: px
|
||||
thickness `0..256`; the `(-dy, dx)` side formula; joints by overlap, no mitre; field names
|
||||
`thickness` and `position`; the last-used default as editor state. Downstream: thick doors and push
|
||||
geometry #50, one-way body occlusion #47, wire/schema/migration #49. See 1, 5.1, 5.3, 5.5, 5.7, 5.8,
|
||||
5.9, 5.10, 6.1, 7.4, 8, 13.
|
||||
|
||||
Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #47]: windows and one-way walls.
|
||||
(1) **Window** [FIXED (owner decision)]: v1 has no sill and no top — a window is see-through along
|
||||
its whole drawn length, height unused, drawn as its own wall piece inside a wall (`wall | window |
|
||||
wall`, like a door), with two forms: fixed (no pass) and opening (door settings; pass when open).
|
||||
The editor gets a `window` preset. No distance-limited window. (2) **One-way** [FIXED (owner
|
||||
decision)]: a thick one-way wall's body is opaque floor from **both** sides — no player polygon,
|
||||
never explored, no tile — and only pass-through past the wall is directional; explored cells and
|
||||
tiles differ per side with no new mechanism (per-viewer sight), and explored only grows, so a flip
|
||||
never takes anything back. (3) **Editor** [FIXED (owner decision)]: a one-way wall shows an arrow at
|
||||
its middle pointing the way the view goes (from the seeing side toward the watched side) plus a flip
|
||||
that swaps `sight_dir` without moving `a`/`b`; GM-only, never on a player wire. (4) **`left`
|
||||
wording** [FIXED (owner-delegated)]: `sight_dir:"left"` means a viewer on the left side — the `(-dy,
|
||||
dx)` normal of `a -> b`, the same side as `position` — cannot see across; a viewer on the right sees
|
||||
across. The one-way preset defaults to `left`; `sight_dir != "both"` with `blocks_sight:false` is
|
||||
`invalid`; `left` and `right` both derive `one_way`. (5) **Filter shape** [FIXED (owner-delegated)]:
|
||||
hoisted viewer-independent faces plus one sign test per one-way wall per viewer inline in the fan,
|
||||
no per-viewer list copy (the prototype's ~0.15 ms per viewer per frame, times tokens, rejected). (6)
|
||||
**Windows as a kind** [FIXED (owner-delegated)]: the `window` preset is the opening form and derives
|
||||
`window`; the fixed form's switches are `terrain`'s and derive `terrain` (the rules are identical),
|
||||
with no second preset and no new kind — the editor may hint at it. Downstream: the
|
||||
wire/schema/migration and the preset list are #49; terrain stays #48. Out of scope for v1: windows
|
||||
with a real sill and top height, and light through windows (future effort with lighting). See 1,
|
||||
5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3, 14. **[Superseded 2026-11-16, #48: `terrain` is dropped, the
|
||||
fixed form is a window, and the presets are four.]**
|
||||
|
||||
Owner also decided 2026-11-16 [FIXED (owner decision), 2026-11-16, #48]: terrain walls, and the
|
||||
principle behind the answer. (1) **`terrain` is dropped, everywhere** [FIXED (owner decision)]: no
|
||||
preset, no derived kind and no stored name. The switch set `blocks_sight:false`,
|
||||
`blocks_movement:true`, no door, is a **fixed window** and derives `kind:"window"`. A railing, a
|
||||
bush, a pit edge and a fixed window are one object with one switch set; they differ only in the GM's
|
||||
`label`. This supersedes #42's and #47's `terrain` preset/kind (and #47's fixed-form wording) and is
|
||||
itself an application of the new principle. (2) **Principle** [FIXED (owner decision)]: "Do the most
|
||||
with the fewest things: one object, switches on top, names are only labels" — recorded in §1 and to
|
||||
be applied to future cards. (3) **Four editor presets** [FIXED (owner decision)]: `wall` (default),
|
||||
`door`, `window`, `one_way`; `secret` and `locked` are checkboxes on any door, including an opening
|
||||
window (`door` + `blocks_sight:false`), and keep #46's semantics (GM-only, a locked door refuses to
|
||||
open until the GM unlocks, never observable to a player). (4) **Preset names and kinds resolved**
|
||||
[FIXED (owner-delegated)]: `secret_door` and `locked_door` are **removed** as wire preset names (the
|
||||
wire takes `wall|door|window|one_way`; #49 implements), and the derived kind list is `wall`, `door`,
|
||||
`window`, `one_way`, else `custom`, derived by shape (window first, then one-way, then door, then
|
||||
wall) with `secret`/`locked` as flags that never change the label. A secret door also requires both
|
||||
block switches on and `sight_dir:"both"` (a secret window would show itself); a locked window is
|
||||
allowed. (5) **Player marker** [FIXED (owner decision); name and shape delegated]: a new wall switch
|
||||
`player_marker`, on by default for the `window` preset and off for every other preset (GM may toggle
|
||||
it on any wall); an invisible barrier is simply a window with the marker off. It is the **first and
|
||||
only wall-derived data on a player wire**, an exact exception to 3.1: once any point of the wall's
|
||||
visible extent has entered that player's vision polygon, the player receives an anchor (the wall's
|
||||
drawn midpoint; a thick wall's midpoint is inside its own opaque body, so the gate is the visible
|
||||
extent, not the midpoint in the polygon) and its own opaque marker id, and **nothing else** — no
|
||||
type, kind, open/closed, direction, label, thickness, height or wall id; the client draws the window
|
||||
icon. The marker is per-player memory like explored: persisted, survives disconnect, never lost to
|
||||
LOS or a door, and retracted only when the GM removes the wall, clears `player_marker`, makes it not
|
||||
a window, or moves its geometry; a moved wall re-earns its marker only when the new geometry is
|
||||
seen. (6) **Wall `label`** [FIXED (owner-delegated)]: every wall may carry an optional GM-only
|
||||
free-text `label`, at most 64 code points (the 6.5 text rule), no behaviour, never on a player wire
|
||||
and in `BannedAlways` (`WALLDATA`). (7) **No other hint** [FIXED (owner decision)]: players get no
|
||||
other sign of a barrier; a refused move stays the uniform nack. (8) **Out of scope** [FIXED (owner
|
||||
decision)]: per-wall material (stone, wood, glass) waits for the lighting effort, alongside sill/top
|
||||
and light through windows; difficult terrain, movement cost and pit/fall semantics are rules-engine
|
||||
work, not wall behaviour. Downstream: the preset set, `player_marker`, `label` and the player
|
||||
`marker` message are inputs to #49 (wire/schema/migration); locked/secret as door checkboxes and
|
||||
window doors are inputs to #50. See 1, 3.1, 3.4, 5.1, 5.8, 5.9, 5.10, 6.1, 7.4, 8, 10.3.
|
||||
|
||||
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.
|
||||
|
||||
<!-- END old section 14 -->
|
||||
|
||||
## D. Superseded statements removed from the current spec
|
||||
|
||||
Each entry quotes the superseded statement (excerpt) and names the surviving rule.
|
||||
|
||||
1. **Wall presets and derived kind (v0.22 #42).** Old: "v1 presets ... are `wall`
|
||||
(default), `door`, `secret door`, `locked door`, `terrain` (blocks movement, not
|
||||
sight: railing, bushes) and `one-way wall`"; and "`kind` survives on the wire as a
|
||||
derived read-only label (exact preset match, else `custom`)". Superseded by #48:
|
||||
four presets, `secret`/`locked` as door checkboxes, `kind` derived by shape
|
||||
(`wall`, `door`, `window`, `one_way`, `custom`). Surviving rule: current §5.8.
|
||||
2. **Fixed window as `terrain` (v0.26 #47).** Old: "the fixed form's switches are
|
||||
`terrain`'s and derive `terrain` (the rules are identical), with no second preset
|
||||
and no new kind". Superseded by #48: the fixed form derives `window`, `terrain` is
|
||||
dropped everywhere. Surviving rule: current §5.8.
|
||||
3. **Closing a slow client on lag (pre-v0.30).** Old: "close a slow client when lag
|
||||
exceeds a bound". Superseded 2026-11-17 (`docs/ANALYSIS-review.md` §6.4): stop
|
||||
feeding a lagging client, full resync on recovery; lag never closes a connection.
|
||||
Surviving rule: current §4.3.
|
||||
4. **Status name `blocked` (Q14, 2026-11-08).** Old: "a GM edit that lands on a token
|
||||
gives it status `blocked`"; door-close failure "stuck only if neither side is
|
||||
valid". Superseded by #4 (2026-11-10): `stuck`/`squeezed`; a door close pushes.
|
||||
Surviving rules: current §5.4, §5.5.
|
||||
5. **Retired wire names (#11).** Old: "`invite.*`, `gmClearBlocked` and `blocked` are
|
||||
retired"; server `door` folded into `wall`, `presence` into `roster`, `pong` into
|
||||
the ping `ack`. The retirement stands; the decommissioned names must not reappear.
|
||||
Surviving rule: current §6, §6.1.
|
||||
6. **Prototype gaps (v0.20 and earlier).** Old: "`Tok.gmOnly` is loaded from
|
||||
`scene.json` but never consulted in `sync()`"; "every message carries the global
|
||||
`gseq`". Both were prototype facts and are fixed in the built server: `gm_only` is
|
||||
enforced in the view builder (`GMONLY_TOKEN`, 10.3) and players get a
|
||||
per-connection counter (`n`, 6.4). Surviving rules: current §3.1, §6.4.
|
||||
7. **"The server never interprets props in v1".** Narrowed by #41: the server reads
|
||||
only the registered keys the core sight rules use (`height`, `eye_height`).
|
||||
Surviving rule: current §8, §9.
|
||||
8. **Wall height as "no dedicated column and no wire field" (v0.21 #41).** Old: the
|
||||
sentence applied to all heights. Narrowed 2026-11-17 (#49) to tokens and
|
||||
characters, which have `props` buckets; a wall has no buckets, so its height is a
|
||||
typed wall field. Surviving rules: current §5.7, §8.
|
||||
9. **The Q14-undefined pin test (pre-M2).** Old §5.4: "Current pin: ... 'door closed
|
||||
on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict'". Replaced in M2 by the
|
||||
move-rule tests of §5.5. Surviving rule: current §5.4, §5.5.
|
||||
10. **Door-open-clears-stuck, former §5.5 item (b).** Closed by the Keep rule
|
||||
(2026-11-08): opening a door does not free a token that another blocking wall
|
||||
overlaps. Surviving rule: current §5.5.
|
||||
11. **Q6's `wall`|`door` only.** Superseded by #42 (switches + presets), then #48
|
||||
(four presets). Surviving rule: current §1, §5.8.
|
||||
12. **Connection cap 8.** Superseded by #15: 4 connections per player, 16 total.
|
||||
Surviving rule: current §4.3.
|
||||
13. **M3 catalogue count "14 server messages, 15 with `closing`".** Later counts in
|
||||
the same change log ("29 intents, 15 server messages") are superseded by #49's
|
||||
`proto` 2 count: 29 intents, 16 server messages. Surviving rule: current §6.
|
||||
14. **Slice-build narratives.** The old §10.3/§13/§14 recorded which M3 slice built
|
||||
which intent, test or schema step ("Built by slice 9 (#24) ...", the M3 acceptance
|
||||
checklist table, mutation letters a-b4). Those are build provenance, not rules;
|
||||
the tests themselves and their accept groups remain binding (current §10, §13).
|
||||
15. **`ANALYSIS` D1-D4 as "not built yet".** The v0.30 note said the split was "not
|
||||
built yet". Done 2026-11-17 under #51; the decision itself (D2) is unchanged and
|
||||
recorded in current §14 and ADR-0012/0013/0014.
|
||||
|
||||
16. **The 5.7 conflict note (v0.30).** Old: "section 1's non-goals (windows/transparent
|
||||
walls, one-way walls) and Q6's `wall`|`door` only were contradicted by the wall-model work.
|
||||
That is 5.8 [#42], which superseded both; this block fixed heights and units only, and what a
|
||||
low wall hides (#44) and thickness (#45) were settled afterwards in 5.9 and 5.10." Historical
|
||||
provenance only; the surviving rules are current §1, §5.7, §5.8, §5.9, §5.10.
|
||||
Reference in New Issue
Block a user