Commit Graph
11 Commits
Author SHA1 Message Date
SirStone c8b5289a3d fix: stream map import so 16384 px at 64 px is memory- and fd-bounded (#83)
The one-shot `magick -crop 64x64 +adjoin` built an image list of all 65,536 tiles; ImageMagick's
memory/map limits are per image, so the attempt held 4.3 GB of source cache plus every tile cache and
died after minutes with "Too many open files" at 1023 fds, having published nothing.

Slice by streaming instead: one disk-cache-backed decode of the source to raw samples, the CLI reads
it one tile row at a time, and a pool of 8 magick children cuts one row band each. Live caches and
fds are bounded by the worker count, never by the tile count. Progress goes to stderr ("rows 37/256,
tiles 9472/65536") and failures quote the image, row band and magick's own message. Atomicity is
unchanged: temp dir then rename, scene row only on success, same lock and exit codes.

Measured on the owner's 16384x16384 map at 64 px: 19 s, 391 MB peak RSS, 10 fds, 65,536 tiles (was
~5 min then failure). The tile pixels are identical to the old crop (proven tile by tile in
tools/import.test.mjs); PNG bytes can differ because the encoder now sees raw samples.

New gate: devbox run import-scale (16384/64 under ulimit -n 256) writes results/import-scale.log;
devbox run test keeps the fast fixtures and skips it.
2026-11-21 20:48:45 +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 356705823b feat(m4): LAN playtest run script (devbox run serve) (#80)
One command builds the client dist and server binary, then starts the
loopback server behind the DESIGN 11.1 TLS/HTTP2 nginx on the detected
LAN address. State, GM key and certificate persist under run/lan so a
table and a phone's trust survive Ctrl-C/restart; the certificate is
regenerated when the address changes. Prints the URL, GM key and
Android/laptop trust steps. tools/nginx.mjs and tools/tlsdev.mjs gained
the bind/SAN knobs the LAN needs (test defaults unchanged).
tools/serve.test.mjs proves h2 + verified TLS on /healthz and /, POST
/join, a /ws upgrade on the LAN address, loopback-only server binding,
and identical key/cert after a restart.
2026-11-21 16:33:57 +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 30512127b0 tools: test nginx, generated tile fixtures and the tile group (#24) 2026-11-15 12:30:51 +01:00
SirStone a3c1ac36ef devbox: nodejs 26, sqlite, test runs Nim then Node (#16) 2026-11-14 21:40:44 +01:00
SirStoneandClaude Sonnet 5.5 e0705a8533 bench: harness with synthetic 5k-wall scenes (devbox run bench), scenegen + tests
Targets met without a spatial grid: polygon+cells 0.048 ms (<= 0.451) on the prototype scene, polygon 0.083 ms
(< 1 ms) on 5k sparse. 5k dense stress layout reported (1.28 ms). Logs: results/bench.log, nimble-test.log.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 12:15:31 +01:00
SirStoneandClaude Sonnet 5.5 547458c37e m1: devbox, nimble, layout; port geometry.nim and 33 tgeometry tests (98 checks)
Fixture tests/fixtures/scene.json copied from prototype data/; seed test no longer skips if missing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 10:06:58 +01:00