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
This commit is contained in:
+11
-6
@@ -664,10 +664,11 @@ explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, sc
|
||||
`''` is not a legal label (`1..64`) and `0` is not a legal height (`> 0`), so a sentinel would
|
||||
make the load path lie about the domain.
|
||||
- **Startup and write timing:** `marker_seen` rows are loaded per player with the explored chunks
|
||||
before the first connection (like `explored.restore`); marker inserts/deletes are derived player
|
||||
memory and ride the mutation's `NORMAL` transaction (the same one as the explored chunks), never
|
||||
the `FULL` authoring one. They run before the ack, after the wall row commits, so a retraction's
|
||||
`del` can never precede the wall change it reports.
|
||||
before the first connection (like `explored.restore`); marker inserts are derived player memory
|
||||
and ride the mutation's `NORMAL` transaction (the same one as the explored chunks), never the
|
||||
`FULL` authoring one, while a cause-change delete rides the wall row's `FULL` transaction so it
|
||||
cannot outlive the wall change across a crash. They run before the ack, after the wall row
|
||||
commits, so a retraction's `del` can never precede the wall change it reports.
|
||||
- Startup: load everything into memory, recompute vision for all players (prototype does, in one
|
||||
transaction) so `vision` is never stale vs walls. Startup loads the scene, its tokens and every
|
||||
stored `explored_chunk` and `marker_seen` row before the first connection (`explored.restore`), so
|
||||
@@ -1044,7 +1045,9 @@ What a wall's behaviour is made of. Heights are 5.7; what a low wall does to sig
|
||||
`player_marker` is turned off, the wall stops being a window (a switch or `sight_dir` change),
|
||||
or its geometry moves (`a`/`b`, `thickness`, `position`). A retraction reveals only that the GM
|
||||
changed something there, never a new position: a moved wall re-earns its marker only when the
|
||||
player sees the new geometry. Retraction never un-explores a cell and never revokes a tile.
|
||||
player sees the new geometry. The retraction delete commits with the wall row, so a crash
|
||||
between the wall change and the derived-memory write cannot restore the stale marker either.
|
||||
Retraction never un-explores a cell and never revokes a tile.
|
||||
- **Wire [FIXED (owner-delegated), #48; shape #49].** The message is the dotless server noun
|
||||
`marker`: `{full:bool, set:[{id, pos}], del:[id]}`, mirroring `encountered`'s full/set/del
|
||||
spelling, with `pos` in integer px (the wall's drawn midpoint, rounded once) and `id` an opaque
|
||||
@@ -2013,7 +2016,9 @@ copy/export stable).
|
||||
removed player takes their markers, a removed scene takes them through its walls, and a removed
|
||||
wall retracts its marker for everyone (5.8's retraction rule; the composite FK is why a marker
|
||||
can never dangle). The other retraction causes (`player_marker` off, no longer a window,
|
||||
geometry moved) are a deliberate delete in the update path, not an FK.
|
||||
geometry moved) are a deliberate delete in the update path, not an FK; that delete commits in
|
||||
the same FULL transaction as the wall row, so a crash before the derived-memory write cannot
|
||||
restore a marker with the changed wall's new geometry.
|
||||
- **Migration [FIXED (owner decision), 2026-11-17, #49].** Step 8 (4.4) rebuilds `wall` and maps
|
||||
every existing row to today's behaviour (`thickness 0`, `position center`, both block switches
|
||||
1, `sight_dir both`, `player_marker`/`secret`/`locked` 0, `height`/`label` NULL; `kind='door'`
|
||||
|
||||
Reference in New Issue
Block a user