M4 client v1 — spec #63

Open
opened 2026-11-20 22:30:08 +01:00 by SirStone · 6 comments
Owner

Part of #62

Problem Statement

The server is done through M3 plus the round-1 wall model (proto 2), but there is no client, so nobody can sit at the table. The table's only way to see the map, move a figure or author a wall is a protocol test harness. Three server/infra debts in docs/ANALYSIS-review.md make the client's hard parts worse than they need to be: the tile gate takes the global write lock and does a SHA-256 + SQLite lookup per tile, every vision ray tests all 64 circle segments, and HTTP/2 has never been verified end-to-end before a phone is asked to measure frame rate. The owner also has no automatable proof that the browser never receives hidden information.

Solution

A first-party browser client (Vite + TypeScript + PixiJS v8, plain DOM overlay) served by nginx, speaking proto 2: sign-in with a player or GM key, live map tiles, grid, three-state fog from the server's explored and vision facts, player markers, tokens with BitmapText names and statuses, the player's character and encountered lists, drag with prediction and rollback, the round-1 GM wall editor (four presets, switches, marker, label, one-way arrow and flip, advanced switches, door actions), and the GM panels (roster, keys, tokens, characters, reveals, who-sees-it). It reconnects with backoff and a full resync. Three before-M4 items land first (sector-limited ray test, session cache + explored bitmap + lock-free tile gate, HTTP/2 + TLS test vhost with chromium). Acceptance is an automated headless-Chromium suite with mobile emulation against the real server path, an independent audit of the player browser's own WS/HTTP traffic, and one human phone ticket.

User Stories

  1. As a player, I want the shared link to show only a sign-in page when I have no session, so that a stranger sees no game data.
  2. As a player, I want to paste my player key and land on the map, so that joining takes one step.
  3. As a player whose key is refused, I want the same plain "key not recognised" answer for a wrong and an unknown key, so that I learn nothing about valid keys.
  4. As a GM, I want to sign in with the GM key the same way, so that there is one door for everyone.
  5. As a player signing in for the first time, I want to be asked once for a display name, so that the rest of the table can tell who I am.
  6. As a player, I want a taken name refused with a visible reason, so that I can pick another.
  7. As a player, I want a connection badge (connected / reconnecting / offline), so that I know whether the map is live.
  8. As a player, I want automatic reconnection with growing, jittered delays capped near 10 s, so that a flaky phone network recovers without a reload.
  9. As a player, I want the client to show "reload" when the server reports a protocol mismatch, so that I get the client that matches the server.
  10. As a player, I want the client to stop reconnecting and return to sign-in when my key is replaced or my player is removed, so that it does not hammer a dead session.
  11. As a player, I want a reconnect to rebuild my whole view (tokens, fog, explored, markers, lists), so that nothing is stale or missing.
  12. As a player on a second device, I want both connections to stay in sync, so that either device can drive my token.
  13. As a player, I want map art to appear only as tiles the server allows, so that I never see unexplored floor.
  14. As a player, I want tiles cached across a reconnect, so that recovery is fast on a phone.
  15. As a player, I want to drag to pan and use wheel or pinch to zoom, so that looking around feels natural on mouse and touch.
  16. As a player, I want zoom-out to stop at 0.5, so that my browser never asks for thousands of tiles.
  17. As a GM, I want to zoom out further than players can, so that I can survey the whole map while authoring.
  18. As a player, I want a toggleable grid, so that I can judge distance.
  19. As a player, I want the first viewport to fill in under a second on a phone-class device, so that the table does not wait.
  20. As a player, I want never-seen floor to be solid black, so that I cannot infer the map.
  21. As a player, I want explored-but-not-visible floor dimmed, so that I remember the layout without seeing what happens there.
  22. As a player, I want currently visible floor clear, so that I can see the scene I am in.
  23. As a player, I want the fog to follow my token as it moves, so that I do not need a reload to see.
  24. As a player, I want a window icon where I have seen a marked window, so that I remember it after walking away.
  25. As a player, I want a marker to disappear when the GM removes the wall or turns its marker off, so that my memory matches the world.
  26. As a GM, I want no fog over my map by default, so that I see everything while running the game.
  27. As a player, I want fog to be cosmetic client-side presentation only, so that hidden things never reach my browser at all.
  28. As a player, I want to see my tokens and the tokens inside my line of sight with their known names, so that I understand the situation.
  29. As a player, I want a token that leaves my sight to disappear, so that I am never shown a stale position.
  30. As a player, I want a stuck or squeezed badge on a token, so that I understand why mine will not move.
  31. As a player, I want a list of my characters with my own values, so that I can identify my figures.
  32. As a player, I want an encountered list with greyed entries for figures I have met but cannot see, so that I remember who is around.
  33. As a player, I want token names rendered with a bitmap font, so that labels stay crisp and cheap at any zoom.
  34. As a GM, I want to see every token including hidden ones with their GM-only fields, so that I can run the table.
  35. As a GM, I want to see which players see each token, so that I can adjudicate hiding and revealing.
  36. As a GM, I want to create, edit, resize and remove tokens, so that I can place the figures a scene needs.
  37. As a GM, I want to mark a token gm_only, so that players do not receive it until I allow it.
  38. As a player, I want my dragged token to follow my pointer immediately, so that movement feels direct.
  39. As a player, I want the server to remain the only judge of where my token ends up, so that walls and limits still apply.
  40. As a player, I want a refused move to slide my token back visibly, so that I see it did not happen.
  41. As a player, I want my token not to jump under my finger while I am still dragging, so that a slow ack does not fight me.
  42. As a player, I want a rate-limited move to be dropped quietly and reconciled, so that fast dragging never corrupts my view.
  43. As a GM, I want to drag any token, so that I can move the scene along.
  44. As a GM, I want to draw a wall by clicking two points, so that I can shape a map quickly.
  45. As a GM, I want an optional grid and endpoint snap while drawing, so that walls line up.
  46. As a GM, I want four presets (wall, door, window, one-way), so that one drag gives the right behaviour.
  47. As a GM, I want secret and locked checkboxes on a door, so that I can author the v1 door states.
  48. As a GM, I want a "players see a marker" checkbox, so that I can let players learn a window is there.
  49. As a GM, I want a short private label on a wall, so that I can name it for myself without changing behaviour.
  50. As a GM, I want the one-way direction drawn as an arrow and flippable, so that I get the blind side right.
  51. As a GM, I want an advanced editor for the raw switches, so that I can build walls the presets do not cover.
  52. As a GM, I want to delete a wall and undo my last edit, so that mistakes are cheap.
  53. As a GM, I want a hint and one-click unlock on a locked door, so that I do not fight the rules during play.
  54. As a GM, I want the editor to show the derived kind, so that I always see what the wall actually does.
  55. As a GM, I want a roster with each player's connected state, so that I know who is at the table.
  56. As a GM, I want to create, show and replace player keys, so that I can invite and re-invite players.
  57. As a GM, I want to remove a player, so that a slot frees up for someone else.
  58. As a GM, I want to create characters and give them to players, so that every player has their own record.
  59. As a GM, I want to reveal an actual name to one player or to all, so that names are discovered in play.
  60. As a GM, I want to remove an encountered entry, so that I control what a player remembers.
  61. As a GM, I want the player-keys dialog to keep keys out of player traffic, so that secrets stay secret.
  62. As the owner, I want an automated browser test that proves join, fog pixels, drag and rollback, and reconnect, so that M4 regressions are caught without a phone.
  63. As the owner, I want the player browser's own traffic audited for wall and other-player data, so that the client cannot quietly become a leak.
  64. As the owner, I want the real-phone run as one explicit human checklist, so that the remaining risk is visible and bounded.
  65. As the owner, I want the prototype clients archived once the real client exists, so that there is one client to maintain.
  66. As the table, I want the vision result to stay identical while each ray tests less, so that the phone gate is not lost to server CPU.
  67. As a player, I want tile requests answered without waiting for the game's write lock, so that my map does not freeze while the GM edits walls.
  68. As the owner, I want HTTP/2 verified end-to-end before the phone gate, so that the phone run measures the app and not six-connection HTTP/1.1.
  69. As a GM, I want to open and close a door with one click during play, so that the doorway changes without redrawing it.
  70. As a GM, I want to select an existing wall and edit its fields, so that I can fix a mistake without deleting and redrawing.

Implementation Decisions

Stack is FIXED (DESIGN §2) and not reopened: PixiJS v8, Vite + TypeScript, plain DOM overlay, Node 26 for harnesses.

FIXED (owner-delegated) 2026-11-20 — scope and order

  1. Build-list "before-M4" items land first: item 12 (nginx HTTP/2 + TLS test vhost, chromium in the root devbox) before the first browser e2e and before the phone gate; items 2 (sector-limited ray test) and 6 (session cache + explored bitmap + tile gate off the global lock) before the client's fog and tile-loading work. The ticket table encodes this as blocked_by edges.
  2. Item 13 (db_connector → thin sqlite3 binding) stays deferred; not in M4.
  3. The M4 wall editor omits the thickness control and the position flip until the thick-wall round; the GM still authors every round-1 field: four presets, the raw switches (blocks_sight, blocks_movement, sight_dir, player_marker, door, open, secret, locked), label, the one-way direction flip, door open/close and delete/undo. No height control either (ADR-0012).
  4. Walls round 2 (#37/#45/#50/#41/#44) is out of scope; #34 heartbeat is deferred to M5.
  5. "Finish" for this run means M4 built with every automatable gate green (devbox run test, devbox run mutation, devbox run bench, client unit tests, devbox run e2e incl. the traffic audit). The real-phone playtest (Note 10, 60 fps on a laptop-hosted scene) is one ready-for-human ticket, not an automatable gate.

M4 resolutions (recorded here; DESIGN text unchanged unless a ticket says otherwise)
6. The browser e2e runs over HTTPS with a generated self-signed certificate, because browsers allow HTTP/2 only over TLS (and the session cookie is Secure, which Chromium drops on plain HTTP except localhost). The test vhost mirrors DESIGN §11.1: static dist at / with SPA fallback and hashed-asset caching, /join, /ws, /tiles/, internal /_tiles/, http2 on.
7. Zoom: players clamp at 0.5 (ADR-0013); the GM has no low clamp. Both clamp at 4.0 maximum. Numbers are owner-delegated and revisited at the playtest.
8. Automated phone-class emulation in the e2e: 412×869 CSS px, device pixel ratio 2.625, touch, mobile, 4× CPU throttle, no network throttle (the server and tiles are local). The viewport-fill budget is < 1 s at zoom 1 (DESIGN §13 tile-size gate (a)); the 64 px tile fallback stays a per-scene config change, not code.
9. Fog mechanism (DESIGN leaves the Pixi mechanism to M4): the explored layer is one texture at cell resolution, the size of the map in cells (e.g. 128×128 for a 4096 px map at cell 32), updated in place from explored frames, displayed scaled and smoothed; unexplored is opaque, explored is a dim black (~0.6 alpha), visible is clear. The vision layer is the union of this player's vision polygons drawn into a mask/cut-out, rebuilt only when a vision frame arrives. The exact Pixi object (one-channel texture vs RenderTexture) is chosen with the pixijs skills during the build; the three-state pixel probe is the acceptance criterion.
10. Who-sees-it (DESIGN §7.4, FIXED #44) is built in M4 with round-1 semantics: for each token, the players that see it (0/100 %), because no wall has a height yet and a full-height wall always hides. The graded visible fraction arrives with the heights round. This needs one additive, GM-only wire field: GM token frames gain seen_by:[player ids]. It is banned for players by the leak checker; the ticket that adds it updates DESIGN §6.1 (token row) and §7.4 with a dated FIXED (owner-delegated) note.
11. Client architecture: one pure reducer (no Pixi imports) consumes server frames and intents/acks and produces state; the renderer subscribes and updates only changed entities (no per-frame full redraw, DESIGN §7.2). Domain slices (map, fog, tokens, walls, panels) register append-only into the reducer so they merge without rewriting each other. The DOM overlay is plain TS/HTML.
12. Tile loading: request only tiles intersecting the viewport plus a one-tile margin, in viewport order, with a small bounded concurrency (8) and a decoded-texture cache keyed by URL; keep the cache across reconnect, never prefetch beyond the margin, and do not retry a 403 in a loop.
13. Client package and runners: a new client package with Vite, TypeScript, pixi.js v8, Vitest for reducer/state-machine tests and playwright-core for e2e. The root devbox environment gains chromium (today only the perf prototype's environment has it). The e2e script lives with the client, outside tools/, so TESTING §10.4's "built-ins only, no npm deps" rule for tools/ stays intact; devbox run e2e builds the client, starts the real server through the existing isolation harness and the TLS/HTTP2 test nginx, and runs it.
14. Protocol: the client sends /ws?proto=2; a closing with proto-mismatch shows "reload"; revoked returns to sign-in and stops reconnecting; evicted leaves the tab usable but not reconnecting aggressively; a 1006/transport close retries with backoff. Pending reqIds are dropped with the connection; a hello on a live connection resets state but keeps pending requests.
15. Names and text: names in DOM panels are inserted as text (no innerHTML); token labels use BitmapText with the pre-installed Latin + Nerd Font BitmapFont, never per-frame text rebuilds.
16. Server-side changes in M4 are limited to build items 2 and 6 and the GM-only seen_by field of decision 10. No other wire change.
17. Player markers are drawn above the fog from the marker frame (full set on connect, diffs after); the client never infers markers from tiles or walls.

Testing Decisions

A good test asserts observable behaviour: the wire frames a client sees, the pixels a browser shows, the state a pure reducer produces, and the server's black-box replies. No test reaches into renderer internals or private module state.

Seams (existing preferred, one new)

  • Client reducer (new, the main client seam): pure frame/ack → state transitions, tested in the client's own runner (Vitest) with plain objects. Prior art: the prototype's client reducer test (TESTING §10.1 "Client reducer tests"), including the reconnect reset. Covers: hello reset, known-table diff, pending reqId map, drag/optimistic state machine, backoff schedule, rate-limited and refused acks.
  • Browser e2e (new, TESTING §10.3): playwright-core + devbox chromium against the real server through the TLS/HTTP2 test nginx, mobile emulation (decision 8). Checks: join → canvas renders; three fog pixel probes (unexplored black, explored dim, visible map-coloured); GM sees walls in the DOM/canvas while the player's WS frames and DOM carry none; drag moves the token and a forced refusal rolls back; reconnect restores view, explored and markers.
  • Independent traffic audit (new, TESTING §10.3): the e2e records every WS frame and HTTP response the player page receives and runs its own assertions (the prototype leak test's (a) and (e)): only catalogue frame types, no wall-field key anywhere, no other player's ids/polygons/explored, /_tiles/ never directly reachable, tile statuses only for allowed tiles. The audit keeps its own banned-key list; it must not import the server's leakcheck.nim lists, or the proof stops being independent.
  • Existing server harnesses (no new seam): devbox run test's Nim suite and tools/*.test.mjs are the regression proof for items 2, 6 and the seen_by addition. Build item 2 must keep every polygon byte-identical (geometry, vision, leak/doors/oneway/markers). Item 6 must keep the explored wire identical (RLE + cell-list diffs) and the session lifecycle exact (auth/restart/logs groups).
  • Bench (existing): devbox run bench records the vision numbers before/after item 2 in results/bench.log; the finish ticket records the 50-token fog measurement (server recompute and headless frame time) in results/m4-fog-bench.md.

Testing notes

  • The e2e runs in devbox run e2e, separate from devbox run test, so the fast server gate stays fast; the finish ticket requires both green.
  • Mutations: item 2's sector test gets a mutation entry (test the wrong sector) proving the sector test is load-bearing; item 6's cache invalidation gets a fault/mutation that keeps a revoked session alive, which must fail the auth group.
  • No timing gate is added to the client suite: frame-rate and fog cost are the human ticket plus the recorded measurement. If the 50-token measurement misses, build items 3 and 4 become a new ticket; they are not pre-built.

Out of Scope

  • Thick walls, wall heights, see-over and the graded visible fraction (ADR-0012; round 2: #37/#45/#50/#41/#44), and the #34 heartbeat (M5).
  • Build item 13 (db_connector → thin sqlite3 binding) and build items 3, 4 (per-token polygon cache, incremental wall-edit refresh) unless the fog measurement misses; build items 5, 7–11 (M5).
  • Server robustness, outbox/lag handling, SIGTERM, metrics (M5); NixOS deployment and the production vhost (M6); map import CLI (M6); FFF seam, drawings, chat/dice, uploads, multi-scene, binary protocol (post-v1).
  • GM "preview as player X" fog mode (DESIGN §7.3, PROPOSED later), per-player overview image (post-M5), iOS/Safari verification (M7).
  • Re-testing the server protocol beyond regression: no wire change other than seen_by.

Further Notes

  • The client is the first thing that exercises proto 2 end to end; the walls-r1 server is the contract. Where a frame's shape is ambiguous, the server is right and the client adapts.
  • The three-state fog is the only place where "cosmetic" must stay true: no client-side clipping is relied on for secrecy (DESIGN §7.3). The traffic audit is the proof.
  • Keep the DOM overlay minimal: it is drawn over the canvas and costs per-frame work on the phone (DESIGN §7.2 measurement).
  • The 50-token 16384 px scene for the phone gate needs a tiled test map and a fixture script; the current harness tiles are 32 px fixtures for the gate, not art. The playtest ticket may use the owner's real map.

Ticket breakdown (draft — do not create yet)

Vertical slices, each one agent session (~100K tokens), each merged with main green.

# Title Goal (2–4 lines) Acceptance criteria Stories Seam / area Blocked by Lane
T1 M4: sector-limited circle-segment ray test Each fan ray tests only the 64-gon segment in its own sector. Same polygon, fewer tests. Polygons byte-identical (geometry, vision, leak, doors, oneway, markers green unchanged); a mutation that tests the wrong sector fails ≥ 1 test; bench recorded in results/bench.log. 66 geometry + vision unit tests, bench, existing harnesses — S (server, serial)
T2 M4: session cache, explored bitmap and lock-free tile gate Tile requests stop taking the global lock and stop hashing/selecting in SQLite; sessions come from an in-memory table, explored from a bitmap snapshot. Tile gate reads cache + bit snapshot with no dbLock; revocation/replace/remove/restart reflected immediately (auth, restart, logs groups unchanged); explored wire byte-identical; a tile burst answers while a mutation holds the lock; a fault that keeps a revoked session fails the auth group. 67 server auth/session, explored, tile gate; Nim unit + HTTP suites — S (after T1)
T3 M4: TLS + HTTP/2 test vhost, client dist, chromium Root devbox gains chromium; the test nginx serves dist at / (SPA fallback, hashed cache, index no-cache) over TLS with HTTP/2, mirroring DESIGN §11.1. Generated self-signed cert; an HTTP/2 client negotiates h2; direct /_tiles/ 404; static cache headers correct; headless chromium launches and reports h2; existing tile/doors/oneway harnesses green with the new config. 68 test nginx, devbox, e2e harness — I (infra)
T4 M4: client shell, sign-in and protocol client New client package builds; sign-in page when no session; POST /join; WS proto=2; hello reset; pure reducer skeleton; DOM overlay shell. Unit tests for envelope/ack/reducer/hello reset; e2e join → canvas → hello/roster for GM and player; no data before join; wrong/unknown key identical; proto mismatch shows reload; revoked returns to sign-in; vite build dist served by nginx. 1, 2, 3, 4, 9, 10 client reducer, WS client, DOM shell; e2e T3 C (client core)
T5 M4: name prompt, connection badge, reconnect and resync First-sign-in name, badge states, jittered backoff, full view rebuild after reconnect, two devices in sync. Name prompt once, name-taken visible; badge transitions; backoff 1/2/4/8/10 s ± jitter; reconnect restores tokens, fog, explored, markers, lists; two connections both live; pending reqIds dropped with the close. 5, 6, 7, 8, 11, 12 reducer connection slice, WS client, e2e T4 C (after T4)
T6 M4: map tiles, grid and pan/zoom Tile sprites loaded lazily and cached; pan/zoom/pinch; player min zoom 0.5; GM no low clamp; max 4; grid toggle; culling. Viewport + one-tile margin only; 403 not retried in a loop; cache survives reconnect; clamp values exact; touch pinch; grid toggle; e2e mobile emulation viewport fills < 1 s at zoom 1 over h2; tile-size gate (a) documented. 13–19 camera/viewport, tile layer, grid; e2e T5, T2 V (map)
T7 M4: fog: explored bitmap, vision cut-out and player markers Three-state fog from explored + vision, updated only for new cells and new polygons; markers above fog; GM no fog. Pixel probes: unexplored near-black, explored dim (~0.6), visible map colour; fog follows a move with no reload; markers appear at anchors and vanish on del; GM map unfogged; only changed cells/polygons touched. 20–27 fog/marker layer, reducer fog slice; e2e T6, T2, T1 F (fog)
T8 M4: tokens, labels, statuses and lists Pooled token rendering, BitmapText labels, statuses, player character list and encountered list, GM sees all. Token enter/leave/update correctness; labels built once per name via BitmapFont; stuck/squeezed badges; own characters list; encountered greyed entries; GM sees gm_only tokens; instrumented count shows only changed entities updated per frame. 28–34 token renderer, lists panel, reducer token slice T5 E (entities)
T9 M4: drag own tokens with prediction and rollback Drag any owned token (GM any token) at ≤ 20 Hz with reqId, final send on release, optimistic sprite, rollback tween. Reducer drag state-machine tests; e2e drag persists after reload; forced refusal (wall/step cap) rolls back with a tween; authoritative positions ignored while dragging; rate-limited ack reconciled without corrupting state; pending map dropped on close. 38–43 drag module, reducer move slice; e2e T8 E (after T8)
T10 M4: GM wall editor (round-1 fields) Draw, select, edit and delete walls: four presets, secret/locked, marker, label, one-way arrow + flip, advanced switches, door open/close, unlock hint, undo last. No thickness/height/position flip. Every round-1 field authorable and round-trips through GM frames; player frames unchanged except vision/markers; secret door indistinguishable from a wall; locked hint + one-click unlock; arrow direction on the blind side; derived kind shown; no thickness/height controls; single-step undo; e2e GM draws, player's fog changes. 44–54, 69, 70 wall editor module, reducer wall slice; e2e T6 W (walls)
T11 M4: GM roster, player keys and token panel Roster with connected state, keys create/show/replace, remove player, token create/edit/resize/status/gm_only/controller. Keys exist only in GM DOM and never in player traffic or logs; remove player frees the slot; token panel drives intents and reflects frames; gm_only hides from players; resize pushes per server; e2e. 36, 37, 55, 56, 57, 61 GM panels DOM, reducer admin slice; e2e T5 G (panels)
T12 M4: GM characters, reveals and who-sees-it Character CRUD/assignment, reveal to one/all, encountered remove, who-sees-it panel with the GM-only seen_by field. Server seen_by additive and GM-only, banned for players in the leak checker; panel lists seeing players per token (0/100); reveal updates the player's name in e2e; encountered remove; character owner change does not move token controllers; DESIGN §6.1/§7.4 updated. 35, 58, 59, 60 server views/egress + leakcheck, GM panels; e2e T11, T2 G (after T11)
T13 M4: finish — e2e audit, measurement and archive Full headless suite plus the independent traffic audit as a gate; record the 50-token measurement; archive the prototype clients; mark M4 done. devbox run e2e covers join, fog probes, drag+rollback, reconnect; audit clean; test, mutation, bench green; results/m4-fog-bench.md records numbers; prototypes archived (Q24); DESIGN §13 M4 marked done; no polygon-cache work unless the measurement says so (then a follow-up ticket). 62, 63, 65 e2e + audit, docs, devbox gate T7, T9, T10, T12 Z (finish)
T14 M4: real-phone playtest gate (Note 10, 60 fps) Human run: laptop-hosted scene, 16384 px tiled map, 50 tokens, fog active, phone over LAN TLS/h2. Checklist with fps/load numbers (Note 10 and laptop), sign-in with the phone keyboard, drag and pinch, reconnect on network toggle; failures filed as issues; pass/fail recorded. 64 manual T13, T3 H (human)

Lanes (file-disjoint)

  • S (server): T1 → T2, serial; runs in parallel with I and C.
  • I (infra): T3, alone.
  • C (client core): T4 → T5; the only writer to the reducer registry and bootstrap while it runs.
  • After T6: F (T7), E (T8, then T9), W (T10), G (T11, then T12 with its small server edit) run in parallel; each owns its render module and adds an append-only reducer slice.
  • Z (T13) needs F, E, W, G closed; H (T14) needs Z and T3.

Coverage (every story exactly once)

Ticket Stories
T1 66
T2 67
T3 68
T4 1, 2, 3, 4, 9, 10
T5 5, 6, 7, 8, 11, 12
T6 13, 14, 15, 16, 17, 18, 19
T7 20, 21, 22, 23, 24, 25, 26, 27
T8 28, 29, 30, 31, 32, 33, 34
T9 38, 39, 40, 41, 42, 43
T10 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 69, 70
T11 36, 37, 55, 56, 57, 61
T12 35, 58, 59, 60
T13 62, 63, 65
T14 64

Check: 70 stories, each listed once (1–70 complete).

Tickets (created 2026-11-20)

  • #64 — M4: sector-limited circle-segment ray test (lane S)
  • #65 — M4: session cache, explored bitmap and lock-free tile gate (lane S)
  • #66 — M4: TLS + HTTP/2 test vhost, client dist, chromium (lane I)
  • #67 — M4: client shell, sign-in and protocol client (lane C)
  • #68 — M4: name prompt, connection badge, reconnect and resync (lane C)
  • #69 — M4: map tiles, grid and pan/zoom (lane V)
  • #70 — M4: fog: explored bitmap, vision cut-out and player markers (lane F)
  • #71 — M4: tokens, labels, statuses and lists (lane E)
  • #72 — M4: drag own tokens with prediction and rollback (lane E)
  • #73 — M4: GM wall editor (round-1 fields) (lane W)
  • #74 — M4: GM roster, player keys and token panel (lane G)
  • #75 — M4: GM characters, reveals and who-sees-it (lane G)
  • #76 — M4: finish — e2e audit, measurement and archive (lane Z)
  • #78 — M4: GM token panel sets vision (flags.vision, vision_radius) (lane G)
  • #79 — M4: map import CLI (pulled forward from M6) (lane I/O)
  • #80 — M4: LAN playtest run script (devbox run serve) (lane infra)
  • #85 — M4: cap map images at Full HD (auto-shrink on import) (lane I/O)
  • #77 — M4: real-phone playtest gate (Note 10, 60 fps) (lane H)
  • #87 — bug: GM sees no walls after reconnect/reload (lane W)
  • #88 — bug: GM roster connected goes stale on plain reconnect (lane G)

Native blocked_by edges carry the order; this list is map order (frontier) only. Build order: S: T1 → T2 ∥ I: T3 → C: T4 → T5 → T6 → fan-out {F: T7, E: T8 → T9, W: T10, G: T11 → T12} → Z: T13 → H: T14.

Part of #62 ## Problem Statement The server is done through M3 plus the round-1 wall model (proto 2), but there is no client, so nobody can sit at the table. The table's only way to see the map, move a figure or author a wall is a protocol test harness. Three server/infra debts in `docs/ANALYSIS-review.md` make the client's hard parts worse than they need to be: the tile gate takes the global write lock and does a SHA-256 + SQLite lookup per tile, every vision ray tests all 64 circle segments, and HTTP/2 has never been verified end-to-end before a phone is asked to measure frame rate. The owner also has no automatable proof that the browser never receives hidden information. ## Solution A first-party browser client (Vite + TypeScript + PixiJS v8, plain DOM overlay) served by nginx, speaking `proto` 2: sign-in with a player or GM key, live map tiles, grid, three-state fog from the server's `explored` and `vision` facts, player markers, tokens with `BitmapText` names and statuses, the player's character and encountered lists, drag with prediction and rollback, the round-1 GM wall editor (four presets, switches, marker, label, one-way arrow and flip, advanced switches, door actions), and the GM panels (roster, keys, tokens, characters, reveals, who-sees-it). It reconnects with backoff and a full resync. Three before-M4 items land first (sector-limited ray test, session cache + explored bitmap + lock-free tile gate, HTTP/2 + TLS test vhost with chromium). Acceptance is an automated headless-Chromium suite with mobile emulation against the real server path, an independent audit of the player browser's own WS/HTTP traffic, and one human phone ticket. ## User Stories 1. As a player, I want the shared link to show only a sign-in page when I have no session, so that a stranger sees no game data. 2. As a player, I want to paste my player key and land on the map, so that joining takes one step. 3. As a player whose key is refused, I want the same plain "key not recognised" answer for a wrong and an unknown key, so that I learn nothing about valid keys. 4. As a GM, I want to sign in with the GM key the same way, so that there is one door for everyone. 5. As a player signing in for the first time, I want to be asked once for a display name, so that the rest of the table can tell who I am. 6. As a player, I want a taken name refused with a visible reason, so that I can pick another. 7. As a player, I want a connection badge (connected / reconnecting / offline), so that I know whether the map is live. 8. As a player, I want automatic reconnection with growing, jittered delays capped near 10 s, so that a flaky phone network recovers without a reload. 9. As a player, I want the client to show "reload" when the server reports a protocol mismatch, so that I get the client that matches the server. 10. As a player, I want the client to stop reconnecting and return to sign-in when my key is replaced or my player is removed, so that it does not hammer a dead session. 11. As a player, I want a reconnect to rebuild my whole view (tokens, fog, explored, markers, lists), so that nothing is stale or missing. 12. As a player on a second device, I want both connections to stay in sync, so that either device can drive my token. 13. As a player, I want map art to appear only as tiles the server allows, so that I never see unexplored floor. 14. As a player, I want tiles cached across a reconnect, so that recovery is fast on a phone. 15. As a player, I want to drag to pan and use wheel or pinch to zoom, so that looking around feels natural on mouse and touch. 16. As a player, I want zoom-out to stop at 0.5, so that my browser never asks for thousands of tiles. 17. As a GM, I want to zoom out further than players can, so that I can survey the whole map while authoring. 18. As a player, I want a toggleable grid, so that I can judge distance. 19. As a player, I want the first viewport to fill in under a second on a phone-class device, so that the table does not wait. 20. As a player, I want never-seen floor to be solid black, so that I cannot infer the map. 21. As a player, I want explored-but-not-visible floor dimmed, so that I remember the layout without seeing what happens there. 22. As a player, I want currently visible floor clear, so that I can see the scene I am in. 23. As a player, I want the fog to follow my token as it moves, so that I do not need a reload to see. 24. As a player, I want a window icon where I have seen a marked window, so that I remember it after walking away. 25. As a player, I want a marker to disappear when the GM removes the wall or turns its marker off, so that my memory matches the world. 26. As a GM, I want no fog over my map by default, so that I see everything while running the game. 27. As a player, I want fog to be cosmetic client-side presentation only, so that hidden things never reach my browser at all. 28. As a player, I want to see my tokens and the tokens inside my line of sight with their known names, so that I understand the situation. 29. As a player, I want a token that leaves my sight to disappear, so that I am never shown a stale position. 30. As a player, I want a stuck or squeezed badge on a token, so that I understand why mine will not move. 31. As a player, I want a list of my characters with my own values, so that I can identify my figures. 32. As a player, I want an encountered list with greyed entries for figures I have met but cannot see, so that I remember who is around. 33. As a player, I want token names rendered with a bitmap font, so that labels stay crisp and cheap at any zoom. 34. As a GM, I want to see every token including hidden ones with their GM-only fields, so that I can run the table. 35. As a GM, I want to see which players see each token, so that I can adjudicate hiding and revealing. 36. As a GM, I want to create, edit, resize and remove tokens, so that I can place the figures a scene needs. 37. As a GM, I want to mark a token `gm_only`, so that players do not receive it until I allow it. 38. As a player, I want my dragged token to follow my pointer immediately, so that movement feels direct. 39. As a player, I want the server to remain the only judge of where my token ends up, so that walls and limits still apply. 40. As a player, I want a refused move to slide my token back visibly, so that I see it did not happen. 41. As a player, I want my token not to jump under my finger while I am still dragging, so that a slow ack does not fight me. 42. As a player, I want a rate-limited move to be dropped quietly and reconciled, so that fast dragging never corrupts my view. 43. As a GM, I want to drag any token, so that I can move the scene along. 44. As a GM, I want to draw a wall by clicking two points, so that I can shape a map quickly. 45. As a GM, I want an optional grid and endpoint snap while drawing, so that walls line up. 46. As a GM, I want four presets (wall, door, window, one-way), so that one drag gives the right behaviour. 47. As a GM, I want secret and locked checkboxes on a door, so that I can author the v1 door states. 48. As a GM, I want a "players see a marker" checkbox, so that I can let players learn a window is there. 49. As a GM, I want a short private label on a wall, so that I can name it for myself without changing behaviour. 50. As a GM, I want the one-way direction drawn as an arrow and flippable, so that I get the blind side right. 51. As a GM, I want an advanced editor for the raw switches, so that I can build walls the presets do not cover. 52. As a GM, I want to delete a wall and undo my last edit, so that mistakes are cheap. 53. As a GM, I want a hint and one-click unlock on a locked door, so that I do not fight the rules during play. 54. As a GM, I want the editor to show the derived kind, so that I always see what the wall actually does. 55. As a GM, I want a roster with each player's connected state, so that I know who is at the table. 56. As a GM, I want to create, show and replace player keys, so that I can invite and re-invite players. 57. As a GM, I want to remove a player, so that a slot frees up for someone else. 58. As a GM, I want to create characters and give them to players, so that every player has their own record. 59. As a GM, I want to reveal an actual name to one player or to all, so that names are discovered in play. 60. As a GM, I want to remove an encountered entry, so that I control what a player remembers. 61. As a GM, I want the player-keys dialog to keep keys out of player traffic, so that secrets stay secret. 62. As the owner, I want an automated browser test that proves join, fog pixels, drag and rollback, and reconnect, so that M4 regressions are caught without a phone. 63. As the owner, I want the player browser's own traffic audited for wall and other-player data, so that the client cannot quietly become a leak. 64. As the owner, I want the real-phone run as one explicit human checklist, so that the remaining risk is visible and bounded. 65. As the owner, I want the prototype clients archived once the real client exists, so that there is one client to maintain. 66. As the table, I want the vision result to stay identical while each ray tests less, so that the phone gate is not lost to server CPU. 67. As a player, I want tile requests answered without waiting for the game's write lock, so that my map does not freeze while the GM edits walls. 68. As the owner, I want HTTP/2 verified end-to-end before the phone gate, so that the phone run measures the app and not six-connection HTTP/1.1. 69. As a GM, I want to open and close a door with one click during play, so that the doorway changes without redrawing it. 70. As a GM, I want to select an existing wall and edit its fields, so that I can fix a mistake without deleting and redrawing. ## Implementation Decisions Stack is FIXED (DESIGN §2) and not reopened: PixiJS v8, Vite + TypeScript, plain DOM overlay, Node 26 for harnesses. **FIXED (owner-delegated) 2026-11-20 — scope and order** 1. Build-list "before-M4" items land first: item 12 (nginx HTTP/2 + TLS test vhost, chromium in the root devbox) before the first browser e2e and before the phone gate; items 2 (sector-limited ray test) and 6 (session cache + explored bitmap + tile gate off the global lock) before the client's fog and tile-loading work. The ticket table encodes this as `blocked_by` edges. 2. Item 13 (`db_connector` → thin sqlite3 binding) stays deferred; not in M4. 3. The M4 wall editor omits the thickness control and the position flip until the thick-wall round; the GM still authors every round-1 field: four presets, the raw switches (`blocks_sight`, `blocks_movement`, `sight_dir`, `player_marker`, `door`, `open`, `secret`, `locked`), `label`, the one-way direction flip, door open/close and delete/undo. No height control either (ADR-0012). 4. Walls round 2 (#37/#45/#50/#41/#44) is out of scope; #34 heartbeat is deferred to M5. 5. "Finish" for this run means M4 built with every automatable gate green (`devbox run test`, `devbox run mutation`, `devbox run bench`, client unit tests, `devbox run e2e` incl. the traffic audit). The real-phone playtest (Note 10, 60 fps on a laptop-hosted scene) is one `ready-for-human` ticket, not an automatable gate. **M4 resolutions (recorded here; DESIGN text unchanged unless a ticket says otherwise)** 6. The browser e2e runs over HTTPS with a generated self-signed certificate, because browsers allow HTTP/2 only over TLS (and the session cookie is `Secure`, which Chromium drops on plain HTTP except localhost). The test vhost mirrors DESIGN §11.1: static `dist` at `/` with SPA fallback and hashed-asset caching, `/join`, `/ws`, `/tiles/`, internal `/_tiles/`, `http2 on`. 7. Zoom: players clamp at 0.5 (ADR-0013); the GM has no low clamp. Both clamp at 4.0 maximum. Numbers are owner-delegated and revisited at the playtest. 8. Automated phone-class emulation in the e2e: 412×869 CSS px, device pixel ratio 2.625, touch, mobile, 4× CPU throttle, no network throttle (the server and tiles are local). The viewport-fill budget is < 1 s at zoom 1 (DESIGN §13 tile-size gate (a)); the 64 px tile fallback stays a per-scene config change, not code. 9. Fog mechanism (DESIGN leaves the Pixi mechanism to M4): the explored layer is one texture at cell resolution, the size of the map in cells (e.g. 128×128 for a 4096 px map at cell 32), updated in place from `explored` frames, displayed scaled and smoothed; unexplored is opaque, explored is a dim black (~0.6 alpha), visible is clear. The vision layer is the union of this player's `vision` polygons drawn into a mask/cut-out, rebuilt only when a `vision` frame arrives. The exact Pixi object (one-channel texture vs `RenderTexture`) is chosen with the pixijs skills during the build; the three-state pixel probe is the acceptance criterion. 10. Who-sees-it (DESIGN §7.4, FIXED #44) is built in M4 with round-1 semantics: for each token, the players that see it (0/100 %), because no wall has a height yet and a full-height wall always hides. The graded visible fraction arrives with the heights round. This needs one additive, GM-only wire field: GM `token` frames gain `seen_by:[player ids]`. It is banned for players by the leak checker; the ticket that adds it updates DESIGN §6.1 (token row) and §7.4 with a dated FIXED (owner-delegated) note. 11. Client architecture: one pure reducer (no Pixi imports) consumes server frames and intents/acks and produces state; the renderer subscribes and updates only changed entities (no per-frame full redraw, DESIGN §7.2). Domain slices (map, fog, tokens, walls, panels) register append-only into the reducer so they merge without rewriting each other. The DOM overlay is plain TS/HTML. 12. Tile loading: request only tiles intersecting the viewport plus a one-tile margin, in viewport order, with a small bounded concurrency (8) and a decoded-texture cache keyed by URL; keep the cache across reconnect, never prefetch beyond the margin, and do not retry a `403` in a loop. 13. Client package and runners: a new client package with Vite, TypeScript, `pixi.js` v8, Vitest for reducer/state-machine tests and `playwright-core` for e2e. The root devbox environment gains `chromium` (today only the perf prototype's environment has it). The e2e script lives with the client, outside `tools/`, so TESTING §10.4's "built-ins only, no npm deps" rule for `tools/` stays intact; `devbox run e2e` builds the client, starts the real server through the existing isolation harness and the TLS/HTTP2 test nginx, and runs it. 14. Protocol: the client sends `/ws?proto=2`; a `closing` with `proto-mismatch` shows "reload"; `revoked` returns to sign-in and stops reconnecting; `evicted` leaves the tab usable but not reconnecting aggressively; a 1006/transport close retries with backoff. Pending `reqId`s are dropped with the connection; a `hello` on a live connection resets state but keeps pending requests. 15. Names and text: names in DOM panels are inserted as text (no `innerHTML`); token labels use `BitmapText` with the pre-installed Latin + Nerd Font `BitmapFont`, never per-frame text rebuilds. 16. Server-side changes in M4 are limited to build items 2 and 6 and the GM-only `seen_by` field of decision 10. No other wire change. 17. Player markers are drawn above the fog from the `marker` frame (full set on connect, diffs after); the client never infers markers from tiles or walls. ## Testing Decisions A good test asserts observable behaviour: the wire frames a client sees, the pixels a browser shows, the state a pure reducer produces, and the server's black-box replies. No test reaches into renderer internals or private module state. **Seams (existing preferred, one new)** - *Client reducer (new, the main client seam):* pure frame/ack → state transitions, tested in the client's own runner (Vitest) with plain objects. Prior art: the prototype's client reducer test (`TESTING` §10.1 "Client reducer tests"), including the reconnect reset. Covers: `hello` reset, known-table diff, pending `reqId` map, drag/optimistic state machine, backoff schedule, rate-limited and refused acks. - *Browser e2e (new, TESTING §10.3):* playwright-core + devbox chromium against the real server through the TLS/HTTP2 test nginx, mobile emulation (decision 8). Checks: join → canvas renders; three fog pixel probes (unexplored black, explored dim, visible map-coloured); GM sees walls in the DOM/canvas while the player's WS frames and DOM carry none; drag moves the token and a forced refusal rolls back; reconnect restores view, explored and markers. - *Independent traffic audit (new, TESTING §10.3):* the e2e records every WS frame and HTTP response the player page receives and runs its own assertions (the prototype leak test's (a) and (e)): only catalogue frame types, no wall-field key anywhere, no other player's ids/polygons/explored, `/_tiles/` never directly reachable, tile statuses only for allowed tiles. The audit keeps its own banned-key list; it must not import the server's `leakcheck.nim` lists, or the proof stops being independent. - *Existing server harnesses (no new seam):* `devbox run test`'s Nim suite and `tools/*.test.mjs` are the regression proof for items 2, 6 and the `seen_by` addition. Build item 2 must keep every polygon byte-identical (geometry, vision, leak/doors/oneway/markers). Item 6 must keep the explored wire identical (RLE + cell-list diffs) and the session lifecycle exact (auth/restart/logs groups). - *Bench (existing):* `devbox run bench` records the vision numbers before/after item 2 in `results/bench.log`; the finish ticket records the 50-token fog measurement (server recompute and headless frame time) in `results/m4-fog-bench.md`. **Testing notes** - The e2e runs in `devbox run e2e`, separate from `devbox run test`, so the fast server gate stays fast; the finish ticket requires both green. - Mutations: item 2's sector test gets a mutation entry (test the wrong sector) proving the sector test is load-bearing; item 6's cache invalidation gets a fault/mutation that keeps a revoked session alive, which must fail the auth group. - No timing gate is added to the client suite: frame-rate and fog cost are the human ticket plus the recorded measurement. If the 50-token measurement misses, build items 3 and 4 become a new ticket; they are not pre-built. ## Out of Scope - Thick walls, wall heights, see-over and the graded visible fraction (ADR-0012; round 2: #37/#45/#50/#41/#44), and the #34 heartbeat (M5). - Build item 13 (`db_connector` → thin sqlite3 binding) and build items 3, 4 (per-token polygon cache, incremental wall-edit refresh) unless the fog measurement misses; build items 5, 7–11 (M5). - Server robustness, outbox/lag handling, SIGTERM, metrics (M5); NixOS deployment and the production vhost (M6); map import CLI (M6); FFF seam, drawings, chat/dice, uploads, multi-scene, binary protocol (post-v1). - GM "preview as player X" fog mode (DESIGN §7.3, PROPOSED later), per-player overview image (post-M5), iOS/Safari verification (M7). - Re-testing the server protocol beyond regression: no wire change other than `seen_by`. ## Further Notes - The client is the first thing that exercises `proto` 2 end to end; the walls-r1 server is the contract. Where a frame's shape is ambiguous, the server is right and the client adapts. - The three-state fog is the only place where "cosmetic" must stay true: no client-side clipping is relied on for secrecy (DESIGN §7.3). The traffic audit is the proof. - Keep the DOM overlay minimal: it is drawn over the canvas and costs per-frame work on the phone (DESIGN §7.2 measurement). - The 50-token 16384 px scene for the phone gate needs a tiled test map and a fixture script; the current harness tiles are 32 px fixtures for the gate, not art. The playtest ticket may use the owner's real map. ## Ticket breakdown (draft — do not create yet) Vertical slices, each one agent session (~100K tokens), each merged with `main` green. | # | Title | Goal (2–4 lines) | Acceptance criteria | Stories | Seam / area | Blocked by | Lane | |---|---|---|---|---|---|---|---| | T1 | M4: sector-limited circle-segment ray test | Each fan ray tests only the 64-gon segment in its own sector. Same polygon, fewer tests. | Polygons byte-identical (geometry, vision, leak, doors, oneway, markers green unchanged); a mutation that tests the wrong sector fails ≥ 1 test; bench recorded in `results/bench.log`. | 66 | geometry + vision unit tests, bench, existing harnesses | — | S (server, serial) | | T2 | M4: session cache, explored bitmap and lock-free tile gate | Tile requests stop taking the global lock and stop hashing/selecting in SQLite; sessions come from an in-memory table, explored from a bitmap snapshot. | Tile gate reads cache + bit snapshot with no `dbLock`; revocation/replace/remove/restart reflected immediately (auth, restart, logs groups unchanged); explored wire byte-identical; a tile burst answers while a mutation holds the lock; a fault that keeps a revoked session fails the auth group. | 67 | server auth/session, explored, tile gate; Nim unit + HTTP suites | — | S (after T1) | | T3 | M4: TLS + HTTP/2 test vhost, client dist, chromium | Root devbox gains chromium; the test nginx serves `dist` at `/` (SPA fallback, hashed cache, index no-cache) over TLS with HTTP/2, mirroring DESIGN §11.1. | Generated self-signed cert; an HTTP/2 client negotiates h2; direct `/_tiles/` 404; static cache headers correct; headless chromium launches and reports h2; existing tile/doors/oneway harnesses green with the new config. | 68 | test nginx, devbox, e2e harness | — | I (infra) | | T4 | M4: client shell, sign-in and protocol client | New client package builds; sign-in page when no session; `POST /join`; WS `proto=2`; `hello` reset; pure reducer skeleton; DOM overlay shell. | Unit tests for envelope/ack/reducer/`hello` reset; e2e join → canvas → hello/roster for GM and player; no data before join; wrong/unknown key identical; proto mismatch shows reload; revoked returns to sign-in; `vite build` dist served by nginx. | 1, 2, 3, 4, 9, 10 | client reducer, WS client, DOM shell; e2e | T3 | C (client core) | | T5 | M4: name prompt, connection badge, reconnect and resync | First-sign-in name, badge states, jittered backoff, full view rebuild after reconnect, two devices in sync. | Name prompt once, `name-taken` visible; badge transitions; backoff 1/2/4/8/10 s ± jitter; reconnect restores tokens, fog, explored, markers, lists; two connections both live; pending reqIds dropped with the close. | 5, 6, 7, 8, 11, 12 | reducer connection slice, WS client, e2e | T4 | C (after T4) | | T6 | M4: map tiles, grid and pan/zoom | Tile sprites loaded lazily and cached; pan/zoom/pinch; player min zoom 0.5; GM no low clamp; max 4; grid toggle; culling. | Viewport + one-tile margin only; 403 not retried in a loop; cache survives reconnect; clamp values exact; touch pinch; grid toggle; e2e mobile emulation viewport fills < 1 s at zoom 1 over h2; tile-size gate (a) documented. | 13–19 | camera/viewport, tile layer, grid; e2e | T5, T2 | V (map) | | T7 | M4: fog: explored bitmap, vision cut-out and player markers | Three-state fog from `explored` + `vision`, updated only for new cells and new polygons; markers above fog; GM no fog. | Pixel probes: unexplored near-black, explored dim (~0.6), visible map colour; fog follows a move with no reload; markers appear at anchors and vanish on `del`; GM map unfogged; only changed cells/polygons touched. | 20–27 | fog/marker layer, reducer fog slice; e2e | T6, T2, T1 | F (fog) | | T8 | M4: tokens, labels, statuses and lists | Pooled token rendering, `BitmapText` labels, statuses, player character list and encountered list, GM sees all. | Token enter/leave/update correctness; labels built once per name via `BitmapFont`; stuck/squeezed badges; own characters list; encountered greyed entries; GM sees `gm_only` tokens; instrumented count shows only changed entities updated per frame. | 28–34 | token renderer, lists panel, reducer token slice | T5 | E (entities) | | T9 | M4: drag own tokens with prediction and rollback | Drag any owned token (GM any token) at ≤ 20 Hz with `reqId`, final send on release, optimistic sprite, rollback tween. | Reducer drag state-machine tests; e2e drag persists after reload; forced refusal (wall/step cap) rolls back with a tween; authoritative positions ignored while dragging; rate-limited ack reconciled without corrupting state; pending map dropped on close. | 38–43 | drag module, reducer move slice; e2e | T8 | E (after T8) | | T10 | M4: GM wall editor (round-1 fields) | Draw, select, edit and delete walls: four presets, secret/locked, marker, label, one-way arrow + flip, advanced switches, door open/close, unlock hint, undo last. No thickness/height/position flip. | Every round-1 field authorable and round-trips through GM frames; player frames unchanged except vision/markers; secret door indistinguishable from a wall; locked hint + one-click unlock; arrow direction on the blind side; derived `kind` shown; no thickness/height controls; single-step undo; e2e GM draws, player's fog changes. | 44–54, 69, 70 | wall editor module, reducer wall slice; e2e | T6 | W (walls) | | T11 | M4: GM roster, player keys and token panel | Roster with connected state, keys create/show/replace, remove player, token create/edit/resize/status/`gm_only`/controller. | Keys exist only in GM DOM and never in player traffic or logs; remove player frees the slot; token panel drives intents and reflects frames; `gm_only` hides from players; resize pushes per server; e2e. | 36, 37, 55, 56, 57, 61 | GM panels DOM, reducer admin slice; e2e | T5 | G (panels) | | T12 | M4: GM characters, reveals and who-sees-it | Character CRUD/assignment, reveal to one/all, encountered remove, who-sees-it panel with the GM-only `seen_by` field. | Server `seen_by` additive and GM-only, banned for players in the leak checker; panel lists seeing players per token (0/100); reveal updates the player's name in e2e; encountered remove; character owner change does not move token controllers; DESIGN §6.1/§7.4 updated. | 35, 58, 59, 60 | server views/egress + leakcheck, GM panels; e2e | T11, T2 | G (after T11) | | T13 | M4: finish — e2e audit, measurement and archive | Full headless suite plus the independent traffic audit as a gate; record the 50-token measurement; archive the prototype clients; mark M4 done. | `devbox run e2e` covers join, fog probes, drag+rollback, reconnect; audit clean; `test`, `mutation`, `bench` green; `results/m4-fog-bench.md` records numbers; prototypes archived (Q24); DESIGN §13 M4 marked done; no polygon-cache work unless the measurement says so (then a follow-up ticket). | 62, 63, 65 | e2e + audit, docs, devbox gate | T7, T9, T10, T12 | Z (finish) | | T14 | M4: real-phone playtest gate (Note 10, 60 fps) | Human run: laptop-hosted scene, 16384 px tiled map, 50 tokens, fog active, phone over LAN TLS/h2. | Checklist with fps/load numbers (Note 10 and laptop), sign-in with the phone keyboard, drag and pinch, reconnect on network toggle; failures filed as issues; pass/fail recorded. | 64 | manual | T13, T3 | H (human) | **Lanes (file-disjoint)** - S (server): T1 → T2, serial; runs in parallel with I and C. - I (infra): T3, alone. - C (client core): T4 → T5; the only writer to the reducer registry and bootstrap while it runs. - After T6: F (T7), E (T8, then T9), W (T10), G (T11, then T12 with its small server edit) run in parallel; each owns its render module and adds an append-only reducer slice. - Z (T13) needs F, E, W, G closed; H (T14) needs Z and T3. **Coverage (every story exactly once)** | Ticket | Stories | |---|---| | T1 | 66 | | T2 | 67 | | T3 | 68 | | T4 | 1, 2, 3, 4, 9, 10 | | T5 | 5, 6, 7, 8, 11, 12 | | T6 | 13, 14, 15, 16, 17, 18, 19 | | T7 | 20, 21, 22, 23, 24, 25, 26, 27 | | T8 | 28, 29, 30, 31, 32, 33, 34 | | T9 | 38, 39, 40, 41, 42, 43 | | T10 | 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 69, 70 | | T11 | 36, 37, 55, 56, 57, 61 | | T12 | 35, 58, 59, 60 | | T13 | 62, 63, 65 | | T14 | 64 | Check: 70 stories, each listed once (1–70 complete). ## Tickets (created 2026-11-20) - [x] #64 — M4: sector-limited circle-segment ray test (lane S) - [x] #65 — M4: session cache, explored bitmap and lock-free tile gate (lane S) - [x] #66 — M4: TLS + HTTP/2 test vhost, client dist, chromium (lane I) - [x] #67 — M4: client shell, sign-in and protocol client (lane C) - [x] #68 — M4: name prompt, connection badge, reconnect and resync (lane C) - [x] #69 — M4: map tiles, grid and pan/zoom (lane V) - [x] #70 — M4: fog: explored bitmap, vision cut-out and player markers (lane F) - [x] #71 — M4: tokens, labels, statuses and lists (lane E) - [x] #72 — M4: drag own tokens with prediction and rollback (lane E) - [x] #73 — M4: GM wall editor (round-1 fields) (lane W) - [x] #74 — M4: GM roster, player keys and token panel (lane G) - [x] #75 — M4: GM characters, reveals and who-sees-it (lane G) - [x] #76 — M4: finish — e2e audit, measurement and archive (lane Z) - [x] #78 — M4: GM token panel sets vision (`flags.vision`, `vision_radius`) (lane G) - [x] #79 — M4: map import CLI (pulled forward from M6) (lane I/O) - [x] #80 — M4: LAN playtest run script (`devbox run serve`) (lane infra) - [x] #85 — M4: cap map images at Full HD (auto-shrink on import) (lane I/O) - [ ] #77 — M4: real-phone playtest gate (Note 10, 60 fps) (lane H) - [x] #87 — bug: GM sees no walls after reconnect/reload (lane W) - [x] #88 — bug: GM roster connected goes stale on plain reconnect (lane G) Native `blocked_by` edges carry the order; this list is map order (frontier) only. Build order: S: T1 → T2 ∥ I: T3 → C: T4 → T5 → T6 → fan-out {F: T7, E: T8 → T9, W: T10, G: T11 → T12} → Z: T13 → H: T14. - [x] #82 — M4: playtest friction: fps overlay, import on fresh state, token seeding (lane infra) - [ ] #89
SirStone added the ready-for-agentenhancement labels 2026-11-20 22:30:08 +01:00
Author
Owner

Build order + lanes (native dependencies are the source of truth; this is the map order)

Tickets: T1 #64, T2 #65, T3 #66, T4 #67, T5 #68, T6 #69, T7 #70, T8 #71, T9 #72, T10 #73, T11 #74, T12 #75, T13 #76, T14 #77

  S (serial)   T1 -> T2
  I (infra)    T3                     (parallel with S)
  C (client)   T4 -> T5               (needs I: T3)
  V (map)      T6                     (needs C: T5, S: T2)
  fan-out      F: T7                  (needs T6, T2, T1)
               E: T8 -> T9
               W: T10                 (needs T6)
               G: T11 -> T12          (needs C: T5 / T11 + T2)
  Z (finish)   T13                    (needs F, E, W, G)
  H (human)    T14                    (needs Z, I: T3)

Lanes are file-disjoint: S server, I infra, C the only writer to the reducer registry and bootstrap while it runs, then F/E/W/G each own their render module and add an append-only reducer slice. Each ticket is one agent session (~100K tokens) merged with main green; the standing gate on every ticket is a full devbox run test on a clean checkout with no test weakened or skipped. T14 is ready-for-human (Note 10, 60 fps on a real phone).

**Build order + lanes** (native dependencies are the source of truth; this is the map order) Tickets: T1 #64, T2 #65, T3 #66, T4 #67, T5 #68, T6 #69, T7 #70, T8 #71, T9 #72, T10 #73, T11 #74, T12 #75, T13 #76, T14 #77 ``` S (serial) T1 -> T2 I (infra) T3 (parallel with S) C (client) T4 -> T5 (needs I: T3) V (map) T6 (needs C: T5, S: T2) fan-out F: T7 (needs T6, T2, T1) E: T8 -> T9 W: T10 (needs T6) G: T11 -> T12 (needs C: T5 / T11 + T2) Z (finish) T13 (needs F, E, W, G) H (human) T14 (needs Z, I: T3) ``` Lanes are file-disjoint: S server, I infra, C the only writer to the reducer registry and bootstrap while it runs, then F/E/W/G each own their render module and add an append-only reducer slice. Each ticket is one agent session (~100K tokens) merged with `main` green; the standing gate on every ticket is a full `devbox run test` on a clean checkout with no test weakened or skipped. T14 is `ready-for-human` (Note 10, 60 fps on a real phone).
Author
Owner

Scope change recorded 2026-11-21 (owner-delegated, orchestrator).

Map import CLI moves from M6 to M4 (#79). DESIGN §11.1's CLI is pulled forward as designed — not a throwaway seeder — because the M4 gate needs it: #77's phone playtest requires a 16384 px tiled scene, and scene.set cannot set w, h, tile_size, cell, art_version (§6.1). "Out of Scope" above lists "map import CLI (M6)"; this note supersedes that line for the import CLI only. NixOS deployment and the production vhost stay M6.

DESIGN §13 (M6 → M4 for map import, note in §11.1) and DESIGN-history §C are to be updated by #79.

Also added to this task list: #78 (GM token panel sets vision; without it a UI-created token has flags:'{}' and sees nothing, §8/§4.1/§3.3 — #74's AC assumed it) and #80 (LAN path for the playtest). #77 is now blocked_by #78, #79, #80; those three are independent of each other.

Scope change recorded 2026-11-21 (owner-delegated, orchestrator). **Map import CLI moves from M6 to M4** (#79). DESIGN §11.1's CLI is pulled forward as *designed* — not a throwaway seeder — because the M4 gate needs it: #77's phone playtest requires a 16384 px tiled scene, and `scene.set` cannot set `w, h, tile_size, cell, art_version` (§6.1). "Out of Scope" above lists "map import CLI (M6)"; this note supersedes that line for the import CLI only. NixOS deployment and the production vhost stay M6. DESIGN §13 (M6 → M4 for map import, note in §11.1) and DESIGN-history §C are to be updated by #79. Also added to this task list: #78 (GM token panel sets vision; without it a UI-created token has `flags:'{}'` and sees nothing, §8/§4.1/§3.3 — #74's AC assumed it) and #80 (LAN path for the playtest). #77 is now `blocked_by` #78, #79, #80; those three are independent of each other.
Author
Owner

Status: built; awaiting human playtest #77.

M4 is implemented and merged (fcd9052), with every automatable gate green on the rebased tree:
devbox run test (159 Node + Nim), client-test 164, e2e 27/27, mutation 80/80, bench PASS,
fogbench PASS. The headless e2e covers join, fog pixel probes, drag/rollback and reconnect; the
independent player-browser traffic audit (client/e2e/audit.test.mjs) is clean and has a leaking-build
negative control. results/m4-fog-bench.md records 50 tokens on a 16384 px map (server move path
0.12-0.14 ms); the headless SwiftShader cadence is recorded but is not a phone number.

Task list is ticked except #77, which carries the full LAN/phone checklist. This spec and #62 close
only after #77 reports pass.

Status: **built; awaiting human playtest #77**. M4 is implemented and merged (`fcd9052`), with every automatable gate green on the rebased tree: `devbox run test` (159 Node + Nim), `client-test` 164, `e2e` 27/27, `mutation` 80/80, `bench` PASS, `fogbench` PASS. The headless e2e covers join, fog pixel probes, drag/rollback and reconnect; the independent player-browser traffic audit (`client/e2e/audit.test.mjs`) is clean and has a leaking-build negative control. `results/m4-fog-bench.md` records 50 tokens on a 16384 px map (server move path 0.12-0.14 ms); the headless SwiftShader cadence is recorded but is not a phone number. Task list is ticked except #77, which carries the full LAN/phone checklist. This spec and #62 close only after #77 reports pass.
Author
Owner

Correction to the status comment: tickets #78, #79, #80 were added to this list after #76 landed. They are open and not part of #76; the "ticked except #77" statement above covers the original #64-#76 set only. #63 still waits on #77 (and now #78-#80) before closing.

Correction to the status comment: tickets **#78, #79, #80** were added to this list after #76 landed. They are open and not part of #76; the "ticked except #77" statement above covers the original #64-#76 set only. #63 still waits on #77 (and now #78-#80) before closing.
Author
Owner

M4 built; all automatable gates green at 9c05bb1 (test 165, client-test 183, e2e 29, mutation 80/80 at fcd9052). Awaiting human real-phone playtest #77 (checklist: SirStone/FFF_vtt#77 (comment)). Follow-up GM UI gaps parked in #81 (needs-triage).

M4 built; all automatable gates green at 9c05bb1 (test 165, client-test 183, e2e 29, mutation 80/80 at fcd9052). Awaiting human real-phone playtest #77 (checklist: https://git.fossellini.top/SirStone/FFF_vtt/issues/77#issuecomment-2993). Follow-up GM UI gaps parked in #81 (needs-triage).
Author
Owner

Owner decision (FIXED, 2026-11-21): map images are capped at Full HD

A 16384 px map meant ~30k tiles at the 32 px cell, minutes per import and ~1 GB VRAM for a zoomed-out GM. The owner chose the simplest cure over an LOD pyramid:

  • Map images are capped at 1920 px on the long side and 1080 px on the short side (either orientation).
  • fff-vtt import shrinks a larger image automatically, keeping proportions (Lanczos, alpha kept), before tiling; the scene w,h become the shrunk size. It prints the shrink: scaled 4000×3000 → 1440×1080.
  • Smaller images are imported as-is; no upscaling.
  • Existing DB scenes above the cap are left untouched; the server logs a warning at startup and serve prints map is WxH, above the Full HD cap; re-import to shrink.
  • scene.set cannot set w,h, so the importer is the only writer.

Examples: 4000×3000 → 1440×1080, 16384×16384 → 1080×1080. Tracking: #85; #77 is blocked by it (the phone gate re-runs on the Full HD map).

## Owner decision (FIXED, 2026-11-21): map images are capped at Full HD A 16384 px map meant ~30k tiles at the 32 px cell, minutes per import and ~1 GB VRAM for a zoomed-out GM. The owner chose the simplest cure over an LOD pyramid: - Map images are capped at **1920 px on the long side and 1080 px on the short side** (either orientation). - `fff-vtt import` **shrinks** a larger image automatically, keeping proportions (Lanczos, alpha kept), before tiling; the scene `w,h` become the shrunk size. It prints the shrink: `scaled 4000×3000 → 1440×1080`. - Smaller images are imported as-is; no upscaling. - Existing DB scenes above the cap are left untouched; the server logs a warning at startup and `serve` prints `map is WxH, above the Full HD cap; re-import to shrink`. - `scene.set` cannot set `w,h`, so the importer is the only writer. Examples: `4000×3000 → 1440×1080`, `16384×16384 → 1080×1080`. Tracking: #85; #77 is blocked by it (the phone gate re-runs on the Full HD map).
Sign in to join this conversation.