Commit Graph
6 Commits
Author SHA1 Message Date
SirStone fcd90529b6 test(m4): finish audit, measurement and archive (#76)
- client/e2e/audit.test.mjs: independent player-browser traffic audit (own
  frame catalogue and banned-key list, never leakcheck.nim), with a
  -d:leakfault/otherVision negative control.
- client/e2e/fogbench.test.mjs + tools/fogbench.nim: 50 tokens on a
  16384 px map (server move path and headless SwiftShader cadence);
  results/m4-fog-bench.md records both honestly (SW is not the phone gate).
- Archive prototype-* under docs/archive/prototypes (Q24); DESIGN 13 M4
  done, TESTING 13 M4 accept result, HANDOFF-M4 close-out.
- mutation.sh c1/c2 patch the post-#65 tile-gate line again (they had
  silently become sed no-ops).
2026-11-21 15:43:08 +01:00
SirStone 91a51c706d feat(client): GM wall editor, round-1 fields (#73)
Draw, select, edit and delete walls through the GM panel: the four 5.8
presets, raw switches (preset XOR raw, open excluded from wall.update), a
private label, the one-way arrow + flip (sight_dir names the blind side),
the player-marker switch, door open/close through door.set, secret/locked
with the locked hint and one-click unlock, delete and single-step undo.
No thickness, height or position-flip control (ADR-0012).

The pure rules and payload builders live in src/wallEditor.ts; the GM wall
slice (src/slices/walls.ts) owns the server records, selection and undo;
the render module draws on the gm layer and defines the input precedence:
token drag (#72) > armed wall draw > camera pan (#69), with a click (no
movement) selecting the nearest wall.

Shared core edits: client/src/reducer.ts gains the wall-select and
wall-record-undo events (the only new core events); style.css and the
client README document the panel and rules. Unit tests cover the slice,
presets, derived kind, arrow side, snapping, payload XOR, door intent and
undo builders; the e2e draws every preset, edits the fields, flips the
one-way wall, opens/closes a door, deletes and undoes, proves a token drag
still wins over draw mode, and probes the player's fog pixels, with the
player WS leaking no wall data.

Ref #73
2026-11-21 11:26:45 +01:00
SirStone 4534ed6426 feat(client): map tiles, grid and pan/zoom (#69)
T6 of spec #63. Tiles are requested only for the viewport plus one tile of
margin, in viewport order, at most 8 at a time (TileScheduler); decoded
textures are cached by URL so a reconnect refetches nothing; a 403/404 is
remembered as denied and never retried. The browser image loader is the hot
path, with one status fetch only to classify an error.

Camera: drag to pan, wheel/pinch to zoom around the pointer/midpoint; players
clamp at 0.5 (ADR-0013) and the GM has no player floor; both stop at 4.0.
Grid is one TilingSprite toggled by #grid-toggle. Camera is local UI state,
not a reducer slice, so hello/reconnect does not move the view.

Tests: viewport/tile unit tests (clamps, margin window, 8-wide queue, denial,
cache) and client/e2e/map.test.mjs (mobile viewport fill gate (a), grid,
pinch, cache across reconnect, GM zoom, 403 no-retry) against the real
server through TLS/h2. Tile-size gate (a) documented in client/README.md.
2026-11-21 01:11:12 +01:00
SirStone 429f023c62 feat(client): tokens, BitmapText labels, statuses and lists (#71)
- slices/tokens.ts: token upsert, token_gone, hello reset; status names only.
- slices/characters.ts + slices/encountered.ts: own characters, encountered
  list with grey entries; the GM's per-player copies are ignored.
- render/tokenBoard.ts (pure): event -> entered/updated/left patches, so one
  changed token costs one container; seeds from the reducer on mount.
- render/modules/tokens.ts: pooled world-coordinate nodes on the tokens layer,
  one shared unit-circle context per kind, BitmapText from one pre-installed
  BitmapFont assigned only on a name change, stuck/squeezed badges, canvas
  dataset instrumentation for the "only changed entities" criterion.
- panels/lists.ts + render/modules/lists.ts: #lists under #panels, textContent
  only, greyed encountered rows; mounted by a render module so no shared
  bootstrap file changed.
2026-11-21 00:51:16 +01:00
SirStone 465259c853 feat(client): name prompt, connection badge, reconnect and resync (#68)
T5 of the M4 client (spec #63). All of it at the existing seams: the pure
reducer slice, the WS client and the browser e2e.

- First sign-in: a live player with `me.name === null` gets a name prompt
  instead of the HUD and no Pixi stage (the server sends no scene until named).
  `player.setname` is acked before the second `hello` (#33); `name-taken`,
  `invalid` and `not-allowed` become visible text and the prompt stays put.
  Acceptance is followed by `hello` + the 6.3 resync, so the prompt is keyed on
  state and is asked once.
- Badge (`#badge[data-state]`): connected / reconnecting / offline. Offline is
  driven by `navigator.onLine` (a phone with no network) and by terminal close
  outcomes; reconnecting keeps the stale map on screen.
- Reconnect: a transport close after a live connection retries with
  1/2/4/8/10 s base delays +/-20% jitter, then the cap. `revoked` and
  `proto-mismatch` stay terminal; pending `reqId`s die with the socket; the
  browser `online` event skips the rest of the wait. A drop does not clear the
  view: `hello` resets every slice and the resync rebuilds tokens, fog,
  explored, markers and lists.
- Two devices on one player key both stay live and receive the same frames.

Proof: new unit tests for the schedule/retry machine (`test/ws.test.ts`) and the
badge/reconnect/name transitions (`test/reducer.test.ts`); new
`client/e2e/session.test.mjs` runs the real server and TLS/HTTP2 vhost, kills
and restarts the server under a live page, drops the browser network with
`context.setOffline`, and asserts the full resync frames (roster, encountered,
vision, explored, marker, token) plus two pages on one key.

Refs #68
2026-11-21 00:18:17 +01:00
SirStone 3c0258ea31 feat: client shell, sign-in and protocol client (#67)
New `client/` package (Vite + TypeScript + PixiJS v8, plain DOM overlay):
the pure reducer seam (no Pixi import), an append-only slice registry
build-time glob, the `proto` 2 WS client with envelope/ack/closing mapping,
the sign-in door (`POST /join`, one "Key not recognised." for wrong and
unknown), the DOM shell/HUD and a minimal Pixi stage created only after a
live `hello`. `hello` resets every slice so a reconnect cannot show stale
state; `proto-mismatch` shows reload; `revoked` returns to the sign-in page
and stops.

The browser e2e moves into the client package (`client/e2e/`, owning
playwright-core) and runs the real Vite build through the TLS/HTTP2 test
nginx: join -> canvas -> hello/roster for GM and player, no data before
join, identical wrong/unknown key refusal, proto mismatch, revoked.
`devbox run client-test` adds the Vitest seam; `devbox run e2e` builds the
client first. The #66 stub dist stays local to `tools/vhost.test.mjs`, so
`devbox run test` still needs no npm install.

Refs #67
2026-11-20 23:57:16 +01:00