Commit Graph
192 Commits
Author SHA1 Message Date
SirStone a5c0ee5d4c fix: dispatch guard and Defect-safe rollback (#32)
A readable intent that fails in handling now always gets exactly one ack:
the new static internal code, unless the handler's own ack was already
enqueued. Both transaction helpers roll back on every unwind path,
Defect included, so the shared SQLite connection never keeps an open
transaction. Test-only dispfault build covers catchable/defect/after-ack;
DESIGN 6.5 records internal as an owner decision and 6.2 names refusal
codes as additive.
2026-11-20 21:36:44 +01:00
SirStone 38941da003 test: walls r1 review — tests and tools
Ref #52
2026-11-20 08:59:24 +01:00
SirStone e1a5b297e4 fix: walls r1 review — server (ref #52) 2026-11-20 08:42:50 +01:00
SirStone f9f26a4a01 test(walls): rewrite the leak scenario as one world, gate every fault class (#61)
The Walls r1 scenario had grown appendages: a marked window bolted on in the
room, a one-way wall tacked onto the southern walk, and no secret or locked
door at all. #61 makes it one coherent world and proves the world itself.

The world now holds a room entered through an opening door, a far wall with a
solid stretch, a secret door and a locked door (a token behind each, so their
absence from the transcript is the leak proof), a one-way screen the subject
sees across, a marked window in the room, the same window's switch cleared and
restored (retraction and re-earn end to end), a marked solid wall, and a marked
window the subject never sees.

- tools/leak.mjs: declarative WORLD with role handles (no wallIds[1] indexing),
  narrative groups, and a scenarioCoverage() reading the GM's wall frames and
  the subject's marker frames.
- tools/leak.test.mjs: asserts the coverage on subject A: one-way wall, secret
  door, locked door, a marked window on each side of the sight gate and a
  marked non-window.
- tools/groups.mjs: the leak+fault group lists doors.test.mjs (#56) and
  markers.test.mjs (#59/#60) with their proving tests.
- docs/TESTING.md: the scenario, the coverage gate and the marker retraction
  exercise are recorded as built.

Fault matrix: all 21 fault classes still caught as exactly their own class
(oneWay, markerEarly/Extra/Off included); 22 tests with the clean-build gate.
That build passes and its bytes carry no LEAK_FAULT. nimble test and the
136-test node suite green.

Ref #61
2026-11-19 23:58:45 +01:00
SirStone a69563f701 fix: marker_seen deletes commit with the wall change
A wall cause change (endpoint move, thickness/position, player_marker off,
no longer window) committed the wall row in the FULL transaction while its
marker_seen deletes rode the later NORMAL derived-memory transaction. A crash
between them left the stale row, and restart restored the marker with the
anchor recomputed from the NEW geometry, revealing a position the player never
saw (DESIGN 5.8).

updateWall now deletes the affected rows in the same FULL transaction as the
replaced row, exactly as the composite FK cascade already does for wall.remove.
The live del frames are unchanged and marker inserts stay in the derived
transaction: wall+deletes commit, derived inserts, then ack.

The marker cause signature moves to world.markerSig so the write-time delete
and the online retraction cannot drift.

Proof: a leakfault-only markerCrash hook quits between the wall commit and
the derived write; tools/markers.test.mjs covers all four causes and restarts
on a clean build, asserting no marker for the changed wall (no new anchor) and
restoring the untouched window's marker as the positive control.

Ref #60
2026-11-19 23:52:13 +01:00
SirStone c3c0a39188 feat(walls): marker retraction, re-earn and marker fault classes (#60)
Retract a player marker when the GM removes the wall, clears
player_marker, makes the wall stop deriving window, or moves its
geometry (a/b, thickness, position). Retraction emits del only and
never the new anchor; a re-earned marker gets a fresh id. The
marker_seen deletes ride the same derived-memory NORMAL transaction as
the explored chunks, after the wall row commits and before the ack.

Replace the leak checker's aggregate MARKER class with MARKER_EARLY,
MARKER_EXTRA and MARKER_OFF, add their leakfault hooks and exact-class
fault tests, and extend the leak scenario with an unseen marked window
and a marked solid wall as the negative controls. WS black-box tests
cover all four causes, fresh re-earns, no untouched re-send, no
set/del for one id in a frame, no explored write from a retraction,
and delete/cascade durability across a restart.
2026-11-19 23:43:44 +01:00
SirStone edd4437f7e feat(walls): player markers — emission, opaque ids, storage, resync (#59)
A wall that is player_marker:true and derives window sends a player one
anchor (the drawn midpoint, integer px) and an opaque per-player 12-char id
once any point of its segment enters that player's vision polygon. Markers
live in PlayerVision like explored, persist to marker_seen in the same
derived-memory transaction, load before the first connection and resync as a
full set after explored; the GM and other players never receive one.

- markers.nim: emission gate, visible-extent test, id mint, anchor, marker_seen I/O.
- views/main: PlayerView markers + full/diff frames, refresh sync, startup load.
- markers.test.mjs: window preset, switch off, solid wall, any-part anchor,
  walk-away/door/lost sight, full-after-explored, per-player privacy, GM none.
- leakcheck: marker allowed type + independent visible-extent oracle with a
  positive control (a marked window the subject sees).
- restart: marked window in the fixture; marker set and marker_seen rows
  identical before/after SIGTERM and SIGKILL.
- protocol/tviews: catalogue and frame order pin the 16th message.

Retraction, re-earning and MARKER_* faults are #60.

Ref #59
2026-11-19 23:27:26 +01:00
SirStone e989100f50 feat(walls): windows — see-through barrier, movement follows blocks_movement (#57)
- geometry.Wall carries the stored blocks_sight/blocks_movement switches; sight asks
  blocksSight, movement and the status rules ask blocks (open door passes both).
- worldmap translates both switches; moverules only pushes on a movement barrier.
- leakcheck and the tile oracle read blocks_sight independently.
- Walls/token-details/tiles groups prove both forms, sight-through, stuck, push and
  the locked-window open refusal; existing scenes stay byte-identical.

Ref #57

# Conflicts:
#	server/geometry.nim
#	server/world.nim
#	server/worldmap.nim
#	tools/leakcheck.nim
2026-11-19 23:09:05 +01:00
SirStone cc566ee16e docs: one-way wall blocks the blind side (fix §5.1 inversion) 2026-11-19 23:03:37 +01:00
SirStone 9fcbe885c1 feat(walls): one-way sight per-viewer filter and ONEWAY fault (#58)
The vision fan blocks a sight-blocking one-way wall only for a viewer on
its blind side (sight_dir names it; left is the (-dy,dx) normal of a->b),
one sign test inline after the radius cull, so the hoisted wall list stays
viewer-independent. Movement never reads the direction: one-way walls block
both ways. Explored and tiles therefore differ by side and only ever grow.

- geometry: WallDir + Wall.sightDir + blindTo, filter in visibilityPolygon.
- worldmap: sight_dir mapping (movement mapping unchanged).
- vision: the ONEWAY leak-fault build drops sight_dir player-side.
- leakcheck: own side test for the fan and the clear-segment oracle; ONEWAY
  class detected against the sight_dir-dropped fan.
- leak scenario gains a one-way wall the subject sees across; fault test
  asserts exactly ONEWAY.
- oneway.test.mjs: both sides, tile sweep with its own oracle, flip with
  fixed endpoints, monotone explored/tiles, restart, two-way movement.
- docs: DESIGN 5.8 mechanism sentence corrected; TESTING #58 markers built.
- nginx harness: temp dirs created recursively (restart on one state dir).
2026-11-19 22:57:39 +01:00
SirStone 0f3aa2300f feat(walls): door refusals and secret/locked equivalence gate (#56)
- door.set: opening a secret or locked door is invalid; closing either is
  allowed; a fixed window/non-door still has no open state.
- new tools/doors.test.mjs: two fresh servers, one identical script, three
  equivalence pairs (secret/wall, secret+locked/wall, locked/closed door),
  canonicalised frame + full per-player tile sweeps, an open-door positive
  control and a pinned zero-thickness close-push.
- secretgap fault hook (sight-only) makes the pair fail as exactly SECRETGAP;
  the clean pair passes and the shipped binary carries no fault hook.
- docs/TESTING.md T2/T17 and the door-equivalence/10.3 sections: built.

Ref #56
2026-11-19 22:49:39 +01:00
SirStone 484275e8bb feat(walls): presets, label rule and one switch-set validation path (#55)
wall.add/wall.update now take a preset or raw switches, never both:
resolveWall expands the four 5.8 presets to switches before validating, so
a preset never touches geometry and preset+switch or preset+open is invalid.
A raw create starts from the wall defaults; a raw update patches only the
switches it names and {door:false} closes and de-secrets.

The switch-set invariants are enforced by that one path for add and update:
open/secret/locked without a door, a secret door that is open/one-way/not
opaque, open with secret or locked, and a direction with no sight to block
are all invalid. The DB gains the missing open+locked CHECK as the backstop,
and the now-redundant open/door parity test is gone from the server path.

A wall label is now the 6.5 text rule: trimmed, 1..64 code points, no control
characters, null clears, stored verbatim and GM-only. window/one_way presets
are accepted and expanded to their switch sets per DESIGN 5.8/6.1; their
player-facing behaviour stays with #57/#58.

Tests: WS black-box presets/patch semantics/every refusal/label round-trip;
Nim shape pins for expansion, invariants and the label rule.
Nim 385 / Node 117 green.
2026-11-19 22:35:57 +01:00
SirStone 77fa2dfe4c feat(walls): proto 2 typed wall record, inert geometry, derived kind (#54)
wall.add/wall.update take thickness, position, height and the eight raw
switches; kind is output-only and the GM wall frames echo the full typed
record. Geometry is stored but inert (0/full/centre behaviour), and the
legacy kind/open wire adapter is gone. proto is bumped to 2 with the
harness default, and BannedAlways gains every wall field name with a
WALLDATA positive control.

Tests: schema-7 migrated scene vs the same walls authored via raw switches
gives byte-identical player frames, refusals and per-tile statuses.
Nim 382 / Node 113 green.
2026-11-19 22:21:47 +01:00
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