Commit Graph
135 Commits
Author SHA1 Message Date
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
SirStone 30512127b0 tools: test nginx, generated tile fixtures and the tile group (#24) 2026-11-15 12:30:51 +01:00
SirStone 669e47e1ba server: the map-tile gate and the internal X-Accel path (#24) 2026-11-15 12:30:48 +01:00
SirStone 5ff15c4b36 results: rerun the slice 8 gates on the final tree (#23) 2026-11-15 12:11:42 +01:00
SirStone ea6d92bf76 server: refresh a player's sight when a connection starts receiving state (#23) 2026-11-15 12:11:42 +01:00
SirStone 1ad9f724f2 tests: drop the two unused imports (#23) 2026-11-15 12:02:52 +01:00
SirStone 74272c1e70 results: rerun the slice 8 gates on the final tree (#23) 2026-11-15 12:01:40 +01:00
SirStone dab7c77675 design: record the characters and names decisions (#23) 2026-11-15 12:01:33 +01:00
SirStone 54ecf7bf6a tools: nine mutations for the name rule, the snapshots and the character link (#23) 2026-11-15 12:01:30 +01:00
SirStone c4b97ec16c tools: name players through player.setname, and the character groups and four fault classes (#23) 2026-11-15 12:01:30 +01:00
SirStone f134534c6c tests: characters, names, the encountered list and migration step 7 (#23) 2026-11-15 12:01:30 +01:00
SirStone 20dcb87afb server: the character and name intents, player names and the roster (#23) 2026-11-15 12:01:26 +01:00
SirStone 5977d45a5a server: characters, names and the encountered list in the one egress (#23) 2026-11-15 12:01:26 +01:00
SirStone 75c3e046f8 server: the character, reveal and encountered records and migration step 7 (#23) 2026-11-15 12:01:21 +01:00
SirStone 34a33b5ead results: rerun the slice 7 gates on the final tree (#22)
devbox run test green: 317 Nim [OK] blocks and 77/77 Node harness tests
(migration step 6, the details group, the twelve fault classes).
devbox run mutation green: control plus a..au, no survivors, no no-ops.
2026-11-15 11:09:15 +01:00
SirStone 3c6e926122 design: record the token details decisions (#22)
Migration step 6, the status/source payload rules, the prop caps and the
property-schema registry (empty at start with a permissive fallback, because
8 says v1 never interprets props), and the grow-push search that 5.6 left
PROPOSED are all FIXED owner-delegated in 5.6/6.1 and summarised in 14. The
token payload rules now say `radius`/`props` are accepted on create from
slice 7 and refused nowhere else. 10.3 lists the three new fault classes,
and the glossary gains property, bucket and registry.
2026-11-15 11:02:43 +01:00
SirStone e103c3ed5c tools: the details group, the leak scenario's props and three fault classes (#22)
tools/details.test.mjs is the slice's WS acceptance: the five intents and
their codes, a grow push clear of a wall, a squeeze in a corridor too narrow
for the grown token, stuck from a wall and from a GM placement cleared by a
removal and by a shrink, the GM source of a status, the caps and who reads
which bucket, and a restart that brings size, props and statuses back. Waits
use a cursor taken before the intent, so a repeated state cannot be matched
by an older frame.

The leak scenario gains a token in view with props in all three buckets, a
GM-sourced status, a resize, a wall over it and the clears; leakcheck refuses
the `gm` bucket (GM_PROP), the `owner` bucket on a non-controller
(OWNER_PROP) and any `source` on a player status entry (STATUS_SOURCE), so
`fault.test.mjs` now asserts all twelve classes. The schema-version fixtures
in smoke/persistence move to 6, and mutation.sh gains am-au plus the renames.
2026-11-15 11:02:43 +01:00
SirStone 20575f2147 tests: props, statuses, the resize rules and migration step 6 (#22)
tests/tprops.nim is new: the caps (per bucket, keys, values), the key rules,
the registry (empty fallback, a registered key's kind and bucket), set/unset
and the clone that keeps an edit away from the original bucket.

ttokens covers radius, the three buckets, the status set (round trip, sorted,
replaced rather than appended, removed by the FK cascade). tmoverules covers
per-token radius, shrink/grow/squeeze, the no-crossing rule, the corner
relaxation and the independence of the two sources; the old `blocked` tests
became `stuckWalls`. tviews covers the bucket and source filtering, one
`token` frame per change and the effective radius. tdb/tdb's fixtures move to
step 6, and tprobing follows the rename.
2026-11-15 11:02:43 +01:00
SirStone 81898ab69c server: resize, status and prop intents in the mutation pipeline (#22)
`token.resize`, `status.set`, `status.clear`, `prop.set` and `prop.unset`
answer the 6.1 acks and codes; `token.create` now accepts `radius` and
`props` and computes the placement status before writing the row, so a token
dropped on a wall is born `stuck`. `token.update` keeps refusing the
character link and ignores `radius`/`props` (their intents own them).

Wall add/update/remove and door.set now run the pure rules on a snapshot
taken before the write and apply the outcome after it committed
(`applyRuleOutcome`: positions and walls-sourced statuses in one NORMAL
transaction, memory after COMMIT), which replaces the door-push-only helpers
and adds the 5.5 SET/KEEP/CLEAR rules and the squeeze of a failed push. A
value over the bucket cap is refused without touching the token (the clone
makes the cap check side-effect free). Prop keys are never logged.
2026-11-15 11:02:35 +01:00
SirStone dcc813225f server: per-recipient props and statuses in the one egress (#22)
The typed views carry the bucket filter: `PlayerTokenView` has `propsPublic`
always and `propsOwner` only when the recipient controls the token, and no
field for the `gm` bucket at all, so a later change to the frame builder
cannot leak one. Statuses are `StatusKind` values for a player (no `source`,
5.5/6.1 note 6) and full `(status, source)` entries for the GM.

Both negative controls for the new rules live behind `-d:leakfault` and in
the type, so the shipped binary has neither the fields nor the branches:
`gmProp` (the gm bucket reaches a player), `ownerProp` (the owner bucket
reaches a non-controller) and `statusSource` (a viewer learns the cause).
The `otherOwner` fault now carries the owner bucket too, so it stays one
class (the `mine` claim) instead of also tripping the bucket check.
2026-11-15 11:02:35 +01:00
SirStone 38d8962f84 server: the status model, per-token radius and the grow push (#22)
moverules.nim replaces the M2 `blocked` bool with the 5.5 status model: the
rules own the `walls` source (`stuckWalls`, `squeezedWalls`) and take
`locked` (any entry, any source) as input, so a GM-sourced lock refuses a
player move without the rules ever knowing what caused it. Identity is kept
on KEEP, cleared on CLEAR, and only tokens the event touches change.

Every geometry path now uses the token's own radius (5.6): the overlap test,
the escape check, the capsule, the door push and the step cap's neighbour
rules. `resizeToken` implements 5.6: a shrink never pushes and clears the
walls entries only when the overlap ends, a grow that overlaps is displaced
by a deterministic greedy relaxation (radial off the first overlapped wall,
scene order, at most 16 rounds, one flipped-side pass) and a grow that cannot
be placed stays put and becomes squeezed(walls). A step whose centre path
would cross a wall ends the pass, so the relaxation never carries a token
through a wall.

worldmap.nim is the bridge: `ruleToken`/`ruleWall`/`moveScene` build the
rules' input from the records, `applyOutcome` copies the position, the
door-push history and the walls-sourced entries back, and `wallsStatuses`
does the same for a caller that writes its own row. All of them return fresh
sequences instead of mutating a shared one.
2026-11-15 11:02:29 +01:00
SirStone 67762c1309 server: the property buckets, the registry and the status set (#22)
Migration step 6 ("token details") adds the three prop buckets to `entity`
and creates `entity_status`, the `(status, source)` set of 5.5. A token's
status rows are rewritten with its row, so a status change and the `token`
frame that reports it commit together.

server/props.nim owns the buckets, their caps (64 keys per bucket, a key of
1..64 code points, a value of at most 8 KB of serialized JSON) and the
property-schema registry: empty at start with a permissive fallback, because
DESIGN 8 says v1 never interprets props; a key the rules module registers is
enforced (kind and bucket). server/text.nim is the one copy of the 6.5 text
rule, shared by names and prop keys.

tokens.nim gains `props` and `statuses` on the record, the sorted-unique
entry helpers, `isLocked`, `parseRadius`/`parseStatusKind`/`parseStatusSource`,
the prop and status columns in insert/replace, and `loadStatuses` joined on
the scene. Every helper builds a fresh sequence: a copied record shares its
seq buffer, so an in-place edit would reach the authoritative list before
the transaction commits (4.2 step 6).
2026-11-15 11:02:23 +01:00
SirStone d773a5e2de results: rerun the slice 6 gates on the final tree (#21)
devbox run test: 273 Nim checks and 68 Node tests pass. devbox run mutation: control passes,
41 of 41 mutations (a-al) fail their expected tests, including the six new explored ones.
Chunk write avg 0.015 ms / p99 0.037 ms; move ack with explored writes avg 0.79 ms / p99 2 ms.
2026-11-15 10:03:37 +01:00
SirStone fe7ffb0000 design: record the explored persistence decisions (#21)
Step 5 DDL, the 64x64/512 B chunk format with its pinned bit layout, the write policy (dirty
chunks only, whole-chunk encoding, NORMAL durability, one transaction with a move and a
separate one after GM authoring), the startup restore and the measured costs, all tagged
FIXED (owner-delegated, #21), plus what slice 6 built in 10.3.
2026-11-15 09:58:51 +01:00
SirStone 8c7487bf62 tools: the persistence group and six explored mutations (#21)
tools/persistence.test.mjs proves the store end to end over the real binary: a fresh resync
round trip, strict per-player separation, SIGTERM and SIGKILL restart equality, a wall
removal's revealed cells surviving after the wall returns, chunk rows decoded independently
(512 B, blobs), move-ack timing (avg 0.8 ms, p99 2 ms) and a schema-4 fixture DB migrated by
the binary. Mutations ag-al pin the bit layout, the chunk coordinate, the restore, the
per-player key, the upsert and the dirty-chunk dedupe. smoke.test.mjs moves to version 5.
2026-11-15 09:58:51 +01:00
SirStone df4634d12a server: load and persist explored with every mutation (#21)
Startup restores each player's grid from its chunk rows (explored_loaded log) and every
mutation writes only the chunks its refresh dirtied, in the mutation's transaction: a move
keeps position and chunks in one NORMAL commit, a GM authoring write adds one NORMAL chunk
transaction under the same lock, before the ack. db.withTransaction is the shared seam.
2026-11-15 09:58:19 +01:00
SirStone 22014a36dc server: the chunked explored store (#21)
Migration step 5 creates explored_chunk: one 512-byte bitmap per (player, scene, 64x64-cell
chunk), both FKs cascading. server/explored.nim owns the format (row-major, LSB-first bits),
dirty-chunk detection, the upsert and the startup restore. tests/texplored.nim pins the layout,
the whole-chunk encoding, the upsert replacement, the per-player keying, the restore and the
write cost (0.015 ms avg / 0.035 ms p99); tests/tdb.nim covers step 5 and a schema-4 fixture.
2026-11-15 09:58:16 +01:00
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