M4: GM token panel sets vision (flags.vision, vision_radius) #78

Closed
opened 2026-11-21 15:09:46 +01:00 by SirStone · 1 comment
Owner

Part of #63

Goal

The GM token panel must be able to set vision (flags.vision and vision_radius) on both create and edit, so a token placed through the UI actually sees the map. Today client/src/panels/admin.ts sends neither field: createToken sends scene, kind, pos, descriptive_name, actual_name, radius, gm_only, controller, and saveToken sends id, kind, descriptive_name, actual_name, gm_only, controller. DESIGN §8 defaults a new token's flags to '{}'; §4.1 says only owned entities with vision produce polygons; with no polygon the player's explored set stays empty and, since a tile is allowed iff an explored cell overlaps it (§3.3), every tile answers 403 — the player sees no map at all, only fog.

Story 36 and #74's acceptance criterion "Token panel drives intents and reflects frames" both assume this works. #70's e2e only passes because the harness posts flags:{vision:true}, vision_radius:300 straight at the wire (client/e2e/fog.test.mjs), bypassing the UI under test.

Acceptance criteria

  • GM can toggle vision and set a vision radius on token create and on token edit (save), and both round-trip: after the ack the GM's token frame carries the same flags.vision and vision_radius.
  • A token created with vision through the panel produces a vision frame and grows that player's explored set: a probe of an explored tile answers 200 and an unexplored one 403 for that player (no wire poking).
  • vision_radius blank still means the scene default (vision_radius: null), and a non-positive value is refused client-side like the existing radius field.
  • client/e2e/fog.test.mjs builds its world through the UI only: no raw flags/vision_radius in a wire token.create in the test, and the player still sees map + three-state fog (all existing probes kept).
  • DESIGN's default for a new token is checked and decided; if a UI default is chosen (e.g. vision on for a player-controlled token) it is recorded as a dated FIXED note in DESIGN §8 (or DESIGN-history §C), and the panel matches it.
  • Standing gate: devbox run test, devbox run client-test, devbox run e2e green on a clean checkout, no test weakened or skipped.

Proven at

GM panels DOM + reducer admin slice; client e2e (fog pixel probes, world authored through the UI); client unit test on the token edit state.

Notes

  • Size: S (about one agent session). Lane: G (panels).
  • vision_radius is also the player step cap (DESIGN §5.5), so the GM setting it has a second visible effect; cover it in the e2e only if it is cheap, otherwise note it.
  • flags is free-form (§8): send only the vision key, never rebuild the whole flags object from the panel, so future GM flags survive an edit.
  • Blocks #77: without this ticket the phone playtest scene cannot be authored without raw wire writes.
  • Related: #74 (closed) built the panel without this field; #70 (closed) built fog against a wire-seeded token.
Part of #63 ## Goal The GM token panel must be able to set vision (`flags.vision` and `vision_radius`) on both create and edit, so a token placed through the UI actually sees the map. Today `client/src/panels/admin.ts` sends neither field: `createToken` sends `scene, kind, pos, descriptive_name, actual_name, radius, gm_only, controller`, and `saveToken` sends `id, kind, descriptive_name, actual_name, gm_only, controller`. DESIGN §8 defaults a new token's `flags` to `'{}'`; §4.1 says only owned entities with `vision` produce polygons; with no polygon the player's explored set stays empty and, since a tile is allowed iff an explored cell overlaps it (§3.3), every tile answers 403 — the player sees no map at all, only fog. Story 36 and #74's acceptance criterion "Token panel drives intents and reflects frames" both assume this works. #70's e2e only passes because the harness posts `flags:{vision:true}, vision_radius:300` straight at the wire (`client/e2e/fog.test.mjs`), bypassing the UI under test. ## Acceptance criteria - [ ] GM can toggle vision and set a vision radius on token **create** and on token **edit** (save), and both round-trip: after the ack the GM's `token` frame carries the same `flags.vision` and `vision_radius`. - [ ] A token created with vision through the panel produces a `vision` frame and grows that player's explored set: a probe of an explored tile answers 200 and an unexplored one 403 for that player (no wire poking). - [ ] `vision_radius` blank still means the scene default (`vision_radius: null`), and a non-positive value is refused client-side like the existing radius field. - [ ] `client/e2e/fog.test.mjs` builds its world through the UI only: no raw `flags`/`vision_radius` in a wire `token.create` in the test, and the player still sees map + three-state fog (all existing probes kept). - [ ] DESIGN's default for a new token is checked and decided; if a UI default is chosen (e.g. vision on for a player-controlled token) it is recorded as a dated FIXED note in DESIGN §8 (or DESIGN-history §C), and the panel matches it. - [ ] Standing gate: `devbox run test`, `devbox run client-test`, `devbox run e2e` green on a clean checkout, no test weakened or skipped. ## Proven at GM panels DOM + reducer admin slice; client e2e (fog pixel probes, world authored through the UI); client unit test on the token edit state. ## Notes - Size: S (about one agent session). Lane: G (panels). - `vision_radius` is also the player step cap (DESIGN §5.5), so the GM setting it has a second visible effect; cover it in the e2e only if it is cheap, otherwise note it. - `flags` is free-form (§8): send only the `vision` key, never rebuild the whole flags object from the panel, so future GM flags survive an edit. - Blocks #77: without this ticket the phone playtest scene cannot be authored without raw wire writes. - Related: #74 (closed) built the panel without this field; #70 (closed) built fog against a wire-seeded token.
SirStone added the ready-for-agentbug labels 2026-11-21 15:09:46 +01:00
SirStone added a new dependency 2026-11-21 15:09:52 +01:00
Author
Owner

Implemented on main as bacf2e1.

  • Token panel create/edit now carries flags.vision and vision_radius (client/src/tokenPanel.ts pure seam + panels/admin.ts). Edits merge only the vision key into the stored flags; other GM flags survive.
  • Default decision: vision off, radius blank (scene default), matching DESIGN §8's flags: '{}'. Recorded as a dated FIXED note in DESIGN §8 and DESIGN-history §C; no wire default changed.
  • client/e2e/fog.test.mjs now authors the sighted token through the GM panel (no raw flags/vision_radius in a wire token.create). client/e2e/admin.test.mjs proves the create/edit round-trip on the GM token frame and an explored tile 200 / unexplored 403 probe for that player.
  • Unit coverage: client/test/token-panel.test.ts (radius validation, create flags, edit merge) and admin-slice flags parsing.

Gates on the rebased tree: devbox run test 159 pass; devbox run client-test 173 pass; devbox run e2e 27 pass. No test weakened or skipped.

Implemented on `main` as bacf2e1. - Token panel create/edit now carries `flags.vision` and `vision_radius` (`client/src/tokenPanel.ts` pure seam + `panels/admin.ts`). Edits merge only the `vision` key into the stored flags; other GM flags survive. - Default decision: vision **off**, radius blank (scene default), matching DESIGN §8's `flags: '{}'`. Recorded as a dated FIXED note in DESIGN §8 and DESIGN-history §C; no wire default changed. - `client/e2e/fog.test.mjs` now authors the sighted token through the GM panel (no raw `flags`/`vision_radius` in a wire `token.create`). `client/e2e/admin.test.mjs` proves the create/edit round-trip on the GM `token` frame and an explored tile 200 / unexplored 403 probe for that player. - Unit coverage: `client/test/token-panel.test.ts` (radius validation, create flags, edit merge) and admin-slice flags parsing. Gates on the rebased tree: `devbox run test` 159 pass; `devbox run client-test` 173 pass; `devbox run e2e` 27 pass. No test weakened or skipped.
Sign in to join this conversation.