Commit Graph
179 Commits
Author SHA1 Message Date
SirStone c1b1e9cf91 feat(db): typed wall storage, marker_seen and height backfill (#53) 2026-11-19 22:03:11 +01:00
SirStone 6a443b4ec0 docs: mark Walls r1 test artefacts as planned 2026-11-19 21:49:29 +01:00
SirStone a4253957e0 docs: wall.update open is not a patch field 2026-11-19 21:40:00 +01:00
SirStone 0d5173d56b docs: trim duplicate statements from TESTING; refresh ledger size 2026-11-17 23:25:18 +01:00
SirStone 1c655314ed docs: record the DESIGN/TESTING split ledger
Sizes before/after, the moved-block ledger, per-section FIXED counts and the
judgement calls left in DESIGN; cross-reference check for § and TESTING links.
2026-11-17 23:24:52 +01:00
SirStone 6bfb032548 docs: finish the DESIGN/TESTING split (§6-§13)
Protocol, client, ops and milestone sections keep their rules and gate criteria;
message-size measurements, close-assertion detail, the test nginx, the restore
drill, the slow-log provenance and the M3/M4 gate mechanics move to TESTING.
DESIGN §10 becomes a pointer section that keeps 10.1-10.4 so existing refs
resolve.
2026-11-17 23:22:48 +01:00
SirStone e9c29675de docs: retarget ADR and research refs to TESTING
ADR-0015 no longer cites DESIGN §10.3 (now a pointer); ADR-0012 and the
thick/low-wall research note name TESTING.md for the proof side.
2026-11-17 23:22:48 +01:00
SirStone bc10780625 docs: point DESIGN §5 at TESTING; move vision/bench proof out
Edge-case counts and bug regressions, the perf table and bench scenes, oracle
citations, the move-rule regression baseline, the see-over oracle spec and the
thickness/joint measurements move to TESTING §5.1-§5.10. Targets, the 5k-wall
gate and the accepted thickness cost stay in DESIGN.
2026-11-17 23:22:06 +01:00
SirStone 6837bbcf11 docs: point DESIGN §3-§4 at TESTING for their proofs
Security and server sections keep the rules; measured runs, oracle citations,
test pins and the threat table's Test column move to TESTING §3.1, §3.3, §3.4,
§4.1-§4.4.
2026-11-17 23:21:16 +01:00
SirStone 39615afdf6 docs: add TESTING.md with the proof detail split out of DESIGN
New file holds test, acceptance, oracle, fault-class, gate and bench detail,
organised by DESIGN section number with a back-link per block. Tags, tickets
and evidence paths are preserved.
2026-11-17 23:21:16 +01:00
SirStone 9143cee536 docs: race fix merged 2026-11-17 23:17:06 +01:00
SirStone c5ec25eb11 merge: fix JsonNode race across worker threads 2026-11-17 23:13:25 +01:00
SirStone bd320014ca docs: final split-check sizes 2026-11-17 23:13:00 +01:00
SirStone 3ed8107908 docs: fix the D2 pointer in the history log 2026-11-17 23:12:43 +01:00
SirStone 7468196111 docs: record the 22nd reworded block in the split check 2026-11-17 23:12:33 +01:00
SirStone d8c807bbf2 docs: point wall geometry wire validation at 5.7/5.10
One statement of the thickness/position/height ranges; the wall payload rule keeps only the
defaults and the patch behaviour.
2026-11-17 23:12:25 +01:00
SirStone de633642c5 docs: mark DESIGN split done and record the verification (#51)
D2 marked done; the M3 handoff is marked historical with the §14-log pointer; the split
check records sizes, the section mapping, FIXED-marker coverage, the blocks that changed
wording and every statement dropped as superseded.
2026-11-17 23:12:08 +01:00
SirStone dc16db1b72 docs: rewrite DESIGN.md as the current-only spec (#51)
Same section numbers as v0.30, so all DESIGN §x.y references still resolve. Removes the
change log, the decision log, the HANDOFF table and the superseded/duplicated statements
(history + ADRs hold those); dedupes rules to one authoritative block with wire/storage/
recipient layers pointing at it; §14 now holds only open items and the ADR index; all prose
wrapped. No decision changed.
2026-11-17 23:12:08 +01:00
SirStone 8aaf03be04 docs: add ADRs for the durable design decisions
22 ADRs: server-authoritative sight and single egress, per-recipient views/diffs, uniform
nack, opaque ids, 32 px tile unit, wall switches/presets, see-over, thick walls, open-door
gap, typed wall columns, proto 2, build order, zoom clamp, accepted status leak, player
marker, chunked explored, slow-client policy, session/key split, closing message, character
records, global lock, synchronous choice. Each links its tickets and its spec section.
2026-11-17 23:12:04 +01:00
SirStone 7a69779c5a 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.
2026-11-17 23:12:04 +01:00
SirStone 08363ef086 fix: stop sharing intent JSON refs with the world across worker threads
Mummy runs websocket handlers on worker threads. Intents are parsed outside
the one global lock, while the world is walked under it; ORC refcounts are
not atomic, so any JsonNode or string payload reachable from both an intent
tree and the world can be freed or leaked by two threads at once.

- Add server/jsonbound.nim: detachedJson/detachedString/detachedProps copies
  that share neither nodes nor string payloads (serialise+parse; std/json's
  copy() would still alias JString payloads).
- Detach every intent value that enters world state: wall.add/wall.update
  flags; token.create flags/props/names/kind/character_id; token.update
  patch fields; prop.set key and value (token and character); character.create
  props/names; scene.set name/extra. Use the world's own id in name.reveal.
- Build wall effects and create acks inside the mutation's critical section
  (settleLocked/settleWorldLocked). Wall/token/character record copies and
  frames no longer outlive the lock; only fresh scalars cross it.
- Move player.remove's in-memory follow-up under the lock (it mutated tokens,
  characters, visions, reveals and encountered outside it).
- Cap mummy at 4 worker threads (default was 10x cores) for a seven-person table.
- Add tests/tdetach.nim: identity and string-payload checks for the boundary
  helpers, plus the parseFlags-returns-the-caller's-node premise. A unit test
  can prove the copy semantics, not the absence of a race.
2026-11-17 23:02:32 +01:00
SirStone 7b804f4e5e docs: analysis review and decisions 2026-11-17 22:45:58 +01:00
SirStone 287859d890 design: wall wire format, schema and migration (#49) 2026-11-17 22:31:16 +01:00
SirStone 2a160fb274 design: door geometry, thick doors and door push (#50) 2026-11-17 22:17:16 +01:00
SirStone 409d2c8621 docs: tag #42 preset list superseded by #48 2026-11-16 22:42:56 +01:00
SirStone 7ac915ae6c design: terrain dropped, presets, window markers (#48) 2026-11-16 22:39:20 +01:00
SirStone b8f04c2faf design: windows and one-way walls (#47) 2026-11-16 22:08:14 +01:00
SirStone 5c3a123d41 design: thick walls sight and movement (#45) 2026-11-15 21:53:55 +01:00
SirStone afe19ac258 design: secret and locked doors (#46) 2026-11-15 19:27:15 +01:00
SirStone 4c968b78d8 design: low walls sight and see-over (#44) 2026-11-15 19:21:10 +01:00
SirStone 7511daa3c5 design: wall switches, presets and one-way sight (#42) 2026-11-15 18:23:26 +01:00
SirStone a7f302ec26 design: height model for tokens, eyes and walls (#41) 2026-11-15 16:47:40 +01:00
SirStone b4720779d4 research: sight with thick and low walls (#39) 2026-11-15 16:12:15 +01:00
SirStone d5147ec4db research: how tabletops model wall kinds (#40) 2026-11-15 15:54:46 +01:00
SirStone b6c006d08b agents: add bug and enhancement category labels 2026-11-15 15:30:23 +01:00
SirStone c78ed7969b glossary: wall term from #26 triage 2026-11-15 15:25:24 +01:00
SirStone e13fa905a4 results: rerun the gates on the fixed tree (#27-#31)
devbox run test: nimble suites and 107 node tests pass (was 103: +1 characters,
+2 tiles, +1 restart). devbox run mutation: control and every mutation pass,
including the new e1-e3 and the repointed b2.
2026-11-15 14:26:23 +01:00
SirStone b4bddf1d52 design: record the #27-#31 rules and the measured egress numbers (#27-#31)
6.1: a link patch hands the token's names over; the encountered snapshot is
written by one path in both stores, and a reveal is scoped to its player. 4.3:
egress borrows (never copies) under the lock, and the scene is a value swapped
under the lock that each request reads once. 10.3: STALE_NAME is a leakcheck
class. 14: the five fixes, their tests and mutations, with the before/after
egress measurements (context build 4.87 ms -> 0.008 us at 262144 cells; GM
egress 142.8 ms -> 0.80 ms). Doc bumped to v0.20.
2026-11-15 14:26:23 +01:00
SirStone f963e8f4d6 main: read the scene once per request, under the lock (#31)
scene.set reassigns app.scene under dbLock while the HTTP handlers read it with
no lock and no stable snapshot: tileGate read it three times (twice outside the
lock) and checkScene read the id unlocked, so a swap could hand a request two
records, or race ORC freeing the old walls seq. tileGate now takes one snapshot
under the lock and uses it for the URL parse, the explored check and the
X-Accel-Redirect; checkScene and scene.set read under the lock; the wall/door
handlers capture sceneId inside their lock for the post-lock log and effect
frame.

Tests: ttiles pins that one record gives one whole answer after a swap;
tiles.test.mjs pins the handler shape (one code read, after the lock) and
interleaves 20 scene.set plus wall edits with 200 tile fetches -- only whole
tiles, no crash.
2026-11-15 14:26:15 +01:00
SirStone e9d5f6815a views: borrow the world in egress instead of copying it (#28)
views.Context held copies of scene, tokens, characters, reveals, encountered
and visions, so every mutation deep-copied each player's explored HashSet under
the global lock; playerView then copied its own PlayerVision again and greyFor
copied one per encountered entry. Context now holds six pointers
(contextOf/borrow), playerView/gmView read a ptr PlayerVision and a view builds
each player's visible-id set once per frame, so grey is a set test.

Measured on this build's types (debug, 6 players, 40 encountered entries, 40
world tokens, 16384 / 262144 explored cells): context construction 0.227 ms /
4.87 ms -> 0.008 us; one getOrDefault of a PlayerVision 28.8 us / 591 us -> gone;
GM egress pass 8.0 ms / 142.8 ms -> 0.79 ms / 0.80 ms; player pass 1.45 ms /
25.7 ms -> 0.32 ms. Behaviour is unchanged (leak/fault suites and tviews green);
tviews pins the borrow by identity, the six-pointer size and both sizes inside
the M5 7.5 ms budget.
2026-11-15 14:26:11 +01:00
SirStone 8e045b0ac8 names: per-player reveal, one encountered write path, link by update (#27, #29, #30)
name.reveal wrote the subject's actual name into the encountered row of every
player who had met it: the SQL had no player predicate, so the leak was silent
live and visible only after a restart. rewriteEncountered is now the one path
that keeps a snapshot in step with its subject: it rewrites the SQLite row and
the live in-memory entry together from the name rule, takes onlyPlayer for
name.reveal (every player for reveal_all), and also runs on a rename, a link
change and an owner change, so the wire and a post-restart reload cannot
disagree (#30). The DB-only renameEncountered*/revealEncountered* helpers are
gone, which is what let the two stores drift.

token.update {character_id} now drops the token's own two names as part of the
link patch (#29): a plain token can be linked, names supplied with a link stay
invalid and unlinking still needs both names.

Tests: tcharacters covers the per-player row, the DB/memory equality, the link
handover; restart.test.mjs builds three named players, reveals to one of them
and asserts the rows directly and the whole resync over SIGTERM/SIGKILL, plus a
mid-session rename; leak.mjs/leakcheck.nim pit two players on the same subject
and pin each entry's expected name (STALE_NAME). Mutations e1-e3 and the
repointed b2 pin the three rules.
2026-11-15 14:26:07 +01:00
SirStone e68c6eefbf design: owner confirms prop registry fallback (#22)
Mark the 6.1 property-schema registry as an owner decision (2026-11-15):
keep the empty registry with the permissive fallback in v1, strict mode
with the FFF seam post-v1. Record it in 14 and bump the doc to v0.19.
2026-11-15 13:06:58 +01:00
SirStone 76ec6f4b3d results: rerun the M3 gates on the final tree (#25) 2026-11-15 13:03:54 +01:00
SirStone 2c0ce47134 design: record the measured M3 gate results (#25) 2026-11-15 13:03:51 +01:00
SirStone e713e05931 tools: define the scene.set mutation after the dispatcher (#25) 2026-11-15 12:55:58 +01:00
SirStone 14939afd81 design: record the finish line, the scene rules and the M3 acceptance checklist (#25) 2026-11-15 12:52:23 +01:00
SirStone cedb80aa96 tests: the restart and logs groups, the nine-group checklist and the fixture clean-up (#25) 2026-11-15 12:52:20 +01:00
SirStone 70a984c55a server: scene.set closes the 29-intent catalogue, plus a log-leak fault hook (#25) 2026-11-15 12:52:17 +01:00
SirStone df2b186267 results: rerun the slice 9 gates on the final tree (#24) 2026-11-15 12:30:53 +01:00
SirStone 7ef5cc433a design: record the map-tile gate and test nginx decisions (#24) 2026-11-15 12:30:53 +01:00