Commit Graph
27 Commits
Author SHA1 Message Date
SirStone a79d809394 feat(m4): cap map images at Full HD and shrink on import (#85)
The owner fixed the map cap at 1920 px on the long side and 1080 px on the
short side (either orientation). fff-vtt import now shrinks a larger source
with ImageMagick Lanczos before tiling (alpha kept, proportions preserved,
no upscaling), prints `scaled WxH -> WxH`, and records the shrunk w/h; a
source at or below the cap is untouched, so the pixel-identity tests still
hold. A scene row already above the cap is not rewritten: the server logs
`map_above_cap` at startup and serve prints the re-import advice.

Docs: ADR-0023, DESIGN 3.3/5.3/8/11.1/13/14, TESTING 5.3/13, README,
HANDOFF-M4, client README. The M4 phone gate and the fogbench measurement
now use the Full HD maximum; the 16384 px / 262144-cell bench and test rows
stay as labelled server stress references. import-scale now proves a 16384²
input is shrunk to 1080x1080 (289 tiles at 64 px) quickly and bounded.

Part of #63, #85. #77 is blocked by this issue.
2026-11-21 22:37:34 +01:00
SirStone 514104f897 docs: record test wall times and the parallelism knob
Adds the warmed/cold table for test/client-test/e2e, the pre-push total,
mutation and bench, the machine/commit note and the FFF_TEST_JOBS /
FFF_E2E_JOBS overrides. TESTING explains what makes the fan-out safe (per-file
isolation, shared build cache, worktree-local nimcache, tmpfs state dirs) and
why the wall-clock gate files still run alone.
2026-11-21 21:42:34 +01:00
SirStone b56d645b3a docs: M4 built, acceptance pending playtest #77 2026-11-21 18:22:36 +01:00
SirStone 9c05bb1f46 fix(client): make data-tiles ready when the pass completes
A transient tile load error is terminal for the current window (retried only on
a new window or a reconnect), but data-tiles treated it as never settled, so one
host hiccup left it at 'loading' forever and every e2e readiness wait hung
(audit.test.mjs timed out under a parallel lane). TileScheduler.isPending() now
reports loading only for queued/in-flight tiles; ready means the pass is done.
Proven by aborting one tile request: the wait timed out before, passes after.
Unit-tested at the scheduler seam.
2026-11-21 18:19:47 +01:00
SirStone ac5a6ac8dc test: deflake map fill gate and wall-locked under load
Map gate (a): measure the fastest of 4 fresh page loads after a warm-up (min-of-N,
TESTING 5.3) against 2x the 1 s DESIGN budget (the documented saturated-host
tolerance), and print every sample; a planted 50 ms/tile decode delay fails it.

Wall editor: an ack dispatch re-renders with the previous server record, and the
panel repopulated every control on every render, so a just-toggled checkbox was
reverted until the wall frame landed (Playwright saw 'did not change its state').
Repopulate only when the record changed (src/panels/wallSync.ts, unit-tested) and
restore the controls when the server refuses an edit.
2026-11-21 17:37:11 +01:00
SirStone 9c7f9de910 feat(m4): playtest friction: perf overlay, fresh import, token seed (#82)
Opt-in ?perf=1 overlay (fps, frame p50/p95, JS p50/p95, tokens, zoom; no node or ticker work when off). fff-vtt import creates and migrates a fresh/empty state dir through the shared server startup path; devbox run serve gains --image. devbox run seed creates deterministic labelled NPC tokens over the real WS (idempotent rerun, --replace), and the GM token form defaults X/Y to the viewport centre.
2026-11-21 17:20:05 +01:00
SirStone ad610abd65 feat(server): map import CLI, pulled forward to M4 (#79)
Slice a PNG/WebP map into the gate's <x>_<y>.png tree under
<state>/tiles/<scene>/v<art_version>/ and update the one scene row
(w, h, tile_size, art_version); a re-import grows art_version so
clients never serve stale tiles. The state-dir lock keeps a running
server out (it loads the scene at startup), so stop/import/restart.

Decoding is ImageMagick from the root devbox with a disk-backed
pixel cache (-limit memory/map), keeping a 16384 px source
memory-sane; no Nim/npm image dependency and the FIXED stack is
unchanged. The black-box harness covers the tile geometry, scene
row, restart pickup through the gate, re-import bump and every
refused-import case.

Records the M6 -> M4 move in DESIGN 3.3/11.1/13 and DESIGN-history,
and documents the CLI plus the 16384 px/50-token recipe in README.
2026-11-21 15:59:54 +01:00
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 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
SirStone 1dff520f31 test: TLS + HTTP/2 test vhost with the client dist served at /
The test nginx is now the production shape of DESIGN 11.1 and the browser
gate's real path (#66, spec #63 decision 6): TLS-only listener with
http2 on, a self-signed certificate generated per run (tools/tlsdev.mjs,
added to the process's default CA list so verification stays on), the
client dist at / with SPA fallback, index no-cache and a year-immutable
/assets/ cache, and the tile gate's internal /_tiles/ still unreachable.

Existing tile/doors/oneway/wallbehaviour harnesses point their server's
public origin at the https vhost, so they prove the same listener the
browser uses. tools/vhost.test.mjs is the independent node:http2 client
(cert SANs, ALPN h2, cache headers, SPA fallback, direct /_tiles/ 404);
e2e/h2.test.mjs drives devbox chromium via playwright-core and asserts
the page reports h2 (`devbox run e2e`, npm deps outside tools/).

Root devbox gains chromium + openssl. Harness builds use a worktree-local
nimcache so parallel worktrees stop corrupting each other's objects.

Refs #66
2026-11-20 23:11:05 +01:00
SirStone 0448002cc5 test: load-insensitive tviews perf gate; env note 2026-11-20 22:44:55 +01:00
SirStone 414bb0326c fix: hit a wall lying along a sight ray so it casts its line's shadow (#26)
visibilityPolygon casts one ray per 64-gon vertex and ang, ang+-RayEps per wall
endpoint. A wall radial to the viewer is collinear with the ray that crosses it,
and rayHit rejected the collinear case; its own +-RayEps rays meet the wall's
line at the viewer (t = 0, rejected by t > Eps). So the wall got no ray, no
vertex and no shadow, and a token on the line beyond it stayed inside the
polygon: a player-view fog leak (DESIGN 3.1).

Fix: rayHit returns the nearest point of the overlap when the wall lies on the
ray's line (and Inf only for a parallel wall on another line). {.inline.} keeps
the fan's inner loop at its previous cost (CPU-time cross-check on 20k dense
polygons: 25.8s before, 32.5s without the pragma, 24.9s with it).

Proof: tgeometry visibility tests (horizontal k=0, vertical k=16, both wall
directions, a 32 px grid translation, 10 degrees, plus the non-radial and
0.5 px-off negative controls); the leak world gains a wall on the subject's own
column with a hidden token beyond it, and leakcheck's HIDDEN_TOKEN class now
asserts the token-level over-approximation (token centre + viewer->token
segment, 5.4 tolerance), which the GEOMETRY class structurally cannot see.
2026-11-20 22:17:45 +01:00
SirStone a11782f00d results: rerun the gates on the rebased tree (#36)
devbox run test: Nim suites and 149 node tests pass (the 16 registered group
evidence tests included). devbox run mutation: control and all 78 mutations pass,
including s1-s7 and the new e4/e5/f1-f3 from #32/#33/#35.

Refs #36.
2026-11-20 22:13:04 +01:00
SirStone 1f11779658 test: tie group evidence to passing tests and baseline restart on the as-built server (#36)
- tools/groups.mjs evidence entries now name the exact test, a minimum assertion
  count and the calls its body must keep; groups.test.mjs checks all three.
- tools/evidence.mjs parses the spec reporter log and fails the gate unless every
  registered evidence test ran and passed; test.sh runs it after the Node suite.
- restart.test.mjs snapshots the live as-built world on the first server, then
  compares it to the post-SIGTERM/SIGKILL state (players connect before the GM, so
  the GM's derived encountered grey is computed on both sides).
- Negative controls: a hollowed auth test fails the new evidence check; a planted
  first-load drop of a token's gm prop bucket fails the new restart baseline while
  the old restart-to-restart test passed.
- Refresh the gate evidence (control + 73 mutations incl. s1-s7, 142 node tests).
2026-11-20 21:55:50 +01:00
SirStone 38941da003 test: walls r1 review — tests and tools
Ref #52
2026-11-20 08:59:24 +01:00
SirStone f9f26a4a01 test(walls): rewrite the leak scenario as one world, gate every fault class (#61)
The Walls r1 scenario had grown appendages: a marked window bolted on in the
room, a one-way wall tacked onto the southern walk, and no secret or locked
door at all. #61 makes it one coherent world and proves the world itself.

The world now holds a room entered through an opening door, a far wall with a
solid stretch, a secret door and a locked door (a token behind each, so their
absence from the transcript is the leak proof), a one-way screen the subject
sees across, a marked window in the room, the same window's switch cleared and
restored (retraction and re-earn end to end), a marked solid wall, and a marked
window the subject never sees.

- tools/leak.mjs: declarative WORLD with role handles (no wallIds[1] indexing),
  narrative groups, and a scenarioCoverage() reading the GM's wall frames and
  the subject's marker frames.
- tools/leak.test.mjs: asserts the coverage on subject A: one-way wall, secret
  door, locked door, a marked window on each side of the sight gate and a
  marked non-window.
- tools/groups.mjs: the leak+fault group lists doors.test.mjs (#56) and
  markers.test.mjs (#59/#60) with their proving tests.
- docs/TESTING.md: the scenario, the coverage gate and the marker retraction
  exercise are recorded as built.

Fault matrix: all 21 fault classes still caught as exactly their own class
(oneWay, markerEarly/Extra/Off included); 22 tests with the clean-build gate.
That build passes and its bytes carry no LEAK_FAULT. nimble test and the
136-test node suite green.

Ref #61
2026-11-19 23:58:45 +01:00
SirStone a69563f701 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
2026-11-19 23:52:13 +01:00
SirStone c3c0a39188 feat(walls): marker retraction, re-earn and marker fault classes (#60)
Retract a player marker when the GM removes the wall, clears
player_marker, makes the wall stop deriving window, or moves its
geometry (a/b, thickness, position). Retraction emits del only and
never the new anchor; a re-earned marker gets a fresh id. The
marker_seen deletes ride the same derived-memory NORMAL transaction as
the explored chunks, after the wall row commits and before the ack.

Replace the leak checker's aggregate MARKER class with MARKER_EARLY,
MARKER_EXTRA and MARKER_OFF, add their leakfault hooks and exact-class
fault tests, and extend the leak scenario with an unseen marked window
and a marked solid wall as the negative controls. WS black-box tests
cover all four causes, fresh re-earns, no untouched re-send, no
set/del for one id in a frame, no explored write from a retraction,
and delete/cascade durability across a restart.
2026-11-19 23:43:44 +01:00
SirStone edd4437f7e feat(walls): player markers — emission, opaque ids, storage, resync (#59)
A wall that is player_marker:true and derives window sends a player one
anchor (the drawn midpoint, integer px) and an opaque per-player 12-char id
once any point of its segment enters that player's vision polygon. Markers
live in PlayerVision like explored, persist to marker_seen in the same
derived-memory transaction, load before the first connection and resync as a
full set after explored; the GM and other players never receive one.

- markers.nim: emission gate, visible-extent test, id mint, anchor, marker_seen I/O.
- views/main: PlayerView markers + full/diff frames, refresh sync, startup load.
- markers.test.mjs: window preset, switch off, solid wall, any-part anchor,
  walk-away/door/lost sight, full-after-explored, per-player privacy, GM none.
- leakcheck: marker allowed type + independent visible-extent oracle with a
  positive control (a marked window the subject sees).
- restart: marked window in the fixture; marker set and marker_seen rows
  identical before/after SIGTERM and SIGKILL.
- protocol/tviews: catalogue and frame order pin the 16th message.

Retraction, re-earning and MARKER_* faults are #60.

Ref #59
2026-11-19 23:27:26 +01:00
SirStone 9fcbe885c1 feat(walls): one-way sight per-viewer filter and ONEWAY fault (#58)
The vision fan blocks a sight-blocking one-way wall only for a viewer on
its blind side (sight_dir names it; left is the (-dy,dx) normal of a->b),
one sign test inline after the radius cull, so the hoisted wall list stays
viewer-independent. Movement never reads the direction: one-way walls block
both ways. Explored and tiles therefore differ by side and only ever grow.

- geometry: WallDir + Wall.sightDir + blindTo, filter in visibilityPolygon.
- worldmap: sight_dir mapping (movement mapping unchanged).
- vision: the ONEWAY leak-fault build drops sight_dir player-side.
- leakcheck: own side test for the fan and the clear-segment oracle; ONEWAY
  class detected against the sight_dir-dropped fan.
- leak scenario gains a one-way wall the subject sees across; fault test
  asserts exactly ONEWAY.
- oneway.test.mjs: both sides, tile sweep with its own oracle, flip with
  fixed endpoints, monotone explored/tiles, restart, two-way movement.
- docs: DESIGN 5.8 mechanism sentence corrected; TESTING #58 markers built.
- nginx harness: temp dirs created recursively (restart on one state dir).
2026-11-19 22:57:39 +01:00
SirStone 0f3aa2300f feat(walls): door refusals and secret/locked equivalence gate (#56)
- door.set: opening a secret or locked door is invalid; closing either is
  allowed; a fixed window/non-door still has no open state.
- new tools/doors.test.mjs: two fresh servers, one identical script, three
  equivalence pairs (secret/wall, secret+locked/wall, locked/closed door),
  canonicalised frame + full per-player tile sweeps, an open-door positive
  control and a pinned zero-thickness close-push.
- secretgap fault hook (sight-only) makes the pair fail as exactly SECRETGAP;
  the clean pair passes and the shipped binary carries no fault hook.
- docs/TESTING.md T2/T17 and the door-equivalence/10.3 sections: built.

Ref #56
2026-11-19 22:49:39 +01:00
SirStone 6a443b4ec0 docs: mark Walls r1 test artefacts as planned 2026-11-19 21:49:29 +01:00
SirStone 0d5173d56b docs: trim duplicate statements from TESTING; refresh ledger size 2026-11-17 23:25:18 +01:00
SirStone 1c655314ed docs: record the DESIGN/TESTING split ledger
Sizes before/after, the moved-block ledger, per-section FIXED counts and the
judgement calls left in DESIGN; cross-reference check for § and TESTING links.
2026-11-17 23:24:52 +01:00
SirStone 6bfb032548 docs: finish the DESIGN/TESTING split (§6-§13)
Protocol, client, ops and milestone sections keep their rules and gate criteria;
message-size measurements, close-assertion detail, the test nginx, the restore
drill, the slow-log provenance and the M3/M4 gate mechanics move to TESTING.
DESIGN §10 becomes a pointer section that keeps 10.1-10.4 so existing refs
resolve.
2026-11-17 23:22:48 +01:00
SirStone bc10780625 docs: point DESIGN §5 at TESTING; move vision/bench proof out
Edge-case counts and bug regressions, the perf table and bench scenes, oracle
citations, the move-rule regression baseline, the see-over oracle spec and the
thickness/joint measurements move to TESTING §5.1-§5.10. Targets, the 5k-wall
gate and the accepted thickness cost stay in DESIGN.
2026-11-17 23:22:06 +01:00
SirStone 39615afdf6 docs: add TESTING.md with the proof detail split out of DESIGN
New file holds test, acceptance, oracle, fault-class, gate and bench detail,
organised by DESIGN section number with a back-link per block. Tags, tickets
and evidence paths are preserved.
2026-11-17 23:21:16 +01:00