Commit Graph
103 Commits
Author SHA1 Message Date
SirStone 5d38e92c03 results: rerun the slice 5 gates on the final tree (#20) 2026-11-15 09:37:33 +01:00
SirStone 9c512e74bc server: tidy the slice comments after the rollout (#20) 2026-11-15 09:37:33 +01:00
SirStone c9de8c7116 tools: the protocol group's landed/unlanded intent split (#20)
token.create now answers on its fields, so the 'not landed yet' examples move to
status.set and character.create (slices 7-8).
2026-11-15 09:35:43 +01:00
SirStone ae6054ea94 results: slice 5 test and mutation logs (#20) 2026-11-15 09:35:37 +01:00
SirStone 91192b36ce design: record the tokens and sight decisions (#20)
v0.17: migration step 4 (entity) and what it deliberately leaves out, the token
payload rules 6.1 was silent on (plain tokens only, radius/props/character_id
refused invalid, effective radius = scene default, descriptive name only on the
wire, controller null as the single GM spelling, explored RLE on connect), the
slice-5 resync, the egress timing, the fault classes built at this slice, the
slice-5 rollout, and the full decision record as a FIXED owner-delegated entry.
2026-11-15 09:35:33 +01:00
SirStone cae20d7c89 tools: WS probing and the token wire tests (#20)
tools/probing.test.mjs re-runs the M2 T8 probing test over the wire with a hostile
client: over-cap probes always get the one uniform nack (old position, no code), two
servers whose walls differ only beyond cap + token radius answer 90 identical
probes identically, and a wall inside that bound does change the replies, so the
harness is shown able to fail. It stays inside the 6.4 burst, so no probe is a rate
limit.

tools/tokens.test.mjs pins the wire behaviour of the slice: the 6.1 acks and codes,
the controller-only and GM-only rules, the connect resync order, the unnamed-player
gate, the door push and a restart.

tools/mutation.sh gains aa-af: the egress ignoring the view rule, gm_only and the
owner arm of the rule, a missing token_gone, a GM-only field in a player frame, and
explored forgetting cells.
2026-11-15 09:35:29 +01:00
SirStone 959412ff09 tools: leak driver, checker and the fault controls (#20)
tools/leak.mjs builds a 27-group scene over the real wire (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 each socket saw, one
group per mutation. tools/leakcheck.nim replays it: the GM socket is ground truth,
the subject's polygons and explored cells are recomputed from geometry.nim, and the
explored set is also probed with a clear-segment sampler. Subjects A and B both pass
with zero failures; the transcripts and logs land in results/.

tools/fault.test.mjs runs the same scenario against a -d:leakfault build for each
fault and asserts the EXACT class set (HIDDEN_TOKEN, GMONLY_TOKEN, WALLDATA,
WITHHELD, OTHER_PLAYER, NO_REMOVE, EXPLORED), plus that the shipped binary carries no
LEAK_FAULT string.

withserver can build a variant with extra -d: flags and pass an env to it; lib.mjs
can name a player out of band, the fixture the player-side tests need until slice 8
brings player.setname (the unnamed gate itself is pinned in tools/tokens.test.mjs).
2026-11-15 09:35:24 +01:00
SirStone 6fcf7f8271 server: token intents, the resync and the door push (#20)
token.create/update/remove (GM) and token.move (controller, or GM) through
moverules: the uniform nack for locked/over-cap/collision and for an out-of-bounds
GM move, one not-allowed code for a player's unknown and not-yours targets, not-found
for the GM; accepted moves are persisted with NORMAL durability and the mover's
vision recomputed. token.update honours kind, both names, controller, gm_only,
flags and vision_radius, and refuses character_id until slice 8.

connect now sends hello, the GM walls snapshot and the 6.3 token half (vision,
explored full, tokens) under the global lock, so hello is always the first frame and
the resync is the diff base. Egress runs under the same lock, per mutation, so no two
threads touch a connection's known table and an unnamed player is never fed state.

door.set applies the 5.5 push: the move rules compute the new positions against the
pre-write state, the positions are persisted in one transaction, then memory and
vision follow (stuck/squeezed are slice 7). player.remove hands the controlled
tokens to the GM in memory as the FK already does in the DB.
2026-11-15 09:35:19 +01:00
SirStone 5f5bf3293b server: typed recipient views and the single egress (#20)
server/views.nim is the only place where world state becomes bytes: a Recipient
builds a GmTokenView or a PlayerTokenView first, and only then a frame. Player
frames carry the public props bucket (plus owner for the controller), the
controller's vision_radius, and never kind, controller, gm_only, flags, radius_own
or either raw name; the GM gets all of it plus both names. The per-connection Known
table diffs on the built frame, so token/token_gone are exactly the changes and the
vision frame is re-sent only when the polygons move.

server/faults.nim compiles the negative-control hook only with -d:leakfault; the
shipped binary contains no LEAK_FAULT string and tools/fault.test.mjs asserts it.

hello gains the scene block (and extra for the GM); the protocol's implemented set
now names the four token intents.
2026-11-15 09:35:14 +01:00
SirStone e6b53e06f5 server: per-player vision, explored cells and the one view rule (#20)
server/vision.nim keeps one PlayerVision per player: a visibility polygon per
controlled token carrying the vision flag (range = the token's vision_radius or the
scene default), the explored set as the union of cellsTouched over history (only
grows, cells outside the world dropped), and the fresh cells of the current
mutation. The token-visibility rule of 3.1 (controlled always, otherwise inside own
LOS and not gm_only) exists exactly once there.

server/worldmap.nim translates the authoritative records into the inputs the pure
geometry and move-rule modules take, so those modules never see a wire field.
2026-11-15 09:35:09 +01:00
SirStone d38b871dfa server: token records and the entity migration step (#20)
Migration step 4 ("tokens") creates the entity table: the token id, scene, kind,
both names, position, nullable radius/owner/vision_radius, gm_only and flags. A
NULL owner is GM-controlled, so player.remove hands that player's tokens to the GM
through the FK; radius, props and character_id stay out until slices 7-8.

server/tokens.nim holds the record, the 6.1 field rules (12 CSPRNG characters from
a 64-symbol alphabet, trimmed names, kind, positive vision_radius), the write-through
persistence (FULL for GM authoring, NORMAL for a move) and the loader. db_connector
quotes every argument, so the three nullable columns are emitted as numeric literals
while text still goes through ? arguments.
2026-11-15 09:35:05 +01:00
SirStone 8b595156f0 results: slice 4 test and mutation logs (#19) 2026-11-15 08:49:44 +01:00
SirStone 864cf26e98 design: record the walls and doors decisions (#19)
v0.16. 4.4 gets migration step 3 (scene + wall DDL and the seeded v1 scene);
6.1 gets the wall payload rules the catalogue left open (scene id, a/b
validation, open never true on a wall, flags as an object, wall.update's
patch set, fields before lookup, ids from next_wall_id, synchronous=FULL);
6.1/6.3 note what slice 4 actually sends (`walls` on GM connect); 8 points
next_wall_id at the scene row; 14 records the whole slice as FIXED
(owner-delegated).
2026-11-15 08:49:42 +01:00
SirStone 6c3e8c6e18 tools: mutations t-z2 for the wall state (#19)
t: removal renumbers next_wall_id | u: the counter is not loaded from the DB |
v: the counter is never written | w: a wall may stay open | x: zero-length
walls accepted | y: endpoints unchecked against the world bounds | z:
door.set on a plain wall accepted | z2: persisted open state loaded inverted.
Control passes; every mutation fails its expected tests.
2026-11-15 08:49:24 +01:00
SirStone d72fc6ed20 tools: wall harness, and the walls frame in the existing groups (#19)
tools/walls.test.mjs: GM snapshot, CRUD acks and effects, ids monotonic and
never reused, the 6.1 validation table, door toggling, "players get no wall
data" (no walls/wall/wall_gone type and no wall coordinate in any player
frame) and a restart that leaves walls, door state and the id counter
identical. protocol.test.mjs/smoke.test.mjs follow the new frame and schema:
hello = 1, walls = 2, the first ack = 3; user_version 3 with the seeded scene.
2026-11-15 08:49:24 +01:00
SirStone a8f508ef2e server: wall and door intents, GM wall snapshot and fan-out (#19)
wall.add, wall.update, wall.remove and door.set leave the unknown-type rollout
list: field shapes and ranges per 6.1 (and the payload rules recorded FIXED in
4.4/6.1), lookup failures not-found, non-GM refused by the existing GM-only
gate. wall.add acks {id} from the scene's next_wall_id; wall.update patches
a/b/kind/flags only (open belongs to door.set); door.set is invalid on a plain
wall. Effects go to every GM connection only: wall / wall_gone, plus one walls
snapshot right after hello (the wall part of the 6.3 resync). Players receive
no wall data in any message (3.1, T2).

protocol.nim gains the wallObject/wallsFrame/wallFrame/wallGoneFrame builders
(no n: the sender stamps it per recipient) and the five wall intents in the
implemented set.
2026-11-15 08:49:20 +01:00
SirStone bf9ab3edfd server: scene and wall state, slice-4 migration (#19)
Migration step 3 ("world") creates scene and wall and seeds the single v1 scene
(id 1, 4096x4096, tile = cell 32, vision 400, token radius 20, art_version 1,
next_wall_id 1). server/world.nim holds the in-memory scene with SQLite as
write-through persistence: per-scene wall ids from next_wall_id (monotonic,
never reused, #3), 6.1 validation (a != b, in bounds, a wall is never open),
flags as an opaque JSON object, and one transaction with synchronous=FULL
around every GM authoring write (Q12); memory follows COMMIT, so a failed
write leaves both sides unchanged.

Tests: tests/tworld.nim (ids, reload, doors, validation, pragma, failed write),
tests/tdb.nim (version 3, history, a slice-2 DB migrating to slice 3).
2026-11-15 08:49:16 +01:00
SirStone 2a1e2dd71c results: slice 3 test and mutation logs (#18) 2026-11-15 08:33:16 +01:00
SirStone db22b33567 design: record the closing message and the protocol-shell decisions (#18)
Owner decision (#18), option A: mummy 0.4.8 cannot send an application close code
(close(ws) -> an empty close frame -> the browser sees 1005), and mummy is not forked
for it. Every server-initiated close now sends one closing {reason, code} message and
then the close frame; the client reads the reason from that last message. Amends 3.2
(the OPEN note is FIXED) and 6.5, and adds the message to the 6.1 catalogue (server
messages 14 -> 15) with the reason/code table.

Also recorded FIXED: proto is a required query parameter (400 when absent, 4003 on a
mismatch, no hello); the server Ping interval (20 s, plus one right after hello, lag
enforcement stays M5); the n rule (server frames only, no number for Ping/Pong); the
explicit 64 KB maxMessageLen; and the slice-3 rollout note that catalogue intents
whose slice has not landed answer unknown-type. 10.3 lists the protocol test group.
2026-11-15 08:33:16 +01:00
SirStone 951f37c3fb tools: mutations p-s for the protocol module and the n counter (#18) 2026-11-15 08:33:12 +01:00
SirStone 5e43ffa545 tools: raw WS client and the protocol test group (#18)
lib.mjs gains a node:net WebSocket client (frames, opcodes, masked sends, a close
handshake that mirrors a browser) so the harness can send what the global WebSocket
cannot: oversize, binary, unmasked, bad-opcode and garbage frames, and read Ping/Pong
and the empty close frame. wsUrl/rawUpgrade now carry the required proto query.

withserver.mjs gains the GM-server helpers (gm-key, withGmServer, signIn, openAs) that
auth.test.mjs used to keep privately, so both harnesses share one copy.

protocol.test.mjs is the protocol group of DESIGN 13 M3: hello/n, catalogue types,
proto, unknown type and ignored fields, exactly one ack per reqId, unnamed player,
malformed + binary frames, the flood close, the intent bucket, the 64 KB boundary,
unmasked/bad opcode, server Ping and Pong, the connection cap, and closing-then-1005.
auth.test.mjs now also asserts the closing reason on eviction and revocation.
2026-11-15 08:33:12 +01:00
SirStone 88dd27e2cc server: hello, one ack per intent, proto check, rate limit, flood, ping (#18)
The protocol shell over the socket, in DESIGN 6.5 order: spend a token, parse, then
unknown type / unnamed player / role / fields / lookup / semantics. Every readable
intent gets exactly one ack with a 6.5 code; an unreadable frame gets one error.

- hello {proto, role, me} as the first frame (n = 1); the scene block lands in slice 5
- /ws?proto=N is required: 400 when absent or not an integer, 101 + closing 4003 on
  a mismatch (no hello, no state)
- intent bucket 30/s burst 100 and the 10-in-10-s malformed flood (closing 1008);
  a rate-limited intent applies nothing and the connection stays open
- mummy maxMessageLen stated explicitly (64 KB) and mummy's own log lines routed
  through the event log instead of stdout
- server Ping(seq) right after hello and every 20 s (lag enforcement stays M5);
  inbound Pings are answered with a Pong, which mummy does not do itself
- close reasons: every server-initiated close sends closing {reason, code} then the
  close frame, and slice 2's eviction/revocation paths do the same (FIXED, #18)
2026-11-15 08:33:07 +01:00
SirStone 7e2d5b8dc0 server: per-connection wire state and closing frames in the conn registry (#18)
Conn now carries what DESIGN 6/6.4/6.5 need per connection, all under the one
registry lock: the outgoing n counter (starts at 1, server frames only), the intent
token bucket, the malformed-flood window, the player's named flag and the last Pong.
None of it is shared, so the n counter is not a global side channel (H25).

activate/revokePlayer now hand back the doomed Conn values instead of raw sockets:
the caller still has the frame count, so the final closing frame carries the right n
before the close. Tests cover per-connection counters, the bucket and the flood
window in isolation, and that a snapshot survives the lock.
2026-11-15 08:33:07 +01:00
SirStone eb48034eba server: wire protocol module - envelope, frames, rate limit, flood window (#18)
Pure, mummy-free module for the protocol shell: the envelope rules of DESIGN 6.5
step 2 (UTF-8 text, JSON object, string t, integer reqId in 0..2^31-1), the frame
builders of 6.1 including closal/closing, the per-connection intent token bucket
(30/s, burst 100) and the malformed-flood window (10 in any 10 s), plus the FIXED
constants: proto 1, 64 KB inbound, close codes 4001/4002/4003/1008 and their reason
strings. The 29-intent catalogue and the GM-only set live here so 'unknown type'
and role checks have one definition.

Found while testing: std/json parseJson("") returns nil instead of raising, and
node{"t"} is nil for a missing key, so both are guarded (a bare {} would have
crashed the handler).
2026-11-15 08:33:01 +01:00
SirStone 527e216c37 design: mark sign-in path and ws origin check fixed (#17) 2026-11-14 22:13:25 +01:00
SirStone 8ff66530d8 results: slice 2 test and mutation logs (#17) 2026-11-14 22:13:09 +01:00
SirStone f85665b53e design: record slice 2 decisions (#17) 2026-11-14 22:13:09 +01:00
SirStone 9d43aef9ed server: /join, session cookies, ws auth and gm-key CLI (#17) 2026-11-14 22:13:09 +01:00
SirStone e612db5826 server: auth schema, keys, sessions, connection registry (#17) 2026-11-14 22:13:04 +01:00
SirStone c89c8eab42 results: slice 1 test and mutation logs (#16) 2026-11-14 21:41:33 +01:00
SirStone 86e7ad397d design: record slice 1 decisions (#16) 2026-11-14 21:40:48 +01:00
SirStone a3c1ac36ef devbox: nodejs 26, sqlite, test runs Nim then Node (#16) 2026-11-14 21:40:44 +01:00
SirStone 65b8f0a148 tools: Node 26 harness base, smoke and ws-header checks (#16) 2026-11-14 21:40:44 +01:00
SirStone f376efdc39 server: config, migrations, redacted logging, /healthz entrypoint (#16) 2026-11-14 21:40:39 +01:00
SirStoneandClaude Haiku 5.5 143cb534dc design: retag gm-key service user as owner-delegated (#13)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-14 20:58:58 +01:00
SirStoneandClaude Sonnet 5.5 4465e7e89d design: M3 slices and gm-key service user (#13)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 20:56:32 +01:00
SirStoneandClaude Haiku 5.5 7667e28f5e design: owner review of message list flags (#11)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-14 20:49:11 +01:00
SirStoneandClaude Sonnet 5.5 277cb5f896 design: fix M3 message list (#11)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 20:42:16 +01:00
SirStoneandClaude Haiku 5.5 2801fbcca5 design: fix M3 limits (#15)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-14 20:12:15 +01:00
SirStoneandClaude Haiku 5.5 356a70f2b5 design: fix M3 done criteria (#12)
M3 done = devbox run test green on a clean checkout with nine named
groups (leak+fault, tiles, probing, protocol, auth, characters and
names, restart, persistence, logs). Concurrency moves to M5, bind check
to M6. Protocol limits pending on the "M3 limits" card.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-14 19:47:06 +01:00
SirStoneandClaude Haiku 5.5 acc69c9fb6 design: fix test tools (#9)
Node 26 black-box harnesses under tools/ (no Nim rewrite, no npm deps);
in-process tests stay Nim; devbox run test runs Nim then Node.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-14 19:35:54 +01:00
SirStoneandClaude Haiku 5.5 8c03224f2a design: fix map tiles in M3 (#7)
Tile gate, test nginx and generated 32 px fixtures in M3 scope.
Versioned private tile URLs (art_version, Cache-Control private).
404 for malformed paths, 403 for unexplored tiles.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-14 18:41:34 +01:00
SirStoneandClaude Haiku 5.5 0772f26400 design: fix players and player keys (#6)
One shared site link; each player signs in with a personal player key
generated by the GM. GM signs in the same way with a GM key from
`fff-vtt gm-key` (replaces gm-link, #5). GM can replace a key live
(old key invalid, sessions and connections revoked). Removing a player
passes characters and tokens to the GM. No rate limit on key entry
(owner decision: ~100-bit key space).

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 19:27:22 +01:00
SirStoneandClaude Haiku 5.5 d9e135f6bd design: fix characters and player data (#14)
Characters are own records separate from tokens; tokens may link to one.
Character owner: exactly one (player or GM). Token controller is independent
and never changes with the character owner. Identity lives on the character,
per-figure state on the token. Descriptive/actual names revealed per player
or to all. Per-player encountered list, GM-removed only. Server-side SQLite only.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 19:11:16 +01:00
SirStoneandClaude Haiku 5.5 ae2f7c48dc design: fix first GM login bootstrap (#5)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 18:04:11 +01:00
SirStoneandClaude Haiku 5.5 90576381df design: fix token size and stuck/squeezed statuses (#4)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 17:51:02 +01:00
SirStoneandClaude Haiku 5.5 48b77888c6 design: fix wall and token ids (#3)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 17:13:25 +01:00
SirStoneandClaude Haiku 5.5 91cea1a364 research: mummy 0.4.8 and db_connector API facts (#10)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 16:54:03 +01:00
SirStoneandClaude Haiku 5.5 8f65680176 research: M3 test harness WebSocket options (#8)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-10 16:52:29 +01:00
SirStoneandClaude Haiku 5.5 c9d94e40b2 docs: handoff for M3 session
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-08 19:22:51 +01:00