diff --git a/README.md b/README.md index 7c487fd..279a8bc 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,7 @@ Still missing entirely: | `devbox run e2e` | builds `client/dist`, then drives headless Chromium against the real server through the TLS/HTTP2 test nginx | | `devbox run mutation` | mutation suite on a temp copy of `server/`, `tests/`, `tools/`: every seeded mutation must fail at least one test | | `devbox run bench` | release-build bench of the vision and egress paths, writing `results/bench.log` | +| `devbox run fogbench` | the 50-token / 16384 px server measurement, writing `results/m4-fog-bench.log`; the numbers live in `results/m4-fog-bench.md` | | `devbox run -- nimble install -d -y` | install/refresh the pinned Nim dependencies | | `devbox run -- bash -c 'cd client && npm ci && npm run dev'` | Vite dev server on :5173 — the UI only, no server API behind it | @@ -227,9 +228,9 @@ you touch geometry, vision, move rules or egress. | `tests/` | Nim in-process suites, one file per area (`tvision.nim`, `tmoverules.nim`, `tdb.nim`, …) plus fixtures | | `tools/` | Node black-box harnesses (WS/HTTP against the real binary), the test nginx, the tile and scene fixture writers, the bench and the mutation script | | `docs/` | `DESIGN.md` (the spec), `TESTING.md` (how each rule is proven), `adr/` (decisions and why), `agents/` (agent workflow), `research/`, `DESIGN-history.md` | -| `results/` | committed gate evidence (`bench.log`, `leak-*.log`, `mutation.log`, `nimble-test.log`, `probing.log`, `faults.log`); the per-run `node-test.log`, `e2e.log` and `client-test.log` are regenerated, not committed | +| `results/` | committed gate evidence (`bench.log`, `leak-*.log`, `mutation.log`, `nimble-test.log`, `probing.log`, `faults.log`, `m4-fog-bench.*`); the per-run `node-test.log`, `e2e.log` and `client-test.log` are regenerated, not committed | | `run/` | gitignored scratch: built binaries, nimcache, local state dirs | -| `prototype-*` | the three prototypes whose measurements the design cites; DESIGN §1 archives them once M4 accepts | +| `docs/archive/prototypes/` | the three prototypes whose measurements the design cites, frozen at the M4 finish (#76); the maintained code is `server/` and `client/` | `GLOSSARY.md` at the root defines the domain words (wall switch, preset, token, character, player marker, stuck, squeezed, …). Use those words in code, tests and issues. diff --git a/client/README.md b/client/README.md index e96f4ad..0e463bc 100644 --- a/client/README.md +++ b/client/README.md @@ -73,6 +73,21 @@ change them only if a slice needs a new *core* event, and say so in the PR. - No game data (and no Pixi `Application`) exists before a live `hello`; a visitor without a session only sees the sign-in page. +## Traffic audit and the M4 measurement (T13, #76) + +- **Traffic audit** (`e2e/audit.test.mjs`) is the independent proof that the player browser cannot + become a leak. It records the page's own WebSocket frames and HTTP responses and applies its own + rules: only the 13 player frame types; no wall field and no GM-only token column at any depth; no + other player's id and no token outside the player's sight; vision polygons only for controlled + tokens; explored cells only inside a historical own-vision bbox; tiles only under `/tiles/`, only + 200/403, every served tile covering an explored cell, and `/_tiles/` unreachable. The banned-key + list is written in the test, never imported from `tools/leakcheck.nim`, so the proof is independent + of the server's own list. A second test is the negative control: the same rules run against a + `-d:leakfault` build with `LEAK_FAULT=otherVision` and must catch the injected foreign polygon. +- **50-token measurement**: the server half is `tools/fogbench.nim` (`devbox run fogbench`, 16384 px, + 50 tokens, ~5k walls); the headless half is `e2e/fogbench.test.mjs`. Numbers and the honest caveat + (SwiftShader is a floor, not a phone) are in `results/m4-fog-bench.md`. The real 60 fps run is #77. + ## Name, badge and reconnect (T5, #68) - **First sign-in name prompt.** A live player with `me.name === null` gets the `#name` section diff --git a/client/e2e/audit.test.mjs b/client/e2e/audit.test.mjs new file mode 100644 index 0000000..a2dcab4 --- /dev/null +++ b/client/e2e/audit.test.mjs @@ -0,0 +1,406 @@ +// T13 (#76, TESTING 10.3 "Independent traffic audit"): record every WebSocket frame and every HTTP +// response the *player browser* receives, then judge that recording with this file's own rules. +// +// Independence is the point: the banned-key list, the frame catalogue and the geometry checks below +// are written here and never imported from the server's `tools/leakcheck.nim` or `BannedAlways`. A +// server list that quietly loses an entry must not be able to weaken this proof. +// +// The scenario is a player who must see a lot of interesting state (own token, an NPC in sight, a +// window marker, fog, explored cells, tile requests including refused ones) while the GM authors +// every round-1 wall field. A second player and a `gm_only` token sit outside the audited player's +// sight; none of their ids may appear in its traffic. +import test from 'node:test' +import assert from 'node:assert/strict' +import { createPlayer, namePlayer, sleep } from '../../tools/lib.mjs' +import { openAs } from '../../tools/withserver.mjs' +import { writeTileGrid } from '../../tools/tilefixture.mjs' +import { launchBrowser, newPage, signIn, waitForVisible, withStack } from './stack.mjs' + +const SCENE = { w: 4096, h: 4096, tile: 32, cell: 32 } +const OWN = [2048, 2048] +const OTHER = [3500, 3500] + +/** DESIGN 6.1 server -> client rows a *player* may receive. GM-only rows are absent by design. */ +const PLAYER_FRAMES = new Set([ + 'hello', 'ack', 'error', 'roster', 'vision', 'explored', 'token', 'token_gone', + 'character', 'character_gone', 'encountered', 'closing', 'marker', +]) + +/** + * Fields a player must never receive. Own copy, deliberately broader than any server list: every + * wall geometry field, the GM-only wall and token columns, and the GM-only status cause. + */ +const BANNED_KEYS = new Set([ + // wall rows and the GM-only wall frames + 'wall', 'walls', 'wall_gone', + 'a', 'b', 'thickness', 'position', 'height', 'kind', + 'blocks_sight', 'blocks_movement', 'sight_dir', 'player_marker', + 'door', 'open', 'secret', 'locked', 'label', 'flags', + // GM-only token columns + 'controller', 'gm_only', 'descriptive_name', 'actual_name', 'reveal_all', 'revealed', + 'seen_by', 'source', +]) + +/** Record the page's own WebSocket frames without changing what the app sees. */ +async function recordSockets(page) { + await page.addInitScript(() => { + window.__audit = { sockets: 0, frames: [], closes: [] } + const Native = window.WebSocket + class RecordingSocket extends Native { + constructor(url, protocols) { + super(url, protocols) + this.opened = false + window.__audit.sockets += 1 + this.addEventListener('open', () => { this.opened = true }) + this.addEventListener('message', event => { + try { + window.__audit.frames.push(JSON.parse(event.data)) + } catch { + window.__audit.frames.push({ t: '', raw: String(event.data).slice(0, 80) }) + } + }) + this.addEventListener('close', event => { + window.__audit.closes.push({ code: event.code, reason: event.reason, opened: this.opened }) + }) + } + } + window.WebSocket = RecordingSocket + }) +} + +const framesOf = page => page.evaluate(() => window.__audit.frames) + +async function waitForFrames(page, predicate, timeout = 20000) { + await page.waitForFunction(predicate, null, { timeout }) +} + +function walkKeys(value, visit) { + if (Array.isArray(value)) { + for (const item of value) walkKeys(item, visit) + return + } + if (value === null || typeof value !== 'object') return + for (const [key, child] of Object.entries(value)) { + visit(key) + walkKeys(child, visit) + } +} + +/** Every explored cell the player was ever told about, from full RLE snapshots and cell diffs. */ +function exploredCells(frames) { + const cells = new Set() + for (const frame of frames) { + if (frame.t !== 'explored') continue + if (frame.full) { + for (const row of frame.rle ?? []) { + const cy = row[0] + for (let i = 1; i + 1 < row.length; i += 2) { + const x0 = row[i] + const len = row[i + 1] + for (let x = x0; x < x0 + len; x += 1) cells.add(`${x},${cy}`) + } + } + } else { + for (const [cx, cy] of frame.cells ?? []) cells.add(`${cx},${cy}`) + } + } + return cells +} + +/** Bounding boxes (cell coordinates) of every vision polygon the player was ever sent. */ +function visionBoxes(frames, cell) { + const boxes = [] + for (const frame of frames) { + if (frame.t !== 'vision') continue + for (const poly of frame.polys ?? []) { + const pts = poly.pts ?? [] + if (pts.length === 0) continue + const xs = pts.map(([x]) => x) + const ys = pts.map(([, y]) => y) + boxes.push({ + id: poly.id, + x0: Math.floor(Math.min(...xs) / cell) - 1, + y0: Math.floor(Math.min(...ys) / cell) - 1, + x1: Math.ceil(Math.max(...xs) / cell) + 1, + y1: Math.ceil(Math.max(...ys) / cell) + 1, + }) + } + } + return boxes +} + +function insideAnyBox(cx, cy, boxes) { + return boxes.some(b => cx >= b.x0 && cx <= b.x1 && cy >= b.y0 && cy <= b.y1) +} + +/** Judge the player's frame stream. Every rule below returns what it found, so the negative + * control can prove each rule can fail, not only that a clean run is empty. */ +function frameViolations(frames, { foreignPlayerId = null, foreignTokenIds = [], cell = 32, near = null } = {}) { + const offCatalogue = frames.filter(frame => !PLAYER_FRAMES.has(frame.t)) + const banned = [] + for (const frame of frames) { + walkKeys(frame, key => { + if (BANNED_KEYS.has(key)) banned.push({ t: frame.t, key }) + }) + } + const ownIds = new Set(frames.filter(f => f.t === 'token' && f.mine === true).map(f => f.id)) + const polyIds = new Set(frames.filter(f => f.t === 'vision').flatMap(f => (f.polys ?? []).map(p => p.id))) + const offSightPolys = [...polyIds].filter(id => !ownIds.has(id)) + + const withoutRoster = frames.filter(f => f.t !== 'roster') + const idFields = new Set(['id', 'player', 'owner', 'controller', 'seen_by']) + const foreignPlayers = [] + if (foreignPlayerId !== null) { + const visitIdFields = value => { + if (Array.isArray(value)) return value.forEach(visitIdFields) + if (value === null || typeof value !== 'object') return + for (const [key, child] of Object.entries(value)) { + if (idFields.has(key)) { + const values = Array.isArray(child) ? child : [child] + if (values.includes(foreignPlayerId)) foreignPlayers.push({ key, value: child }) + } + visitIdFields(child) + } + } + withoutRoster.forEach(visitIdFields) + } + const foreignTokens = foreignTokenIds.filter(id => withoutRoster.some(f => JSON.stringify(f).includes(id))) + + const boxes = visionBoxes(frames, cell) + const explored = exploredCells(frames) + const exploredOutside = [] + for (const key of explored) { + const [cx, cy] = key.split(',').map(Number) + if (!insideAnyBox(cx, cy, boxes)) exploredOutside.push([cx, cy]) + } + const exploredNear = [] + if (near) { + for (const key of explored) { + const [cx, cy] = key.split(',').map(Number) + if (Math.abs(cx * cell - near[0]) < 300 && Math.abs(cy * cell - near[1]) < 300) exploredNear.push([cx, cy]) + } + } + return { offCatalogue, banned, ownIds, polyIds, offSightPolys, foreignPlayers, foreignTokens, boxes, explored, exploredOutside, exploredNear } +} + +test('player browser traffic: catalogue-only frames, no wall data, no other player, allowed tiles', { timeout: 240000 }, async () => { + await withStack(async ({ origin, gmKey, stateDir }) => { + const gm = await openAs(origin, gmKey) + const hello = await gm.ws.waitText('hello') + const walls = await gm.ws.waitText('walls') + const scene = hello.scene ?? walls.scene + assert.deepEqual(walls.walls, [], 'the seeded scene starts without walls') + + // The audited player and a second player whose room stays out of Ann's sight. + const ann = await createPlayer(gm.ws) + await namePlayer(origin, ann.key, 'Ann') + const bea = await createPlayer(gm.ws) + await namePlayer(origin, bea.key, 'Bea') + + // Every round-1 wall field is authored around Ann *before* her token exists, so every explored + // cell derives from a polygon this page is actually sent (no pre-wall memory). + const authored = [ + { a: [1848, 2248], b: [2248, 2248], thickness: 20, position: 'left', height: 2.5, label: 'south wall' }, + { a: [1848, 1848], b: [1848, 2248], preset: 'door', thickness: 10 }, + { a: [2248, 1848], b: [2248, 2248], door: true, secret: true, blocks_sight: true, blocks_movement: true, label: 'hidden door' }, + { a: [1748, 1898], b: [1748, 2198], door: true, locked: true }, + { a: [1898, 1748], b: [2198, 1748], blocks_sight: true, blocks_movement: true, sight_dir: 'left', player_marker: true }, + { a: [1848, 1848], b: [2248, 1848], preset: 'window' }, + { a: [2648, 1848], b: [2648, 2248], flags: { note: 'opaque' } }, + ] + const ids = [] + for (const payload of authored) { + const ack = await gm.ws.request({ t: 'wall.add', scene: scene.id, ...payload }) + assert.equal(ack.ok, true, `wall.add ${JSON.stringify(payload)}: ${JSON.stringify(ack)}`) + ids.push(ack.id) + } + + // One sighted token plus an NPC inside its sight, a second player and a GM-only token outside. + const own = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'pc', pos: OWN, + descriptive_name: 'Ann', actual_name: 'Ann', controller: ann.id, + flags: { vision: true }, vision_radius: 300, radius: 20, + }) + assert.equal(own.ok, true, JSON.stringify(own)) + const npc = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'npc', pos: [2128, 2048], + descriptive_name: 'Rat', actual_name: 'Giant Rat', + }) + assert.equal(npc.ok, true, JSON.stringify(npc)) + const other = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'pc', pos: OTHER, + descriptive_name: 'Bea', actual_name: 'Bea', controller: bea.id, + flags: { vision: true }, vision_radius: 300, radius: 20, + }) + assert.equal(other.ok, true, JSON.stringify(other)) + const hidden = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'npc', pos: [1968, 1978], + descriptive_name: 'Secret', actual_name: 'Secret', gm_only: true, + }) + assert.equal(hidden.ok, true, JSON.stringify(hidden)) + + writeTileGrid(stateDir, { + scene: scene.id, artVersion: scene.art_version, size: scene.tile_size, + x0: 40, x1: 85, y0: 40, y1: 85, + }) + + const browser = await launchBrowser() + try { + const { page } = await newPage(browser) + const tileTraffic = [] + const requests = [] + page.on('request', request => requests.push(request.url())) + page.on('response', response => { + tileTraffic.push({ url: response.url(), status: response.status() }) + }) + await recordSockets(page) + + await page.goto(`${origin}/`) + await waitForVisible(page, '#signin') + await signIn(page, ann.key) + await waitForVisible(page, '#stage canvas') + await page.waitForFunction( + () => document.querySelector('#stage canvas')?.dataset.tiles === 'ready', + null, + { timeout: 30000 }, + ) + // The whole initial view has arrived (including the marker for the window Ann can see). + await waitForFrames(page, () => { + const seen = new Set(window.__audit.frames.map(frame => frame.t)) + return ['hello', 'roster', 'token', 'vision', 'explored', 'marker', 'encountered'] + .every(type => seen.has(type)) + }) + + // GM activity while the page records: edits, a door, a removal, a move of Ann's own token + // (new vision + explored cells) and of the NPC (a token update), then an untouched settle. + assert.equal((await gm.ws.request({ t: 'wall.update', scene: scene.id, id: ids[0], height: 3 })).ok, true) + assert.equal((await gm.ws.request({ t: 'door.set', scene: scene.id, id: ids[1], open: true })).ok, true) + assert.equal((await gm.ws.request({ t: 'wall.remove', scene: scene.id, id: ids[6] })).ok, true) + assert.equal((await gm.ws.request({ t: 'token.move', id: own.id, pos: [2048, 2160] })).ok, true) + assert.equal((await gm.ws.request({ t: 'token.move', id: npc.id, pos: [2100, 2080] })).ok, true) + await sleep(500) + + const frames = await framesOf(page) + assert.ok(frames.length > 10, `the audit recorded a real stream: ${frames.length} frames`) + + const v = frameViolations(frames, { + foreignPlayerId: bea.id, + foreignTokenIds: [other.id, hidden.id], + cell: scene.cell, + near: OTHER, + }) + + // 1. Catalogue only: every frame type is a row a player may receive. + assert.deepEqual(v.offCatalogue, [], `off-catalogue frames: ${JSON.stringify(v.offCatalogue.slice(0, 3))}`) + + // 2. No wall field and no GM-only column anywhere in the player's frames, at any depth. + assert.deepEqual(v.banned, [], `player frames carried forbidden keys: ${JSON.stringify(v.banned.slice(0, 5))}`) + + // 3. Vision polygons belong to Ann's own controlled token and nothing else. + assert.ok(v.polyIds.size > 0, 'the player received its vision polygons') + assert.deepEqual(v.offSightPolys, [], 'a vision polygon for a token Ann does not control') + + // 4. No other player's or hidden token's id anywhere except the roster's own player list. + // Player ids are small integers, so they are checked in id-shaped fields only (a `reqId` + // or a coordinate may legitimately equal one); token ids are opaque strings. + assert.deepEqual(v.foreignPlayers, [], `another player's id reached the player: ${JSON.stringify(v.foreignPlayers)}`) + assert.deepEqual(v.foreignTokens, [], `a token outside Ann's sight reached her: ${JSON.stringify(v.foreignTokens)}`) + + // 5. Explored is this player's own memory: every cell lies in the bbox of a polygon Ann was + // sent, and no cell is anywhere near the other player's room. + assert.ok(v.boxes.length > 0, 'historical vision polygons were recorded') + assert.ok(v.explored.size > 100, `explored has real content: ${v.explored.size} cells`) + assert.deepEqual(v.exploredOutside.slice(0, 5), [], `explored cells outside Ann's own sight: ${v.exploredOutside.length}`) + assert.deepEqual(v.exploredNear, [], 'no explored cell near the other player') + const explored = v.explored + + // 6. Tiles: only the product path, only 200/403, and every served tile overlaps a cell Ann + // has explored. `/_tiles/` is never reachable from the page. + const tileResponses = tileTraffic.filter(r => new URL(r.url).pathname.startsWith('/tiles/')) + assert.ok(tileResponses.length > 0, 'the page fetched map tiles') + for (const r of tileResponses) { + assert.ok([200, 403].includes(r.status), `unexpected tile status ${r.status} for ${r.url}`) + } + const served = tileResponses.filter(r => r.status === 200) + const refused = tileResponses.filter(r => r.status === 403) + assert.ok(served.length > 0 && refused.length > 0, 'the scenario has both allowed and refused tiles') + for (const r of served) { + const path = new URL(r.url).pathname + const match = /^\/tiles\/(\d+)\/v(\d+)\/(\d+)_(\d+)\.png$/.exec(path) + assert.ok(match, `tile URL not on the catalogue path: ${r.url}`) + const tx = Number(match[3]) + const ty = Number(match[4]) + assert.ok( + explored.has(`${tx},${ty}`), + `a served tile the player never explored: ${path} (${served.length} served)`, + ) + } + for (const url of requests) { + assert.ok(!url.includes('/_tiles/'), `the page requested the internal tile alias: ${url}`) + if (url.includes('/tiles/')) { + assert.match(new URL(url).pathname, /^\/tiles\/\d+\/v\d+\/\d+_\d+\.png$/, `unexpected tile path ${url}`) + } + } + const direct = await page.evaluate(async () => { + const response = await fetch('/_tiles/1/v1/60_60.png') + return response.status + }) + assert.equal(direct, 404, 'a direct /_tiles/ request from the page is refused') + + // 7. The live socket never closed during the audit. The boot probe's 1006 (the client asks + // `/ws` with no session and lands on sign-in) is expected and never opened. + const closes = await page.evaluate(() => window.__audit.closes) + assert.deepEqual( + closes.filter(c => c.opened && c.code !== 1005), + [], + `the live player socket closed: ${JSON.stringify(closes)}`, + ) + } finally { + await browser.close() + gm.ws.close() + } + }) +}) + +// Negative control: the audit must fail on a build that really leaks. `-d:leakfault` with +// `LEAK_FAULT=otherVision` injects another player's vision polygon into this player's `vision` +// frame (the server's own fault hook, not a fixture). The rule that catches it is rule 3: a polygon +// for a token the player does not control. +test('audit rules catch a leaking build (negative control)', { timeout: 180000 }, async () => { + await withStack(async ({ origin, gmKey }) => { + const gm = await openAs(origin, gmKey) + const hello = await gm.ws.waitText('hello') + await gm.ws.waitText('walls') + const scene = hello.scene + const ann = await createPlayer(gm.ws) + await namePlayer(origin, ann.key, 'Ann') + const bea = await createPlayer(gm.ws) + await namePlayer(origin, bea.key, 'Bea') + for (const [player, pos, name] of [[ann, [1200, 1200], 'Ann'], [bea, [3000, 3000], 'Bea']]) { + const ack = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'pc', pos, + descriptive_name: name, actual_name: name, controller: player.id, + flags: { vision: true }, vision_radius: 300, radius: 20, + }) + assert.equal(ack.ok, true, JSON.stringify(ack)) + } + + const browser = await launchBrowser() + try { + const { page } = await newPage(browser) + await recordSockets(page) + await page.goto(`${origin}/`) + await waitForVisible(page, '#signin') + await signIn(page, ann.key) + await waitForVisible(page, '#stage canvas') + await waitForFrames(page, () => + (window.__audit.frames ?? []).some(f => f.t === 'vision' && (f.polys ?? []).length >= 2)) + const frames = await framesOf(page) + const v = frameViolations(frames) + assert.ok(v.offSightPolys.length > 0, 'the off-sight polygon rule fired on the leaking build') + } finally { + await browser.close() + gm.ws.close() + } + }, { server: { defines: ['leakfault'], env: { LEAK_FAULT: 'otherVision' } } }) +}) diff --git a/client/e2e/fogbench.test.mjs b/client/e2e/fogbench.test.mjs new file mode 100644 index 0000000..ae98735 --- /dev/null +++ b/client/e2e/fogbench.test.mjs @@ -0,0 +1,159 @@ +// T13 (#76): the 50-token, 16384 px map measurement the finish ticket records in +// `results/m4-fog-bench.md`. This is NOT the phone gate: headless Chromium here renders with +// SwiftShader (software), so its frame cadence is a floor for correctness work, never a substitute +// for the Note 10 run (#77). The server half of the same measurement is `tools/fogbench.nim`. +// +// The scene is the real one, patched to 16384 px (only the importer owns w/h, so the harness writes +// the scene row before the server loads it). 50 tokens sit inside the player's sight; the fog +// texture is therefore 512x512 cells, the real M4 maximum. +import test from 'node:test' +import assert from 'node:assert/strict' +import { spawnSync } from 'node:child_process' +import path from 'node:path' +import { createPlayer, namePlayer } from '../../tools/lib.mjs' +import { openAs } from '../../tools/withserver.mjs' +import { writeTileGrid } from '../../tools/tilefixture.mjs' +import { launchBrowser, signIn, waitForVisible, withStack, sleep } from './stack.mjs' + +const MOBILE = { viewport: { width: 412, height: 869 }, deviceScaleFactor: 2.625, isMobile: true, hasTouch: true } +const SIZE = 16384 +const CENTRE = [SIZE / 2, SIZE / 2] + +/** The scene row is the importer's (DESIGN 6.1: w/h are not wire fields); write it before boot. */ +function setSceneSize(stateDir, size) { + const db = path.join(stateDir, 'state.db') + const r = spawnSync('sqlite3', [db, `UPDATE scene SET w=${size}, h=${size} WHERE id=1`], { encoding: 'utf8' }) + assert.equal(r.status, 0, `set scene size: ${r.stderr}`) +} + +async function gmWorld(origin, gmKey) { + const gm = await openAs(origin, gmKey) + const hello = await gm.ws.waitText('hello') + const walls = await gm.ws.waitText('walls') + return { ...gm, hello, scene: hello.scene ?? walls.scene } +} + +/** 50 tokens: one controlled sighted token and 49 NPCs packed inside its radius. */ +async function fiftyTokens(gm, scene, player) { + const own = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'pc', pos: CENTRE, + descriptive_name: 'Ann', actual_name: 'Ann', controller: player.id, + flags: { vision: true }, vision_radius: 400, radius: 20, + }) + assert.equal(own.ok, true, JSON.stringify(own)) + for (let i = 0; i < 49; i += 1) { + const ack = await gm.ws.request({ + t: 'token.create', scene: scene.id, kind: 'npc', + pos: [CENTRE[0] + ((i % 7) - 3) * 28, CENTRE[1] + (Math.floor(i / 7) - 3) * 28], + descriptive_name: `T${i}`, actual_name: `T${i}`, + }) + assert.equal(ack.ok, true, JSON.stringify(ack)) + } +} + +/** rAF cadence over `count` frames, summarised the way the fog-cost test does. */ +async function cadence(page, count) { + return page.evaluate(async frames => { + const samples = [] + await new Promise(resolve => { + let last = performance.now() + let seen = 0 + const step = () => { + const now = performance.now() + samples.push(now - last) + last = now + seen += 1 + if (seen < frames) requestAnimationFrame(step) + else resolve() + } + requestAnimationFrame(step) + }) + samples.sort((a, b) => a - b) + return { + samples: samples.length, + median: samples[Math.floor(samples.length / 2)], + p95: samples[Math.floor(samples.length * 0.95)], + } + }, count) +} + +const fogState = page => + page.evaluate(() => { + const data = document.querySelector('#stage canvas')?.dataset + if (!data) return null + return { + cells: Number(data.fogCells ?? -1), + polys: Number(data.fogPolys ?? -1), + fullMs: Number(data.fogFullMs ?? -1), + tokens: Number(data.tokens ?? -1), + } + }) + +test('50-token fog measurement on a 16384 px map (headless SwiftShader, not the phone gate)', { timeout: 180000 }, async () => { + await withStack(async ({ origin, gmKey, stateDir }) => { + const gm = await gmWorld(origin, gmKey) + const scene = gm.scene + assert.equal(scene.w, SIZE, 'the prepared scene is 16384 px') + const player = await createPlayer(gm.ws) + await namePlayer(origin, player.key, 'Ann') + await fiftyTokens(gm, scene, { id: player.id }) + + // Only the viewport's window needs fixture bytes; 16384 px would be 262144 files. + writeTileGrid(stateDir, { + scene: scene.id, artVersion: scene.art_version, size: scene.tile_size, + x0: 240, x1: 280, y0: 235, y1: 280, + }) + + const browser = await launchBrowser() + try { + const context = await browser.newContext({ ignoreHTTPSErrors: true, ...MOBILE }) + const page = await context.newPage() + const cdp = await context.newCDPSession(page) + const errors = [] + page.on('pageerror', error => errors.push(error.message)) + page.on('console', message => { + if (message.type() === 'error' && !message.text().includes('WebSocket connection') && + !message.text().includes('403') && !message.text().includes('net::ERR_')) { + errors.push(message.text()) + } + }) + + await page.goto(`${origin}/`) + await waitForVisible(page, '#signin') + await signIn(page, player.key) + await waitForVisible(page, '#stage canvas') + await page.waitForFunction( + () => document.querySelector('#stage canvas')?.dataset.tiles === 'ready', + null, + { timeout: 30000 }, + ) + await page.waitForFunction( + () => Number(document.querySelector('#stage canvas')?.dataset.fogPolys ?? 0) > 0, + null, + { timeout: 30000 }, + ) + const initial = await fogState(page) + assert.equal(initial.tokens, 50, `the client draws 50 tokens: ${initial.tokens}`) + assert.ok(initial.cells > 400, `a 16384 px map explored cells: ${initial.cells}`) + assert.ok(initial.fullMs > 0, `the 512x512 fog snapshot was repainted: ${initial.fullMs}`) + + const real = await cadence(page, 120) + await cdp.send('Emulation.setCPUThrottlingRate', { rate: 4 }) + await sleep(200) + const throttled = await cadence(page, 90) + assert.deepEqual(errors, []) + + console.log( + `fogbench (#76): 16384px map (512x512 cells), 50 tokens, 412x869 dpr2.625, ` + + `SwiftShader: fog snapshot=${initial.fullMs.toFixed(3)}ms exploredCells=${initial.cells} ` + + `frames real median=${real.median.toFixed(1)}ms p95=${real.p95.toFixed(1)}ms ` + + `4xCPU median=${throttled.median.toFixed(1)}ms p95=${throttled.p95.toFixed(1)}ms ` + + `(software rasteriser: floor only, not the phone number)`, + ) + await context.close() + } finally { + await browser.close() + gm.ws.close() + } + }, { prepare: stateDir => setSceneSize(stateDir, SIZE) }) +}) diff --git a/client/e2e/stack.mjs b/client/e2e/stack.mjs index e6824b4..cde2022 100644 --- a/client/e2e/stack.mjs +++ b/client/e2e/stack.mjs @@ -25,12 +25,13 @@ export function assertClientBuild() { ) } -export async function withStack(fn) { +export async function withStack(fn, opts = {}) { assertClientBuild() const stateDir = makeStateDir() const gmKey = gmKeyOf(stateDir) + if (opts.prepare) await opts.prepare(stateDir, gmKey) const nginxPort = await freePort() - const server = await startServer({ stateDir, publicOrigin: httpsBaseUrl(nginxPort) }) + const server = await startServer({ stateDir, publicOrigin: httpsBaseUrl(nginxPort), ...(opts.server ?? {}) }) let nginx try { nginx = await startTestNginx({ diff --git a/devbox.json b/devbox.json index 0b60421..9bbe868 100644 --- a/devbox.json +++ b/devbox.json @@ -36,6 +36,9 @@ ], "bench": [ "mkdir -p results; nim c -d:release --hints:off -r tools/bench.nim > results/bench.log 2>&1; rc=$?; cat results/bench.log; exit $rc" + ], + "fogbench": [ + "mkdir -p results; nim c -d:release --hints:off -o:run/test/fogbench tools/fogbench.nim > results/m4-fog-bench.log 2>&1 && ./run/test/fogbench >> results/m4-fog-bench.log 2>&1; rc=$?; cat results/m4-fog-bench.log; exit $rc" ] } }, diff --git a/docs/DESIGN-history.md b/docs/DESIGN-history.md index bea2dc8..e43b196 100644 --- a/docs/DESIGN-history.md +++ b/docs/DESIGN-history.md @@ -84,13 +84,13 @@ All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN. ## B. HANDOFF traceability (old DESIGN §12) -Source: `prototype-server-vision/HANDOFF.md` (and README/NOTES worries). Every +Source: `docs/archive/prototypes/server-vision/HANDOFF.md` (and README/NOTES worries). Every row is resolved; the current rules are in the sections each row names. ## 12. HANDOFF items -> decisions / open questions -Source: `prototype-server-vision/HANDOFF.md` (and README/NOTES worries). +Source: `docs/archive/prototypes/server-vision/HANDOFF.md` (and README/NOTES worries). | # | Item | Decision / open | Milestone | |---|---|---|---| @@ -148,7 +148,7 @@ Source: `prototype-server-vision/HANDOFF.md` (and README/NOTES worries). [FIXED (owner decision), 2026-11-08]:** `tile_size` = explored cell size = 32 px. Residual leak is at most one cell, never revoked; no server-side masking. Authoring rule shrinks from ~256 px to ~32 px. M4 acceptance: (a) headless mobile-emulation test on the real server path, (b) one manual - phone run; fallback 64 px (per-scene config). Evidence: `prototype-tile-leak/README.md`. Applied + phone run; fallback 64 px (per-scene config). Evidence: `docs/archive/prototypes/tile-leak/README.md`. Applied in 3.3, 3.4 (T5), 8, 12 (H8), 13 (M4, M6). 5. Q5 - Map import: CLI-only for v1, or upload + tiling from the browser (GM) from the start? **RESOLVED [FIXED (owner decision), 2026-11-08]:** map import is CLI-only in v1; browser upload is diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 84849e3..61a51a7 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -19,15 +19,16 @@ Legend: - **[PROPOSED]** design choice made in this doc; the owner may overturn it. Evidence roots (relative to repo root): -- `prototype-pixi-perf/` (client perf; README holds all tables) -- `prototype-server-vision/` (server + vision; `README.md`, `HANDOFF.md`, `NOTES.md`, `results/`, +- `docs/archive/prototypes/pixi-perf/` (client perf; README holds all tables) +- `docs/archive/prototypes/server-vision/` (server + vision; `README.md`, `HANDOFF.md`, `NOTES.md`, `results/`, `results/spike/investigation.md`) -- `prototype-tile-leak/` (tile size vs leak; `README.md` holds desktop tables and the 2026-11-08 +- `docs/archive/prototypes/tile-leak/` (tile size vs leak; `README.md` holds desktop tables and the 2026-11-08 phone run; `results/phone-20261108T113701.jsonl`) - `docs/prototype.md` is only the original brief for the perf prototype. - No FFF engine notes exist in the repo. `GLOSSARY.md` and `docs/adr/` exist per AGENTS.md (Q24, - FIXED). `prototype-*` dirs stay in-tree until the M4 client port, then are archived (Q24, FIXED). - Nothing here is FFF-specific beyond the seam in section 9. + FIXED). `prototype-*` trees are archived at `docs/archive/prototypes/` from the M4 finish (#76; + Q24, FIXED): frozen history, never built or maintained, with the maintained code in `/server` and + `/client`. Nothing here is FFF-specific beyond the seam in section 9. --- @@ -107,7 +108,7 @@ entitled to. the official pixijs-skills (already in `.agents/skills/pixijs*`). - Server: Nim 2.x; `mummy` pinned to tag `0.4.8` (commit `77a7563e`; `src/` identical to the former pin `01deb1ff694988635c7bf0f24f6088a0bdf6db5d`) [FIXED (owner decision), 2026-11-08; tags - 0.4.6-0.4.8 exist]. `prototype-server-vision/servervision.nimble` still pins the commit until + 0.4.6-0.4.8 exist]. `docs/archive/prototypes/server-vision/servervision.nimble` still pins the commit until ported; `db_connector/db_sqlite`, WAL. No Nim in the browser. - nginx (existing, HTTPS) in front: static client, reverse proxy for `/ws`, `/join`, `/tiles/`; internal location for tile bytes. @@ -157,7 +158,7 @@ entitled to. - **Single egress rule [PROPOSED]:** all bytes to a player leave through one egress module that takes a recipient and a typed per-recipient view. Raw world state (walls, hidden entities, other players' explored grids) has no code path into that module. The prototype enforces this by - discipline in `sync()` (`prototype-server-vision/src/server.nim`); the real build should enforce + discipline in `sync()` (`docs/archive/prototypes/server-vision/src/server.nim`); the real build should enforce it by types (distinct `PlayerView` and `GmView` structures, no `JsonNode` of world state passed around). - Client-side fog is cosmetic. Security never depends on the client hiding anything (section 7). @@ -420,7 +421,7 @@ server clamps nothing silently (clamping would leak the hit distance, T8). ### 4.3 Locking and threading - mummy: `WebSocket.send` appends the encoded frame to one server-wide deque under `sendQueueLock` and wakes the IO thread; worker threads handle events; per-socket events are serialized [MEASURED - reading, `prototype-server-vision/README.md` "mummy suitability", mummy.nim ~L262-311]. + reading, `docs/archive/prototypes/server-vision/README.md` "mummy suitability", mummy.nim ~L262-311]. - **One global lock** around intent handling and outbox enqueue; network sends happen outside it (flush, see 4.2). [MEASURED] order, loss and final-view consistency over 3 x 60 s runs, and the latency figures: TESTING §4.3. @@ -691,7 +692,7 @@ explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, sc ## 5. Vision and explored -### 5.1 Algorithm (ported from `prototype-server-vision/src/geometry.nim`) +### 5.1 Algorithm (ported from `docs/archive/prototypes/server-vision/src/geometry.nim`) - **Visibility polygon** from token centre: cast rays to every blocking wall endpoint (for a thick wall, every corner of its body quad, 5.10) at angle -eps, 0, +eps (`RayEps` = 1e-4 rad), plus an inscribed 64-gon of radius R as range limit; sort by angle; each ray returns nearest hit among @@ -1900,7 +1901,7 @@ they are not fed until resync, and nginx closes dead peers (M5). ### 7.1 Layers (bottom to top, one Pixi stage under a world container with pan/zoom) 1. **Map tiles**: sprites per tile, loaded lazily for tiles the server allows. 2. **Grid**: one `TilingSprite` over a small cell texture, toggleable [MEASURED technique, - `prototype-pixi-perf/README.md` Techniques]. + `docs/archive/prototypes/pixi-perf/README.md` Techniques]. 3. **Entities/tokens**: pooled containers, shared `GraphicsContext` per colour, `BitmapText` labels. 4. **Fog (players)**: explored dim layer + vision cut-out (7.3). 5. **GM overlay (GM only)**: walls/doors Graphics, wall editor handles; hidden from players by never @@ -1911,7 +1912,7 @@ they are not fed until resync, and nginx closes dead peers (M5). The module layout and the append-only extension rules (one reducer slice file, one render module file per feature; no shared registry edit) are written in `client/README.md` [T4, #67]. -### 7.2 Rendering techniques kept from the perf prototype [MEASURED, `prototype-pixi-perf/README.md`] +### 7.2 Rendering techniques kept from the perf prototype [MEASURED, `docs/archive/prototypes/pixi-perf/README.md`] - Verdict: Pixi v8 renders a VTT scene at 60 fps on Radeon 780M (WebGL and WebGPU) and Galaxy Note 10 (WebGL) up to 1000 tokens (Note 10 js ~14 ms, 2000 tokens -> 32-36 fps, CPU-bound; laptop js 9-12 ms at 2000). Only per-frame token JS scales; a table needs tens of tokens. @@ -2144,7 +2145,7 @@ copy/export stable). - **Connection (runtime)**: id, player, `known` map, last vision ver, counter. Prototype entity (for mapping): `Tok{id,name,kind,pos,gmOnly}` + `tokenRadius` global in scene -(`prototype-server-vision/data/scene.json`: 4096 px world, 256 px tiles, radius 400, token radius +(`docs/archive/prototypes/server-vision/data/scene.json`: 4096 px world, 256 px tiles, radius 400, token radius 20, cell 32, 60 walls, 8 tokens). --- @@ -2256,7 +2257,7 @@ See TESTING §10.4 (Node 26 black-box harnesses, built-ins only, `devbox run tes - Response headers: HSTS, CSP (no inline scripts, `connect-src 'self'` wss), `X-Content-Type-Options`, `Referrer-Policy`. - No `limit_req` on `/join` (owner, #6: no rate limit on key entry; ~100-bit key space). -- Prototype nginx config (`prototype-server-vision/nginx/nginx.conf`) is the functional reference; +- Prototype nginx config (`docs/archive/prototypes/server-vision/nginx/nginx.conf`) is the functional reference; its `listen` has no address (binds all) and its temp/log paths are dev-only. - Map import: offline CLI that slices an image into `tile_size` PNG/WebP tiles into `/tiles//v/` and registers/updates the scene (prototype: @@ -2327,18 +2328,24 @@ columns with today's defaults) lands complete now, so the later build needs no m green on a clean checkout with the nine groups: leak+fault, tiles, probing, protocol, auth, characters and names, restart, persistence, logs. Gate mechanics and the measured result: TESTING §13. Out of M3 accept: concurrency (M5), the 127.0.0.1 bind check (M6). -- **M4 - Client v1.** Vite + TS + Pixi v8 client: layers, tiles, grid, tokens (BitmapText), - character and encountered lists, reveal controls, fog textures, the wall editor (four presets, - switches, marker, label, one-way arrow and flips), token drag with prediction/rollback, DOM - overlay, reconnect backoff, reducer tests; then archive `prototype-*` (Q24). Thickness and height - controls are not in M4 (build order above; 5.7, 5.10). - - Accept: headless e2e (fog pixel checks, player traffic audit clean, reconnect restores); manual - run on laptop and Note 10 at 60 fps with 50 tokens on a 16384 px tiled map (test target - PROPOSED, Q2), fog active. +- **M4 - Client v1.** Done (2026-11-21, #76). Vite + TS + Pixi v8 client: layers, tiles, grid, + tokens (BitmapText), character and encountered lists, reveal controls, fog textures, the wall + editor (four presets, switches, marker, label, one-way arrow and flips), token drag with + prediction/rollback, DOM overlay, reconnect backoff, reducer tests; `prototype-*` archived under + `docs/archive/prototypes/` (Q24). Thickness and height controls are not in M4 (build order above; + 5.7, 5.10). + - Accept: headless e2e (fog pixel checks, player traffic audit clean, reconnect restores) - met by + `devbox run e2e` including `client/e2e/audit.test.mjs`; the manual run on laptop and Note 10 at + 60 fps with 50 tokens on a 16384 px tiled map (test target PROPOSED, Q2) with fog active is + #77, the one `ready-for-human` step, and remains open by design. - Tile-size gates [FIXED, Q4]: (a) automated headless-Chromium test (mobile emulation, real server - path): viewport fills in < 1 s at zoom 1; (b) one manual run on the owner's 5-year-old Android - phone. If either fails: `tile_size` 64 px (per-scene config, no code change). Harness detail and - the prototype-run caveat: TESTING §13. + path): viewport fills in < 1 s at zoom 1 - met in `client/e2e/map.test.mjs`; (b) one manual run + on the owner's 5-year-old Android phone - #77. If either fails: `tile_size` 64 px (per-scene + config, no code change). Harness detail and the prototype-run caveat: TESTING §13. + - Finish evidence (#76): `results/m4-fog-bench.md` (50 tokens / 16384 px: server move path + 0.119 ms; headless SwiftShader cadence recorded, explicitly not a phone number), + `results/bench.log`, `results/mutation.log`, `results/nimble-test.log`, and the + `devbox run test | client-test | e2e` logs (regenerated, not committed). - **M5 - Robustness and observability.** SIGTERM handler, bounded metrics and SLOW lines, per-client bounded outbox with coalescing and Ping/Pong lag tracking (4.3), verify `/ws` goes through nginx and which timeout closes a dead peer, healthz lock check. Accept: concurrency 60 s x3 with p99 <= diff --git a/docs/HANDOFF-M4.md b/docs/HANDOFF-M4.md new file mode 100644 index 0000000..270085f --- /dev/null +++ b/docs/HANDOFF-M4.md @@ -0,0 +1,43 @@ +# Handoff: end of M4 + +**Current at 2026-11-21**, M4 finish (#76). M1-M4 are done; M5 is next. This is the close-out note +for the M4 run: what exists, what is proven, what is deliberately still open. + +## State + +- **Server:** `proto` 2, 29 intents / 16 server messages, one scene, thin walls with the 5.8 + switches, doors/secret/locked, windows, one-way, player markers, characters/names, per-player + explored + vision, lock-free tile gate and session cache (#64, #65). `devbox run test` is the + server gate. +- **Client:** `/client` (Vite + TS + PixiJS v8, plain DOM overlay). Sign-in, name prompt, badge, + reconnect + full resync, tiles/grid/pan/zoom, three-state fog + markers, tokens/labels/statuses, + both lists, drag with prediction/rollback, GM wall editor, roster/keys/tokens panel, characters/ + reveals/who-sees-it. Gates: `devbox run client-test`, `devbox run e2e`. +- **M4 accept:** `devbox run e2e` proves join, fog pixels, drag/rollback, reconnect and the + independent player-traffic audit; `results/m4-fog-bench.md` records 50 tokens on a 16384 px map + (server move path 0.12-0.14 ms; headless SwiftShader cadence recorded as a floor, not a phone + number). Thickness/height controls are **not** in M4 (ADR-0012); walls round 2 is #37/#45/#50/ + #41/#44. +- **Archived:** the three `prototype-*` trees now live under `docs/archive/prototypes/` (frozen, + not built). One maintained client (`/client`), one server (`/server`). + +## Still open + +- **#77** - the human real-phone playtest: Note 10 + laptop, 16384 px map, 50 tokens, fog active, + LAN TLS/h2. Its comment is the checklist with commands, numbers to record and pass thresholds. + `#63` and `#62` close only after #77. +- **M5** - concurrency, bounded outbox/coalescing, lag tracking, SIGTERM, metrics, nginx dead-peer + timeout, stats outside the lock. `#34` heartbeat is M5. +- **Deferred:** `db_connector` -> thin sqlite3 binding (build item 13); per-token polygon cache and + incremental wall-edit refresh (items 3/4) are **not** needed by the M4 measurement. + +## Notes for the next session + +- `AGENTS.md` points at the issue tracker and the domain docs. Use the Gitea issues, not the docs, + for work state. +- Gates are sequential and real: `devbox run test`, `devbox run client-test`, `devbox run e2e`, + `devbox run mutation`, `devbox run bench`, and (for fog numbers) `devbox run fogbench`. +- `results/*.log` are evidence and committed; `results/node-test.log`, `results/e2e.log`, + `results/client-test.log` are gitignored scratch and regenerated. +- Browser e2e: `client/e2e/` owns `playwright-core`; `tools/` stays built-ins-only (TESTING §10.4). + The e2e stack is the real server through the TLS/HTTP2 test nginx, never a fixture. diff --git a/docs/TESTING.md b/docs/TESTING.md index 322bcb6..62f6d27 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -18,10 +18,10 @@ independent of the code under test where possible, and every check needs a negat it can fail. Evidence roots (relative to repo root): -- `prototype-pixi-perf/` (client perf; README holds all tables) -- `prototype-server-vision/` (server + vision; `README.md`, `HANDOFF.md`, `NOTES.md`, `results/`, +- `docs/archive/prototypes/pixi-perf/` (client perf; README holds all tables) +- `docs/archive/prototypes/server-vision/` (server + vision; `README.md`, `HANDOFF.md`, `NOTES.md`, `results/`, `results/spike/investigation.md`) -- `prototype-tile-leak/` (tile size vs leak; README tables and the 2026-11-08 phone run) +- `docs/archive/prototypes/tile-leak/` (tile size vs leak; README tables and the 2026-11-08 phone run) How to run: `devbox run test` = Nim in-process tests first, then the Node black-box harnesses; `devbox run mutation` = the mutation suite. Run everything from the repo root through `devbox run`. @@ -46,11 +46,11 @@ built against glibc 2.44 while this host (NixOS) runs 2.42, so a 2.44-built `lib **Rule:** DESIGN §3.3. -- Direct hits on `/_tiles/` give 404 [MEASURED: `prototype-server-vision/results/smoke.log`, README +- Direct hits on `/_tiles/` give 404 [MEASURED: `docs/archive/prototypes/server-vision/results/smoke.log`, README "Phase 2a"]. - A tile is allowed iff at least one explored cell of that player overlaps it [MEASURED semantics: leak test (d), 9984 + 7424 requests, 0 failures, `results/leak-A.log`, `results/leak-B.log`]. -- The residual 32 px edge leak's sizing evidence: `prototype-tile-leak/README.md` (desktop numbers; +- The residual 32 px edge leak's sizing evidence: `docs/archive/prototypes/tile-leak/README.md` (desktop numbers; phone run 2026-11-08). M4's tile-size gates are in §13 below. - `Cache-Control: private` is set by the Nim gate and rides through nginx's internal redirect unchanged; nginx adds nothing of its own there (the test vhost records this, §11.1). @@ -552,7 +552,7 @@ from the prototype, what was missing, what the M3 build added, and the tools it state is queued to it, RSS flat, full resync on recovery equals a fresh connection; nginx closes the dead `/ws` socket within its configured timeout. - **Browser e2e (new, none in prototype)**: headless Chromium via playwright-core (the perf prototype - already drives devbox chromium, `prototype-pixi-perf/bench.mjs`; SwiftShader is fine for correctness, + already drives devbox chromium, `docs/archive/prototypes/pixi-perf/bench.mjs`; SwiftShader is fine for correctness, not for perf). Checks: join -> canvas renders; pixel probe shows unexplored area black, visible area map-coloured, dimmed explored area; GM sees walls, player DOM/network contains none; reconnect restores view; drag moves token and rollback works. The harness is `client/e2e/` (the client package @@ -571,13 +571,20 @@ from the prototype, what was missing, what the M3 build added, and the tools it real Vite build (`client/e2e/run.sh` runs `npm run build` first): `performance.getEntriesByType('navigation')[0].nextHopProtocol` is `h2` over TLS. The vhost group keeps a local stub dist because `devbox run test` must not depend on the client's npm install. -- **Independent traffic audit in e2e**: record all WS frames and HTTP responses seen by a player - browser and run the leak checker's (a)(e) assertions over them. +- **Independent traffic audit in e2e**: `client/e2e/audit.test.mjs` records every WS frame and every + HTTP response the *player browser* receives and judges them with its own catalogue and banned-key + list (never importing `tools/leakcheck.nim`): only the 13 player frame types; no wall geometry or + GM-only column at any depth; vision polygons only for the player's own tokens; no other player's + id or out-of-sight token id; explored cells only inside a historical own-vision bbox and never near + the other player; tiles only on `/tiles/`, only 200/403, every 200 covering an explored cell, and + `/_tiles/` unreachable (direct fetch 404). It runs in `devbox run e2e` beside the fog, drag and + reconnect files. A negative control runs the same rules against a `-d:leakfault` build with + `LEAK_FAULT=otherVision`, so the rule that rejects a foreign vision polygon is proven able to fail. ### 10.4 Test tools [FIXED, owner decision 2026-11-14, #9] - Black-box (outside) WS/HTTP harnesses: Node 26 only, repo-root `tools/`, ported from - `prototype-server-vision/tools/` (`smoke.mjs`, `leak.mjs`, `restart.mjs`, `concurrency.mjs`, + `docs/archive/prototypes/server-vision/tools/` (`smoke.mjs`, `leak.mjs`, `restart.mjs`, `concurrency.mjs`, `lib.mjs`, `withserver.sh` incl. the M3 test nginx). No Nim rewrite. Reason: Node is already required for the client (Vite/TS, playwright-core e2e, reducer tests); a harness in another language from the server cannot share its protocol bugs; zero deps; already measured. The harness lives in @@ -594,7 +601,8 @@ from the prototype, what was missing, what the M3 build added, and the tools it keeps holding. - `devbox run test` = Nim tests first, then Node harnesses. `devbox run client-test` = the client's Vitest seam (pure reducer, protocol client, envelope); `devbox run e2e` = the built client through - the real server and vhost. The finish gate runs all three. + the real server and vhost; `devbox run fogbench` = the 50-token 16384 px server measurement + (`results/m4-fog-bench.log`). The finish gate (#76) runs all of them plus `mutation` and `bench`. - The nine M3 accept groups and their proving harness tests are mapped in `tools/groups.mjs`; `tools/groups.test.mjs` fails if a group file or its named evidence test disappears, so the acceptance checklist cannot silently go stale. Harnesses that are not an accept group (`smoke`, @@ -657,6 +665,17 @@ from the prototype, what was missing, what the M3 build added, and the tools it registered test ran and passed. The restart group takes its baseline from the as-built state on the first server instance, before any restart, not from a state that has already been through one (#36). +- **M4 accept result.** Measured 2026-11-21 at the finish commit (#76): `devbox run test` exit 0 + (Nim suite all pass, 419 OK checks; 159 Node harness tests with the group evidence step), + `devbox run client-test` 164, `devbox run e2e` 27/27 (join, fog pixel probes, drag + rollback, + reconnect, the independent traffic audit and the 50-token measurement), `devbox run mutation` + control + 80 mutations each failing at least its expected test, `devbox run bench` PASS and + `devbox run fogbench` PASS. Evidence: `results/nimble-test.log`, `results/mutation.log`, + `results/bench.log`, `results/m4-fog-bench.md` (+ `.log`); the e2e/client logs are regenerated + per run and not committed. The manual Note 10 + laptop 60 fps run is **#77** and is the only + open M4 accept item. Mutation housekeeping found here: `c1`/`c2` still patched the pre-#65 + tile-gate expression and had silently become `sed` no-ops; both now patch + `cy * sc.cols + cx in explored` and fail the tile gate group again. - **M4 gate harness.** (a) automated headless-Chromium test with mobile emulation (viewport, dpr, CPU and network throttle) against the real server path (nginx HTTP/2 + caching); (b) one manual run on the owner's 5-year-old Android phone. The 2026-11-08 prototype phone run is evidence, not the gate diff --git a/docs/archive/prototypes/README.md b/docs/archive/prototypes/README.md new file mode 100644 index 0000000..f364779 --- /dev/null +++ b/docs/archive/prototypes/README.md @@ -0,0 +1,13 @@ +# Archived prototypes (M4 close-out, #76) + +These three trees are the pre-M4 prototypes. They are **frozen history**: not built, not tested and +not maintained. The one maintained client is `/client`; the server is `/server`. + +| Tree | What it proved | Where its numbers now live | +|---|---|---| +| [`pixi-perf/`](pixi-perf/) | PixiJS v8 can draw a VTT-sized scene on modest hardware; 2048-16384 px maps, 50-2000 tokens, fog and labels | `docs/DESIGN.md` §7.2, `results/m4-fog-bench.md` | +| [`server-vision/`](server-vision/) | The visibility polygon, scanline cells, explored, the leak transcripts and the move rules that `server/` ports at M1-M3 | `results/bench.log`, `docs/TESTING.md` §10 | +| [`tile-leak/`](tile-leak/) | Tile size vs the fog edge leak; the 2026-11-08 phone run (evidence, not a gate) | `docs/TESTING.md` §13 M4 gate harness | + +They were moved here from the repo root in the M4 finish commit; `git log --follow ` shows +their last live revision. Do not revive them for a fix: change `/client` or `/server`. diff --git a/prototype-pixi-perf/.gitignore b/docs/archive/prototypes/pixi-perf/.gitignore similarity index 100% rename from prototype-pixi-perf/.gitignore rename to docs/archive/prototypes/pixi-perf/.gitignore diff --git a/prototype-pixi-perf/README.md b/docs/archive/prototypes/pixi-perf/README.md similarity index 100% rename from prototype-pixi-perf/README.md rename to docs/archive/prototypes/pixi-perf/README.md diff --git a/prototype-pixi-perf/bench.mjs b/docs/archive/prototypes/pixi-perf/bench.mjs similarity index 100% rename from prototype-pixi-perf/bench.mjs rename to docs/archive/prototypes/pixi-perf/bench.mjs diff --git a/prototype-pixi-perf/devbox.json b/docs/archive/prototypes/pixi-perf/devbox.json similarity index 100% rename from prototype-pixi-perf/devbox.json rename to docs/archive/prototypes/pixi-perf/devbox.json diff --git a/prototype-pixi-perf/devbox.lock b/docs/archive/prototypes/pixi-perf/devbox.lock similarity index 100% rename from prototype-pixi-perf/devbox.lock rename to docs/archive/prototypes/pixi-perf/devbox.lock diff --git a/prototype-pixi-perf/index.html b/docs/archive/prototypes/pixi-perf/index.html similarity index 100% rename from prototype-pixi-perf/index.html rename to docs/archive/prototypes/pixi-perf/index.html diff --git a/prototype-pixi-perf/package-lock.json b/docs/archive/prototypes/pixi-perf/package-lock.json similarity index 100% rename from prototype-pixi-perf/package-lock.json rename to docs/archive/prototypes/pixi-perf/package-lock.json diff --git a/prototype-pixi-perf/package.json b/docs/archive/prototypes/pixi-perf/package.json similarity index 100% rename from prototype-pixi-perf/package.json rename to docs/archive/prototypes/pixi-perf/package.json diff --git a/prototype-pixi-perf/src/main.ts b/docs/archive/prototypes/pixi-perf/src/main.ts similarity index 100% rename from prototype-pixi-perf/src/main.ts rename to docs/archive/prototypes/pixi-perf/src/main.ts diff --git a/prototype-pixi-perf/tsconfig.json b/docs/archive/prototypes/pixi-perf/tsconfig.json similarity index 100% rename from prototype-pixi-perf/tsconfig.json rename to docs/archive/prototypes/pixi-perf/tsconfig.json diff --git a/prototype-server-vision/.gitignore b/docs/archive/prototypes/server-vision/.gitignore similarity index 100% rename from prototype-server-vision/.gitignore rename to docs/archive/prototypes/server-vision/.gitignore diff --git a/prototype-server-vision/HANDOFF.md b/docs/archive/prototypes/server-vision/HANDOFF.md similarity index 100% rename from prototype-server-vision/HANDOFF.md rename to docs/archive/prototypes/server-vision/HANDOFF.md diff --git a/prototype-server-vision/NOTES.md b/docs/archive/prototypes/server-vision/NOTES.md similarity index 100% rename from prototype-server-vision/NOTES.md rename to docs/archive/prototypes/server-vision/NOTES.md diff --git a/prototype-server-vision/README.md b/docs/archive/prototypes/server-vision/README.md similarity index 100% rename from prototype-server-vision/README.md rename to docs/archive/prototypes/server-vision/README.md diff --git a/prototype-server-vision/client/.gitignore b/docs/archive/prototypes/server-vision/client/.gitignore similarity index 100% rename from prototype-server-vision/client/.gitignore rename to docs/archive/prototypes/server-vision/client/.gitignore diff --git a/prototype-server-vision/client/index.html b/docs/archive/prototypes/server-vision/client/index.html similarity index 100% rename from prototype-server-vision/client/index.html rename to docs/archive/prototypes/server-vision/client/index.html diff --git a/prototype-server-vision/client/package-lock.json b/docs/archive/prototypes/server-vision/client/package-lock.json similarity index 100% rename from prototype-server-vision/client/package-lock.json rename to docs/archive/prototypes/server-vision/client/package-lock.json diff --git a/prototype-server-vision/client/package.json b/docs/archive/prototypes/server-vision/client/package.json similarity index 100% rename from prototype-server-vision/client/package.json rename to docs/archive/prototypes/server-vision/client/package.json diff --git a/prototype-server-vision/client/src/main.ts b/docs/archive/prototypes/server-vision/client/src/main.ts similarity index 100% rename from prototype-server-vision/client/src/main.ts rename to docs/archive/prototypes/server-vision/client/src/main.ts diff --git a/prototype-server-vision/client/src/state.test.ts b/docs/archive/prototypes/server-vision/client/src/state.test.ts similarity index 100% rename from prototype-server-vision/client/src/state.test.ts rename to docs/archive/prototypes/server-vision/client/src/state.test.ts diff --git a/prototype-server-vision/client/src/state.ts b/docs/archive/prototypes/server-vision/client/src/state.ts similarity index 100% rename from prototype-server-vision/client/src/state.ts rename to docs/archive/prototypes/server-vision/client/src/state.ts diff --git a/prototype-server-vision/client/tsconfig.json b/docs/archive/prototypes/server-vision/client/tsconfig.json similarity index 100% rename from prototype-server-vision/client/tsconfig.json rename to docs/archive/prototypes/server-vision/client/tsconfig.json diff --git a/prototype-server-vision/client/vite.config.ts b/docs/archive/prototypes/server-vision/client/vite.config.ts similarity index 100% rename from prototype-server-vision/client/vite.config.ts rename to docs/archive/prototypes/server-vision/client/vite.config.ts diff --git a/prototype-server-vision/data/scene.json b/docs/archive/prototypes/server-vision/data/scene.json similarity index 100% rename from prototype-server-vision/data/scene.json rename to docs/archive/prototypes/server-vision/data/scene.json diff --git a/prototype-server-vision/devbox.json b/docs/archive/prototypes/server-vision/devbox.json similarity index 100% rename from prototype-server-vision/devbox.json rename to docs/archive/prototypes/server-vision/devbox.json diff --git a/prototype-server-vision/devbox.lock b/docs/archive/prototypes/server-vision/devbox.lock similarity index 100% rename from prototype-server-vision/devbox.lock rename to docs/archive/prototypes/server-vision/devbox.lock diff --git a/prototype-server-vision/nginx/mime.types b/docs/archive/prototypes/server-vision/nginx/mime.types similarity index 100% rename from prototype-server-vision/nginx/mime.types rename to docs/archive/prototypes/server-vision/nginx/mime.types diff --git a/prototype-server-vision/nginx/nginx.conf b/docs/archive/prototypes/server-vision/nginx/nginx.conf similarity index 100% rename from prototype-server-vision/nginx/nginx.conf rename to docs/archive/prototypes/server-vision/nginx/nginx.conf diff --git a/prototype-server-vision/nim.cfg b/docs/archive/prototypes/server-vision/nim.cfg similarity index 100% rename from prototype-server-vision/nim.cfg rename to docs/archive/prototypes/server-vision/nim.cfg diff --git a/prototype-server-vision/results/bench.log b/docs/archive/prototypes/server-vision/results/bench.log similarity index 100% rename from prototype-server-vision/results/bench.log rename to docs/archive/prototypes/server-vision/results/bench.log diff --git a/prototype-server-vision/results/client-tests.log b/docs/archive/prototypes/server-vision/results/client-tests.log similarity index 100% rename from prototype-server-vision/results/client-tests.log rename to docs/archive/prototypes/server-vision/results/client-tests.log diff --git a/prototype-server-vision/results/concurrency-final1-server.log b/docs/archive/prototypes/server-vision/results/concurrency-final1-server.log similarity index 100% rename from prototype-server-vision/results/concurrency-final1-server.log rename to docs/archive/prototypes/server-vision/results/concurrency-final1-server.log diff --git a/prototype-server-vision/results/concurrency-final1.log b/docs/archive/prototypes/server-vision/results/concurrency-final1.log similarity index 100% rename from prototype-server-vision/results/concurrency-final1.log rename to docs/archive/prototypes/server-vision/results/concurrency-final1.log diff --git a/prototype-server-vision/results/concurrency-final2-server.log b/docs/archive/prototypes/server-vision/results/concurrency-final2-server.log similarity index 100% rename from prototype-server-vision/results/concurrency-final2-server.log rename to docs/archive/prototypes/server-vision/results/concurrency-final2-server.log diff --git a/prototype-server-vision/results/concurrency-final2.log b/docs/archive/prototypes/server-vision/results/concurrency-final2.log similarity index 100% rename from prototype-server-vision/results/concurrency-final2.log rename to docs/archive/prototypes/server-vision/results/concurrency-final2.log diff --git a/prototype-server-vision/results/concurrency-final3-server.log b/docs/archive/prototypes/server-vision/results/concurrency-final3-server.log similarity index 100% rename from prototype-server-vision/results/concurrency-final3-server.log rename to docs/archive/prototypes/server-vision/results/concurrency-final3-server.log diff --git a/prototype-server-vision/results/concurrency-final3.log b/docs/archive/prototypes/server-vision/results/concurrency-final3.log similarity index 100% rename from prototype-server-vision/results/concurrency-final3.log rename to docs/archive/prototypes/server-vision/results/concurrency-final3.log diff --git a/prototype-server-vision/results/faults.log b/docs/archive/prototypes/server-vision/results/faults.log similarity index 100% rename from prototype-server-vision/results/faults.log rename to docs/archive/prototypes/server-vision/results/faults.log diff --git a/prototype-server-vision/results/final-faulttest.log b/docs/archive/prototypes/server-vision/results/final-faulttest.log similarity index 100% rename from prototype-server-vision/results/final-faulttest.log rename to docs/archive/prototypes/server-vision/results/final-faulttest.log diff --git a/prototype-server-vision/results/final-leaktest.log b/docs/archive/prototypes/server-vision/results/final-leaktest.log similarity index 100% rename from prototype-server-vision/results/final-leaktest.log rename to docs/archive/prototypes/server-vision/results/final-leaktest.log diff --git a/prototype-server-vision/results/final-rc.txt b/docs/archive/prototypes/server-vision/results/final-rc.txt similarity index 100% rename from prototype-server-vision/results/final-rc.txt rename to docs/archive/prototypes/server-vision/results/final-rc.txt diff --git a/prototype-server-vision/results/final-restart.log b/docs/archive/prototypes/server-vision/results/final-restart.log similarity index 100% rename from prototype-server-vision/results/final-restart.log rename to docs/archive/prototypes/server-vision/results/final-restart.log diff --git a/prototype-server-vision/results/leak-A.jsonl b/docs/archive/prototypes/server-vision/results/leak-A.jsonl similarity index 100% rename from prototype-server-vision/results/leak-A.jsonl rename to docs/archive/prototypes/server-vision/results/leak-A.jsonl diff --git a/prototype-server-vision/results/leak-A.log b/docs/archive/prototypes/server-vision/results/leak-A.log similarity index 100% rename from prototype-server-vision/results/leak-A.log rename to docs/archive/prototypes/server-vision/results/leak-A.log diff --git a/prototype-server-vision/results/leak-B.jsonl b/docs/archive/prototypes/server-vision/results/leak-B.jsonl similarity index 100% rename from prototype-server-vision/results/leak-B.jsonl rename to docs/archive/prototypes/server-vision/results/leak-B.jsonl diff --git a/prototype-server-vision/results/leak-B.log b/docs/archive/prototypes/server-vision/results/leak-B.log similarity index 100% rename from prototype-server-vision/results/leak-B.log rename to docs/archive/prototypes/server-vision/results/leak-B.log diff --git a/prototype-server-vision/results/mutation-a.log b/docs/archive/prototypes/server-vision/results/mutation-a.log similarity index 100% rename from prototype-server-vision/results/mutation-a.log rename to docs/archive/prototypes/server-vision/results/mutation-a.log diff --git a/prototype-server-vision/results/mutation-b.log b/docs/archive/prototypes/server-vision/results/mutation-b.log similarity index 100% rename from prototype-server-vision/results/mutation-b.log rename to docs/archive/prototypes/server-vision/results/mutation-b.log diff --git a/prototype-server-vision/results/mutation-c.log b/docs/archive/prototypes/server-vision/results/mutation-c.log similarity index 100% rename from prototype-server-vision/results/mutation-c.log rename to docs/archive/prototypes/server-vision/results/mutation-c.log diff --git a/prototype-server-vision/results/mutation-summary.log b/docs/archive/prototypes/server-vision/results/mutation-summary.log similarity index 100% rename from prototype-server-vision/results/mutation-summary.log rename to docs/archive/prototypes/server-vision/results/mutation-summary.log diff --git a/prototype-server-vision/results/nimble-test.log b/docs/archive/prototypes/server-vision/results/nimble-test.log similarity index 100% rename from prototype-server-vision/results/nimble-test.log rename to docs/archive/prototypes/server-vision/results/nimble-test.log diff --git a/prototype-server-vision/results/smoke.log b/docs/archive/prototypes/server-vision/results/smoke.log similarity index 100% rename from prototype-server-vision/results/smoke.log rename to docs/archive/prototypes/server-vision/results/smoke.log diff --git a/prototype-server-vision/results/spike/base1-server.log b/docs/archive/prototypes/server-vision/results/spike/base1-server.log similarity index 100% rename from prototype-server-vision/results/spike/base1-server.log rename to docs/archive/prototypes/server-vision/results/spike/base1-server.log diff --git a/prototype-server-vision/results/spike/base1.log b/docs/archive/prototypes/server-vision/results/spike/base1.log similarity index 100% rename from prototype-server-vision/results/spike/base1.log rename to docs/archive/prototypes/server-vision/results/spike/base1.log diff --git a/prototype-server-vision/results/spike/base2-server.log b/docs/archive/prototypes/server-vision/results/spike/base2-server.log similarity index 100% rename from prototype-server-vision/results/spike/base2-server.log rename to docs/archive/prototypes/server-vision/results/spike/base2-server.log diff --git a/prototype-server-vision/results/spike/base2.log b/docs/archive/prototypes/server-vision/results/spike/base2.log similarity index 100% rename from prototype-server-vision/results/spike/base2.log rename to docs/archive/prototypes/server-vision/results/spike/base2.log diff --git a/prototype-server-vision/results/spike/base3-server.log b/docs/archive/prototypes/server-vision/results/spike/base3-server.log similarity index 100% rename from prototype-server-vision/results/spike/base3-server.log rename to docs/archive/prototypes/server-vision/results/spike/base3-server.log diff --git a/prototype-server-vision/results/spike/base3.log b/docs/archive/prototypes/server-vision/results/spike/base3.log similarity index 100% rename from prototype-server-vision/results/spike/base3.log rename to docs/archive/prototypes/server-vision/results/spike/base3.log diff --git a/prototype-server-vision/results/spike/fixed1-server.log b/docs/archive/prototypes/server-vision/results/spike/fixed1-server.log similarity index 100% rename from prototype-server-vision/results/spike/fixed1-server.log rename to docs/archive/prototypes/server-vision/results/spike/fixed1-server.log diff --git a/prototype-server-vision/results/spike/fixed1.log b/docs/archive/prototypes/server-vision/results/spike/fixed1.log similarity index 100% rename from prototype-server-vision/results/spike/fixed1.log rename to docs/archive/prototypes/server-vision/results/spike/fixed1.log diff --git a/prototype-server-vision/results/spike/fixed2-server.log b/docs/archive/prototypes/server-vision/results/spike/fixed2-server.log similarity index 100% rename from prototype-server-vision/results/spike/fixed2-server.log rename to docs/archive/prototypes/server-vision/results/spike/fixed2-server.log diff --git a/prototype-server-vision/results/spike/fixed2.log b/docs/archive/prototypes/server-vision/results/spike/fixed2.log similarity index 100% rename from prototype-server-vision/results/spike/fixed2.log rename to docs/archive/prototypes/server-vision/results/spike/fixed2.log diff --git a/prototype-server-vision/results/spike/fixed3-server.log b/docs/archive/prototypes/server-vision/results/spike/fixed3-server.log similarity index 100% rename from prototype-server-vision/results/spike/fixed3-server.log rename to docs/archive/prototypes/server-vision/results/spike/fixed3-server.log diff --git a/prototype-server-vision/results/spike/fixed3.log b/docs/archive/prototypes/server-vision/results/spike/fixed3.log similarity index 100% rename from prototype-server-vision/results/spike/fixed3.log rename to docs/archive/prototypes/server-vision/results/spike/fixed3.log diff --git a/prototype-server-vision/results/spike/investigation.md b/docs/archive/prototypes/server-vision/results/spike/investigation.md similarity index 100% rename from prototype-server-vision/results/spike/investigation.md rename to docs/archive/prototypes/server-vision/results/spike/investigation.md diff --git a/prototype-server-vision/results/spike/original-60s-server.log b/docs/archive/prototypes/server-vision/results/spike/original-60s-server.log similarity index 100% rename from prototype-server-vision/results/spike/original-60s-server.log rename to docs/archive/prototypes/server-vision/results/spike/original-60s-server.log diff --git a/prototype-server-vision/results/spike/original-60s.log b/docs/archive/prototypes/server-vision/results/spike/original-60s.log similarity index 100% rename from prototype-server-vision/results/spike/original-60s.log rename to docs/archive/prototypes/server-vision/results/spike/original-60s.log diff --git a/prototype-server-vision/results/spike/postfix-faulttest.log b/docs/archive/prototypes/server-vision/results/spike/postfix-faulttest.log similarity index 100% rename from prototype-server-vision/results/spike/postfix-faulttest.log rename to docs/archive/prototypes/server-vision/results/spike/postfix-faulttest.log diff --git a/prototype-server-vision/results/spike/postfix-leaktest.log b/docs/archive/prototypes/server-vision/results/spike/postfix-leaktest.log similarity index 100% rename from prototype-server-vision/results/spike/postfix-leaktest.log rename to docs/archive/prototypes/server-vision/results/spike/postfix-leaktest.log diff --git a/prototype-server-vision/results/spike/postfix-restart.log b/docs/archive/prototypes/server-vision/results/spike/postfix-restart.log similarity index 100% rename from prototype-server-vision/results/spike/postfix-restart.log rename to docs/archive/prototypes/server-vision/results/spike/postfix-restart.log diff --git a/prototype-server-vision/servervision.nimble b/docs/archive/prototypes/server-vision/servervision.nimble similarity index 100% rename from prototype-server-vision/servervision.nimble rename to docs/archive/prototypes/server-vision/servervision.nimble diff --git a/prototype-server-vision/src/geometry.nim b/docs/archive/prototypes/server-vision/src/geometry.nim similarity index 100% rename from prototype-server-vision/src/geometry.nim rename to docs/archive/prototypes/server-vision/src/geometry.nim diff --git a/prototype-server-vision/src/server.nim b/docs/archive/prototypes/server-vision/src/server.nim similarity index 100% rename from prototype-server-vision/src/server.nim rename to docs/archive/prototypes/server-vision/src/server.nim diff --git a/prototype-server-vision/tests/tgeometry.nim b/docs/archive/prototypes/server-vision/tests/tgeometry.nim similarity index 100% rename from prototype-server-vision/tests/tgeometry.nim rename to docs/archive/prototypes/server-vision/tests/tgeometry.nim diff --git a/prototype-server-vision/tools/bench.nim b/docs/archive/prototypes/server-vision/tools/bench.nim similarity index 100% rename from prototype-server-vision/tools/bench.nim rename to docs/archive/prototypes/server-vision/tools/bench.nim diff --git a/prototype-server-vision/tools/concurrency.mjs b/docs/archive/prototypes/server-vision/tools/concurrency.mjs similarity index 100% rename from prototype-server-vision/tools/concurrency.mjs rename to docs/archive/prototypes/server-vision/tools/concurrency.mjs diff --git a/prototype-server-vision/tools/faulttest.sh b/docs/archive/prototypes/server-vision/tools/faulttest.sh similarity index 100% rename from prototype-server-vision/tools/faulttest.sh rename to docs/archive/prototypes/server-vision/tools/faulttest.sh diff --git a/prototype-server-vision/tools/genmap.mjs b/docs/archive/prototypes/server-vision/tools/genmap.mjs similarity index 100% rename from prototype-server-vision/tools/genmap.mjs rename to docs/archive/prototypes/server-vision/tools/genmap.mjs diff --git a/prototype-server-vision/tools/leak.mjs b/docs/archive/prototypes/server-vision/tools/leak.mjs similarity index 100% rename from prototype-server-vision/tools/leak.mjs rename to docs/archive/prototypes/server-vision/tools/leak.mjs diff --git a/prototype-server-vision/tools/leakcheck.nim b/docs/archive/prototypes/server-vision/tools/leakcheck.nim similarity index 100% rename from prototype-server-vision/tools/leakcheck.nim rename to docs/archive/prototypes/server-vision/tools/leakcheck.nim diff --git a/prototype-server-vision/tools/leaktest.sh b/docs/archive/prototypes/server-vision/tools/leaktest.sh similarity index 100% rename from prototype-server-vision/tools/leaktest.sh rename to docs/archive/prototypes/server-vision/tools/leaktest.sh diff --git a/prototype-server-vision/tools/lib.mjs b/docs/archive/prototypes/server-vision/tools/lib.mjs similarity index 100% rename from prototype-server-vision/tools/lib.mjs rename to docs/archive/prototypes/server-vision/tools/lib.mjs diff --git a/prototype-server-vision/tools/mutation.sh b/docs/archive/prototypes/server-vision/tools/mutation.sh similarity index 100% rename from prototype-server-vision/tools/mutation.sh rename to docs/archive/prototypes/server-vision/tools/mutation.sh diff --git a/prototype-server-vision/tools/restart.mjs b/docs/archive/prototypes/server-vision/tools/restart.mjs similarity index 100% rename from prototype-server-vision/tools/restart.mjs rename to docs/archive/prototypes/server-vision/tools/restart.mjs diff --git a/prototype-server-vision/tools/smoke.mjs b/docs/archive/prototypes/server-vision/tools/smoke.mjs similarity index 100% rename from prototype-server-vision/tools/smoke.mjs rename to docs/archive/prototypes/server-vision/tools/smoke.mjs diff --git a/prototype-server-vision/tools/withserver.sh b/docs/archive/prototypes/server-vision/tools/withserver.sh similarity index 100% rename from prototype-server-vision/tools/withserver.sh rename to docs/archive/prototypes/server-vision/tools/withserver.sh diff --git a/prototype-tile-leak/.gitignore b/docs/archive/prototypes/tile-leak/.gitignore similarity index 100% rename from prototype-tile-leak/.gitignore rename to docs/archive/prototypes/tile-leak/.gitignore diff --git a/prototype-tile-leak/README.md b/docs/archive/prototypes/tile-leak/README.md similarity index 100% rename from prototype-tile-leak/README.md rename to docs/archive/prototypes/tile-leak/README.md diff --git a/prototype-tile-leak/config.nims b/docs/archive/prototypes/tile-leak/config.nims similarity index 100% rename from prototype-tile-leak/config.nims rename to docs/archive/prototypes/tile-leak/config.nims diff --git a/prototype-tile-leak/devbox.json b/docs/archive/prototypes/tile-leak/devbox.json similarity index 100% rename from prototype-tile-leak/devbox.json rename to docs/archive/prototypes/tile-leak/devbox.json diff --git a/prototype-tile-leak/devbox.lock b/docs/archive/prototypes/tile-leak/devbox.lock similarity index 100% rename from prototype-tile-leak/devbox.lock rename to docs/archive/prototypes/tile-leak/devbox.lock diff --git a/prototype-tile-leak/index.html b/docs/archive/prototypes/tile-leak/index.html similarity index 100% rename from prototype-tile-leak/index.html rename to docs/archive/prototypes/tile-leak/index.html diff --git a/prototype-tile-leak/nim.cfg b/docs/archive/prototypes/tile-leak/nim.cfg similarity index 100% rename from prototype-tile-leak/nim.cfg rename to docs/archive/prototypes/tile-leak/nim.cfg diff --git a/prototype-tile-leak/package-lock.json b/docs/archive/prototypes/tile-leak/package-lock.json similarity index 100% rename from prototype-tile-leak/package-lock.json rename to docs/archive/prototypes/tile-leak/package-lock.json diff --git a/prototype-tile-leak/package.json b/docs/archive/prototypes/tile-leak/package.json similarity index 100% rename from prototype-tile-leak/package.json rename to docs/archive/prototypes/tile-leak/package.json diff --git a/prototype-tile-leak/results/disk4096.log b/docs/archive/prototypes/tile-leak/results/disk4096.log similarity index 100% rename from prototype-tile-leak/results/disk4096.log rename to docs/archive/prototypes/tile-leak/results/disk4096.log diff --git a/prototype-tile-leak/results/maskbench.log b/docs/archive/prototypes/tile-leak/results/maskbench.log similarity index 100% rename from prototype-tile-leak/results/maskbench.log rename to docs/archive/prototypes/tile-leak/results/maskbench.log diff --git a/prototype-tile-leak/results/netbench.log b/docs/archive/prototypes/tile-leak/results/netbench.log similarity index 100% rename from prototype-tile-leak/results/netbench.log rename to docs/archive/prototypes/tile-leak/results/netbench.log diff --git a/prototype-tile-leak/results/phone-20261108T113701.jsonl b/docs/archive/prototypes/tile-leak/results/phone-20261108T113701.jsonl similarity index 100% rename from prototype-tile-leak/results/phone-20261108T113701.jsonl rename to docs/archive/prototypes/tile-leak/results/phone-20261108T113701.jsonl diff --git a/prototype-tile-leak/results/steps.log b/docs/archive/prototypes/tile-leak/results/steps.log similarity index 100% rename from prototype-tile-leak/results/steps.log rename to docs/archive/prototypes/tile-leak/results/steps.log diff --git a/prototype-tile-leak/src/art.nim b/docs/archive/prototypes/tile-leak/src/art.nim similarity index 100% rename from prototype-tile-leak/src/art.nim rename to docs/archive/prototypes/tile-leak/src/art.nim diff --git a/prototype-tile-leak/src/authsrv.nim b/docs/archive/prototypes/tile-leak/src/authsrv.nim similarity index 100% rename from prototype-tile-leak/src/authsrv.nim rename to docs/archive/prototypes/tile-leak/src/authsrv.nim diff --git a/prototype-tile-leak/src/gen.nim b/docs/archive/prototypes/tile-leak/src/gen.nim similarity index 100% rename from prototype-tile-leak/src/gen.nim rename to docs/archive/prototypes/tile-leak/src/gen.nim diff --git a/prototype-tile-leak/src/maskbench.nim b/docs/archive/prototypes/tile-leak/src/maskbench.nim similarity index 100% rename from prototype-tile-leak/src/maskbench.nim rename to docs/archive/prototypes/tile-leak/src/maskbench.nim diff --git a/prototype-tile-leak/src/phonesrv.nim b/docs/archive/prototypes/tile-leak/src/phonesrv.nim similarity index 100% rename from prototype-tile-leak/src/phonesrv.nim rename to docs/archive/prototypes/tile-leak/src/phonesrv.nim diff --git a/prototype-tile-leak/tilelk.nimble b/docs/archive/prototypes/tile-leak/tilelk.nimble similarity index 100% rename from prototype-tile-leak/tilelk.nimble rename to docs/archive/prototypes/tile-leak/tilelk.nimble diff --git a/prototype-tile-leak/tools/headless.mjs b/docs/archive/prototypes/tile-leak/tools/headless.mjs similarity index 100% rename from prototype-tile-leak/tools/headless.mjs rename to docs/archive/prototypes/tile-leak/tools/headless.mjs diff --git a/prototype-tile-leak/tools/mime.types b/docs/archive/prototypes/tile-leak/tools/mime.types similarity index 100% rename from prototype-tile-leak/tools/mime.types rename to docs/archive/prototypes/tile-leak/tools/mime.types diff --git a/prototype-tile-leak/tools/netbench.sh b/docs/archive/prototypes/tile-leak/tools/netbench.sh similarity index 100% rename from prototype-tile-leak/tools/netbench.sh rename to docs/archive/prototypes/tile-leak/tools/netbench.sh diff --git a/prototype-tile-leak/tools/nginx.conf b/docs/archive/prototypes/tile-leak/tools/nginx.conf similarity index 100% rename from prototype-tile-leak/tools/nginx.conf rename to docs/archive/prototypes/tile-leak/tools/nginx.conf diff --git a/prototype-tile-leak/tools/phone.sh b/docs/archive/prototypes/tile-leak/tools/phone.sh similarity index 100% rename from prototype-tile-leak/tools/phone.sh rename to docs/archive/prototypes/tile-leak/tools/phone.sh diff --git a/prototype-tile-leak/tools/steps.py b/docs/archive/prototypes/tile-leak/tools/steps.py similarity index 100% rename from prototype-tile-leak/tools/steps.py rename to docs/archive/prototypes/tile-leak/tools/steps.py diff --git a/prototype-tile-leak/tsconfig.json b/docs/archive/prototypes/tile-leak/tsconfig.json similarity index 100% rename from prototype-tile-leak/tsconfig.json rename to docs/archive/prototypes/tile-leak/tsconfig.json diff --git a/prototype-tile-leak/web/main.ts b/docs/archive/prototypes/tile-leak/web/main.ts similarity index 100% rename from prototype-tile-leak/web/main.ts rename to docs/archive/prototypes/tile-leak/web/main.ts diff --git a/docs/research/design-split-check.md b/docs/research/design-split-check.md index 18f20c0..d02aac5 100644 --- a/docs/research/design-split-check.md +++ b/docs/research/design-split-check.md @@ -148,7 +148,7 @@ DESIGN is 23 134 B (10.4 %) smaller. TESTING is larger than the moved bytes beca | old DESIGN | new TESTING | what moved | |---|---|---| | §3.1 notes | §3.1 | `GMONLY_TOKEN` fault-class pointer | -| §3.3 | §3.3 | `/_tiles/` 404 evidence, tile-allowed `[MEASURED]` leak (d) counts, `prototype-tile-leak` evidence, test-vhost note, slice-9 status-split pin (was in §6.6) | +| §3.3 | §3.3 | `/_tiles/` 404 evidence, tile-allowed `[MEASURED]` leak (d) counts, `docs/archive/prototypes/tile-leak` evidence, test-vhost note, slice-9 status-split pin (was in §6.6) | | §3.4 | §3.4 | the `Test` column of T1-T17, as a proving-test table | | §4.1 | §4.1 | `vision_ms move-monster` `[MEASURED]` | | §4.2 | §4.2 | "order proven correct by 3 x 60 s runs" | diff --git a/docs/research/m3-mummy-db-connector.md b/docs/research/m3-mummy-db-connector.md index 5ed084f..8b1c95c 100644 --- a/docs/research/m3-mummy-db-connector.md +++ b/docs/research/m3-mummy-db-connector.md @@ -7,9 +7,9 @@ Date: 2026-11-10. Parent: map #2. Scope: facts + source refs only. No decisions. - **mummy tag 0.4.8** = commit `77a7563e87a1045e4e407a3a68731e299fa3507e` (GitHub API `refs/tags/0.4.8`). Repo is **`guzba/mummy`**, not `treeform/mummy` as the ticket says (nimble `url` = github.com/guzba/mummy). Files fetched raw from that commit: `src/mummy.nim` (1561 L), `src/mummy/{common,internal,routers,multipart}.nim`. Link base: `https://github.com/guzba/mummy/blob/77a7563e87a1045e4e407a3a68731e299fa3507e/`. Refs below are `src/mummy.nim:N` unless noted. - **mummy at main `01deb1ff`** (devbox cache): `mummy.nim` is 54023 B, same size as the tag copy. q20 doc says only `.github/workflows` differ. Not re-diffed here. - **webby 0.2.1** (`treeformwebby`), local pkgcache `/home/davide/.nimble/pkgcache/githubcom_treeformwebby_021/src/webby/`: `httpheaders.nim`, `queryparams.nim`. Upstream tag not fetched. -- **db_connector** commit `29450a2063970712422e1ab857695c12d80112a6` (nimble `specialVersions` 0.1.0; `srcDir = "src"`). Read from local cache `prototype-server-vision/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/` (`db_sqlite.nim`, `db_common.nim`, `sqlite3.nim`). Upstream file path inferred as `src/db_connector/db_sqlite.nim`. Not fetched from GitHub. +- **db_connector** commit `29450a2063970712422e1ab857695c12d80112a6` (nimble `specialVersions` 0.1.0; `srcDir = "src"`). Read from local cache `docs/archive/prototypes/server-vision/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/` (`db_sqlite.nim`, `db_common.nim`, `sqlite3.nim`). Upstream file path inferred as `src/db_connector/db_sqlite.nim`. Not fetched from GitHub. - **Nim stdlib** `hashes.nim` (devbox Nim 2.2.12): `/nix/store/274jzpwhdklcga24bd9cxywba9apvpic-nim-unwrapped-2.2.12/nim/lib/pure/hashes.nim`. -- Repo: `prototype-server-vision/src/server.nim`, `docs/DESIGN.md` §3.2, §4.2–4.4, §6.2, `docs/research/q20-nix-packaging.md`. +- Repo: `docs/archive/prototypes/server-vision/src/server.nim`, `docs/DESIGN.md` §3.2, §4.2–4.4, §6.2, `docs/research/q20-nix-packaging.md`. ## mummy 0.4.8: facts diff --git a/docs/research/m3-test-tools.md b/docs/research/m3-test-tools.md index 93bb2d1..e43a3ec 100644 --- a/docs/research/m3-test-tools.md +++ b/docs/research/m3-test-tools.md @@ -34,13 +34,13 @@ Pins used below: treeform/ws `c9c0c7b` (v0.6.0), guzba/whisky `494fb10`, status- - Only `package.json` in prototype is `client/package.json` (pixi.js, vite, typescript, @types/node). Tools do not import it. - `ws` npm package: not used and not evaluated. -Sources: [P1] `/home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/tools/lib.mjs`; [P2] `.../tools/smoke.mjs` L9; [P3] `.../tools/leak.mjs`, `.../tools/leakcheck.nim` (under `prototype-server-vision/tools/`); [P4] `prototype-server-vision/devbox.json`; [P5] `prototype-server-vision/client/package.json`. +Sources: [P1] `/home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/tools/lib.mjs`; [P2] `.../tools/smoke.mjs` L9; [P3] `.../tools/leak.mjs`, `.../tools/leakcheck.nim` (under `docs/archive/prototypes/server-vision/tools/`); [P4] `docs/archive/prototypes/server-vision/devbox.json`; [P5] `docs/archive/prototypes/server-vision/client/package.json`. ## 3. Node availability and deps (b) - Main `devbox.json` packages: nim 2, nimble, coreutils, gnused, diffutils, gnugrep. No node, no nginx. [M1] `/home/davide/Projects/GDR/FFF_vtt/devbox.json` - Prototype `devbox.json`: `nodejs: "latest"`, `nginx`, `sqlite`. [P4] -- Prototype `devbox.lock` L300-303: `nodejs@latest` resolved to `nixpkgs 8edc0c7#nodejs_26`, version 26.11.1. [P6] `prototype-server-vision/devbox.lock` +- Prototype `devbox.lock` L300-303: `nodejs@latest` resolved to `nixpkgs 8edc0c7#nodejs_26`, version 26.11.1. [P6] `docs/archive/prototypes/server-vision/devbox.lock` - System node (outside devbox): v24.22.1, `/run/current-system/sw/bin/node`. Not the devbox version. - Node `WebSocket` header option: tested by capturing raw upgrade on a local `net` server. Wire request contained `Cookie: sid=abc` and `Origin: https://evil.example`. Test script: `/nodetest/hdr.mjs`. Node docs for the `headers` option were not checked; behavior is observed, not documented. - Browser-standard WebSocket has no headers arg; this path depends on Node/undici. @@ -105,10 +105,10 @@ Pinned upstream (commit links): - [WH-src] https://github.com/guzba/whisky/blob/494fb1046f5a563defc87ac36b8c62846ee7ea2c/src/whisky.nim (newWebSocket L156, receiveFrame L28) - [WH-readme] https://github.com/guzba/whisky/blob/494fb1046f5a563defc87ac36b8c62846ee7ea2c/README.md - [MUM-default] https://github.com/guzba/mummy/blob/01deb1ff694988635c7bf0f24f6088a0bdf6db5d/mummy.nim (newServer defaults L1476-1481: maxMessageLen = 64 KB; enforced L658) -- [SRV-newserver] local `/home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/src/server.nim` L363 (`newServer(handler, wsHandler, workerThreads = 8)`, no maxMessageLen) +- [SRV-newserver] local `/home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/src/server.nim` L363 (`newServer(handler, wsHandler, workerThreads = 8)`, no maxMessageLen) - [S-httpclient] local `/nix/store/3y9syv0p41rdaqzddashmdl475l0rbv0-nim-unwrapped-2.2.4/nim/lib/pure/httpclient.nim` L711-724 (getSocket) - [P1..P6] local files cited in sections 2-3. - [M1] `/home/davide/Projects/GDR/FFF_vtt/devbox.json` - Node header test: `/nodetest/hdr.mjs` (scratch, not committed). -- nimble index (names/URLs only): `/home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/.devbox/nimble/packages_official.json` +- nimble index (names/URLs only): `/home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/.devbox/nimble/packages_official.json` - GitHub API metadata: `gh api repos/treeform/ws`, `repos/guzba/whisky`, `repos/status-im/nim-websock`, `repos/niv/websocket.nim` (pushed dates, archived flag). diff --git a/docs/research/q13-mummy-slow-clients.md b/docs/research/q13-mummy-slow-clients.md index b75c2e8..4535e98 100644 --- a/docs/research/q13-mummy-slow-clients.md +++ b/docs/research/q13-mummy-slow-clients.md @@ -85,7 +85,7 @@ Consequence: browsers answer server Pings with Pongs in the network stack, witho ## Corrections to repo docs -- `prototype-server-vision/HANDOFF.md` L29 and `prototype-server-vision/README.md` L110-114: "one unbounded server-wide deque" is the entry point only. The backlog is per socket (`outgoingBuffers`, pin L133, L1248). The "no ==/hash, keyed by raw bytes" caveat is stale at this pin (generic field-wise `hash`/`==` apply). +- `docs/archive/prototypes/server-vision/HANDOFF.md` L29 and `docs/archive/prototypes/server-vision/README.md` L110-114: "one unbounded server-wide deque" is the entry point only. The backlog is per socket (`outgoingBuffers`, pin L133, L1248). The "no ==/hash, keyed by raw bytes" caveat is stale at this pin (generic field-wise `hash`/`==` apply). - `docs/DESIGN.md` L48: "no upstream tags" is wrong. Tags `0.4.6`-`0.4.8` exist, and the pin's `src/` equals `0.4.8`. - `docs/DESIGN.md` L192 and H18 (L500): the mitigation "close when sent - acked-by-pong exceeds a bound" cannot be executed as an immediate close at this pin. `close(ws)` queues behind the backlog. The workable action is to stop feeding the client and close once the peer responds or sends data. - `docs/DESIGN.md` L192: "per-connection byte counter we maintain ourselves" is fine, but acks must come from server-solicited Pings. WHATWG says user agents must not use pings or unsolicited pongs to aid the server, so the server must solicit every Pong it relies on. JS cannot send or observe Pongs. @@ -122,7 +122,7 @@ Upstream's position (issue #141) assumes a reverse proxy handles timeouts. A pro Not evaluated. Would need a separate research pass against each candidate's pinned source. Not recommended before A is tried, because A removes the risk that motivates the switch. ### Option E: caps only (DESIGN v1 mitigations, no slow-client logic) -Connection cap, size limits, pong timeout detection without enforcement. Memory per stuck client grows until the process restarts or the kernel errors the socket. Illustrative arithmetic only: the prototype's ~3.4-3.7 KB per vision delivery (`prototype-server-vision/HANDOFF.md`, README) at an assumed 10 deliveries/s is ~2 MB per minute per stuck client. The 10/s is an assumption, not measured. +Connection cap, size limits, pong timeout detection without enforcement. Memory per stuck client grows until the process restarts or the kernel errors the socket. Illustrative arithmetic only: the prototype's ~3.4-3.7 KB per vision delivery (`docs/archive/prototypes/server-vision/HANDOFF.md`, README) at an assumed 10 deliveries/s is ~2 MB per minute per stuck client. The 10/s is an assumption, not measured. ## Recommendation diff --git a/docs/research/q20-nix-packaging.md b/docs/research/q20-nix-packaging.md index 398c3a0..9f5eb44 100644 --- a/docs/research/q20-nix-packaging.md +++ b/docs/research/q20-nix-packaging.md @@ -43,7 +43,7 @@ Source pins: - nim_lk README: sourcehut is bot-walled from my environment. I could NOT read the README. Whether `nim_lk` accepts `requires "pkg#"` and whether it reads `nimble.lock` is UNVERIFIED. Test it. ### 2.4 Dependency graph and revisions -Pinned in the owner's devbox nimble cache (`prototype-server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json`, `vcsRevision`). Use as the first lock target, then compare with nim_lk output. +Pinned in the owner's devbox nimble cache (`docs/archive/prototypes/server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json`, `vcsRevision`). Use as the first lock target, then compare with nim_lk output. | dep | constraint in mummy/registry | devbox-resolved vcsRevision | upstream tag check | |---|---|---|---| @@ -137,7 +137,7 @@ Upstream: Local (read-only): - devbox.json / devbox.lock: /home/davide/Projects/GDR/FFF_vtt/devbox.json, /home/davide/Projects/GDR/FFF_vtt/devbox.lock -- devbox nimble cache (vcsRevision): /home/davide/Projects/GDR/FFF_vtt/prototype-server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json +- devbox nimble cache (vcsRevision): /home/davide/Projects/GDR/FFF_vtt/docs/archive/prototypes/server-vision/.devbox/nimble/pkgs2/*/nimblemeta.json - nim 2.2.4 stdlib (threads default, no db_* modules): /nix/store/aa4fgarndnvq417l50imvqx5fdrrx9sn-nim-unwrapped-2.2.4/nim/config/nim.cfg, /nix/store/aa4fgarndnvq417l50imvqx5fdrrx9sn-nim-unwrapped-2.2.4/nim/lib - owner config: /home/davide/Projects/server_nixos_configuration/configuration.nix, foundryvtt.nix - repo .gitignore: /home/davide/Projects/GDR/FFF_vtt/.gitignore diff --git a/results/bench.log b/results/bench.log index b7f6767..6b51f08 100644 --- a/results/bench.log +++ b/results/bench.log @@ -1,22 +1,25 @@ -/home/davide/Projects/GDR/FFF_vtt-m64/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] -/home/davide/Projects/GDR/FFF_vtt-m64/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] == prototype scene (60 walls, 8 tokens, radius 400, cell 32) == -1 poly (jittered start positions): n=2000 avg=0.009ms worst=0.054ms -6 polys (one 6-token party): n=500 avg=0.053ms worst=0.100ms -1 poly + cellsTouched (scanline): n=2000 avg=0.016ms worst=0.043ms -6 polys + cellsTouched (scanline): n=300 avg=0.094ms worst=0.225ms -1 poly + cellsTouchedOld (prototype reference): n=500 avg=0.534ms worst=1.975ms -TARGET polygon+cells, prototype scene (prototype baseline 0.451): 0.016 ms vs <= 0.451 ms: PASS +1 poly (jittered start positions): n=2000 avg=0.013ms worst=0.075ms +6 polys (one 6-token party): n=500 avg=0.074ms worst=0.123ms +1 poly + cellsTouched (scanline): n=2000 avg=0.019ms worst=0.072ms +6 polys + cellsTouched (scanline): n=300 avg=0.172ms worst=0.252ms +1 poly + cellsTouchedOld (prototype reference): n=500 avg=0.685ms worst=2.616ms +TARGET polygon+cells, prototype scene (prototype baseline 0.451): 0.019 ms vs <= 0.451 ms: PASS == 5k sparse: genScene(world=16384., n=5000, seed=1), avg walls in vision bbox 15.6 == -1 poly, 5k sparse: n=2000 avg=0.035ms worst=0.094ms -1 poly + cellsTouched, 5k sparse: n=2000 avg=0.046ms worst=0.102ms -1 move check (pathClear, cap-length step), 5k sparse: n=20000 avg=0.008ms worst=0.044ms +1 poly, 5k sparse: n=2000 avg=0.035ms worst=0.433ms +1 poly + cellsTouched, 5k sparse: n=2000 avg=0.047ms worst=0.451ms +1 move check (pathClear, cap-length step), 5k sparse: n=20000 avg=0.007ms worst=0.466ms TARGET polygon, 5k-wall scene: 0.035 ms vs <= 1.0 ms: PASS == 5k dense: genScene(world=4096., n=5000, seed=1), avg walls in vision bbox 206.9 == -1 poly, 5k dense: n=2000 avg=0.737ms worst=2.470ms -1 poly + cellsTouched, 5k dense: n=2000 avg=0.768ms worst=2.299ms -1 move check (pathClear, cap-length step), 5k dense: n=20000 avg=0.007ms worst=0.043ms +1 poly, 5k dense: n=2000 avg=0.747ms worst=1.900ms +1 poly + cellsTouched, 5k dense: n=2000 avg=0.811ms worst=1.614ms +1 move check (pathClear, cap-length step), 5k dense: n=20000 avg=0.008ms worst=0.042ms == egress (#28: 6 players x 40 encountered entries, 262144 explored cells) == -GM egress pass (fresh diff base): n=200 avg=0.230ms worst=0.393ms -player egress pass (fresh diff base): n=200 avg=0.077ms worst=0.132ms -(sink 6038922) +GM egress pass (fresh diff base): n=200 avg=0.423ms worst=1.106ms +player egress pass (fresh diff base): n=200 avg=0.109ms worst=0.214ms +== tile gate (#65): old SQL-under-lock path vs published snapshot == +tile gate old: parse + SHA-256 + session JOIN + HashSet: n=2000 avg=0.012ms worst=0.023ms +tile gate new: parse + SHA-256 + cache lookup + bitmap: n=2000 avg=0.002ms worst=0.024ms +explored snapshot build (262144 cells): n=20 avg=3.472ms worst=3.852ms +explored incremental mark (16 fresh cells): n=5000 avg=0.001ms worst=0.011ms +(sink 24393102) diff --git a/results/m4-fog-bench.log b/results/m4-fog-bench.log new file mode 100644 index 0000000..a6e7dbf --- /dev/null +++ b/results/m4-fog-bench.log @@ -0,0 +1,10 @@ +/home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] +/home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] +== M4 fog bench: 16384 px map, cell 32 (512x512 cells), 50 tokens, 4979 walls == +server vision refresh, one player (1 polygon, radius 300, ~5k walls): n=500 avg=0.054ms worst=0.132ms +player egress frames with 50 visible tokens: 52 frames, "vision","explored","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token" +player egress pass, 50 visible tokens (fresh Known): n=300 avg=0.089ms worst=0.167ms +player egress pass, warm Known (no changes): n=2000 avg=0.094ms worst=0.261ms +explored snapshot size: 316 cells on the 16384 px map +TARGET move path: refresh + 50-token egress 0.143 ms vs <= 16.7 ms (one 60 fps frame): PASS +(sink 20800) diff --git a/results/m4-fog-bench.md b/results/m4-fog-bench.md new file mode 100644 index 0000000..a0642e1 --- /dev/null +++ b/results/m4-fog-bench.md @@ -0,0 +1,55 @@ +# M4 fog measurement: 50 tokens on a 16384 px map (#76) + +Recorded 2026-11-21 on the M4 finish tree. Command: `devbox run fogbench` (server half, +`tools/fogbench.nim`, raw log `results/m4-fog-bench.log`) and +`client/e2e/fogbench.test.mjs` (headless client half, `devbox run e2e`). + +The question this answers (spec #63, Testing notes): **does M4 need the per-token polygon cache +(build item 3) or incremental wall-edit refresh (build item 4) before the phone run?** The answer is +no: the measured move path is two orders of magnitude inside one 60 fps frame. + +## Server recompute (real modules, release build) + +Scene: 16384 x 16384 px, cell 32 (512 x 512 cells = 262 144), 4 979 sparse walls +(`genScene(16384, 5000, 1)` with the 50-token cluster box cleared), 50 tokens, one controlled token +with `vision` and radius 300. This is what `main.refreshPlayer` runs for one `token.move`, plus the +egress that follows it for that player. + +| Measurement | n | avg | worst | +|---|---:|---:|---:| +| vision refresh: polygon + `cellsTouched` + explored fold (1 token, 5k walls) | 500 | **0.044-0.054 ms** | 0.132 ms | +| player egress, 50 visible tokens (`token` frames, fresh `Known` = reconnect) | 300 | **0.075-0.089 ms** | 0.167 ms | +| player egress, warm `Known` (no changes) | 2000 | 0.084-0.094 ms | 0.261 ms | +| move path total (refresh + 50-token egress) | | **0.119-0.143 ms** | | + +(Brackets are run-to-run spread across the finish runs; the raw last run is in +`results/m4-fog-bench.log`.) + +Budget: one 60 fps frame is 16.7 ms. The move path uses ~1 % of it. Cached per-token polygons +would save ~0.05 ms while adding an invalidation surface; **not built** (ticket AC: no +polygon-cache work unless the measurement says so). `results/bench.log` holds the M1-M3 baselines +(polygon 0.041 ms sparse, 0.73 ms dense 5k) and the explored/tile-gate numbers. + +## Headless client frame cadence (correctness floor only) + +Scene: the real server on the prepared 16384 px scene (scene row patched before boot; only the M6 +importer owns `w`/`h`), 50 tokens inside the sight, fog active, first viewport filled. Emulation: +412 x 869 CSS px, DPR 2.625, touch, mobile, then CDP 4x CPU throttle for the second sample. + +| Measurement | value | +|---|---:| +| fog explored snapshot at connect (512 x 512 cells) | **2.0-2.2 ms** | +| explored cells in the sight | 540 | +| rAF cadence, real CPU (120 frames) | median **70-78 ms**, p95 81-166 ms | +| rAF cadence, 4x CPU (90 frames) | median **77-83 ms**, p95 83-167 ms | + +**These are SwiftShader numbers, not phone numbers.** Headless Chromium in this repo renders with +the software rasteriser (no GPU), so its cadence is a floor for correctness and regression work. It +is deliberately **not a gate** (spec #63: no timing gate in the client suite). The 4096 px/50-token +run in `client/e2e/fog.test.mjs` records the same order (median 72-98 ms) and is also recorded only. +The real 60 fps pass on the Note 10 and the laptop is **#77** and is the authority for the M4 accept. + +## What was not measured here + +- The actual phone GPU, thermal throttling, LAN latency and real map art: #77. +- 2000-token or 500-wall-dense scenes: outside the M4 accept target (DESIGN §13, Q2). diff --git a/results/mutation.log b/results/mutation.log index 480ea0d..ecb304f 100644 --- a/results/mutation.log +++ b/results/mutation.log @@ -292,6 +292,14 @@ [OK] exactly n walls, deterministic per seed, seeds differ [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) [OK] walls are non-degenerate and axis-ish segments of room-edge length + [OK] a revocation drops every cached session of that player and no other + [OK] player removal drops the sessions and the explored bitmap + [OK] sessions survive a restart through the database, replaced ones do not + [OK] the bitmap holds the same cells as the set, with the cell-index layout + [OK] a refresh marks only its fresh cells, and the snapshot only grows + [OK] the GM is always allowed; a player only through an explored bit + [OK] the URL is decided before any session is looked at + [OK] a scene republish changes the parse result, never a mixture [OK] canonical numbers: digits only, bounded, no leading zero [OK] a canonical URL parses to its three integers [OK] leading zero tile coordinates are malformed @@ -331,6 +339,7 @@ [OK] status helpers keep the entry set unique and ordered [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [OK] the set of tokens follows the visibility rule [OK] a player frame carries no GM-only field and no wall-like key @@ -462,7 +471,7 @@ control: exit=0 expected_failed=0 ok [FAILED] prototype scene, all tokens, doors closed and opened [FAILED] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/a/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/a/w/tests/tgeometry' # test exit=1; expected tests failed: 1 [FAILED] rays nudged past a corner: area just beyond a wall end is visible @@ -518,7 +527,7 @@ a: exit=1 expected_failed=1 ok [FAILED] prototype scene, all tokens, doors closed and opened [FAILED] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/a2/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/a2/w/tests/tgeometry' # test exit=1; expected tests failed: 5 [FAILED] corpus polygons are bit-identical to the all-segments fan [FAILED] seed scene tokens, doors and every switch shape: bit-identical @@ -578,7 +587,7 @@ a2: exit=1 expected_failed=5 ok [OK] prototype scene, all tokens, doors closed and opened [OK] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/b/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/b/w/tests/tgeometry' # test exit=1; expected tests failed: 2 [FAILED] '<' apex: ray through the shared tip must not leak [FAILED] every segment endpoint is a polygon vertex (lower and upper end inclusive) @@ -635,7 +644,7 @@ b: exit=1 expected_failed=2 ok [FAILED] prototype scene, all tokens, doors closed and opened [OK] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/c/w/tests/tgeometry' # test exit=1; expected tests failed: 2 [FAILED] '<' apex: ray through the shared tip must not leak [FAILED] every segment endpoint is a polygon vertex (lower and upper end inclusive) @@ -692,7 +701,7 @@ c: exit=1 expected_failed=2 ok [OK] prototype scene, all tokens, doors closed and opened [OK] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/d1/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/d1/w/tests/tgeometry' # test exit=1; expected tests failed: 1 [FAILED] shared vertex: both arms required (mutation d1/d2) @@ -748,7 +757,7 @@ d1: exit=1 expected_failed=1 ok [OK] prototype scene, all tokens, doors closed and opened [OK] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/d2/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/d2/w/tests/tgeometry' # test exit=1; expected tests failed: 1 [FAILED] shared vertex: both arms required (mutation d1/d2) @@ -789,7 +798,7 @@ d2: exit=1 expected_failed=1 ok [FAILED] one field is enough; a patch with none is invalid [FAILED] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/d3/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/d3/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] one field is enough; a patch with none is invalid @@ -843,7 +852,7 @@ d3: exit=1 expected_failed=1 ok [FAILED] prototype scene, all tokens, doors closed and opened [FAILED] random wall fields, cell 32 and 25 [FAILED] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/e/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/e/w/tests/tgeometry' # test exit=1; expected tests failed: 4 [FAILED] random visibility polygons: identical cell lists [FAILED] random simple polygons (star-shaped, concave): identical cell lists @@ -884,7 +893,7 @@ e: exit=1 expected_failed=4 ok [FAILED] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/e1/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/e1/w/tests/tcharacters' # test exit=1; expected tests failed: 1 [FAILED] a link change moves the snapshot to the character's names, link and knowledge (#29) @@ -922,7 +931,7 @@ e1: exit=1 expected_failed=1 ok [FAILED] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/e2/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/e2/w/tests/tcharacters' # test exit=1; expected tests failed: 1 [FAILED] a character rename rewrites the live snapshots and the rows alike (#30, #27) @@ -960,7 +969,7 @@ e2: exit=1 expected_failed=1 ok [OK] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/e3/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/e3/w/tests/tcharacters' # test exit=1; expected tests failed: 1 [FAILED] linking through a patch hands the names over (#29) @@ -982,11 +991,11 @@ e3: exit=1 expected_failed=1 ok [OK] every impossible wall row is rejected by the database [OK] a failing step 8 rolls back the rebuild, the history row and the version [OK] a malformed props_gm refuses step 8 and leaves the schema-7 DB untouched -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: cannot start a transaction within a transaction [DbError] [FAILED] withTransaction rolls back a Defect and leaves the connection usable [OK] authoringTransaction rolls back a Defect and restores NORMAL -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/e4/w/tests/tdb' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/e4/w/tests/tdb' # test exit=1; expected tests failed: 1 [FAILED] withTransaction rolls back a Defect and leaves the connection usable @@ -1009,10 +1018,10 @@ e4: exit=1 expected_failed=1 ok [OK] a failing step 8 rolls back the rebuild, the history row and the version [OK] a malformed props_gm refuses step 8 and leaves the schema-7 DB untouched [OK] withTransaction rolls back a Defect and leaves the connection usable -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: Safety level may not be changed inside a transaction [DbError] [FAILED] authoringTransaction rolls back a Defect and restores NORMAL -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/e5/w/tests/tdb' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/e5/w/tests/tdb' # test exit=1; expected tests failed: 1 [FAILED] authoringTransaction rolls back a Defect and restores NORMAL @@ -1041,7 +1050,7 @@ e5: exit=1 expected_failed=1 ok [OK] propsJson carries all three buckets, always as objects [OK] clone gives fresh buckets: editing the copy cannot reach the original [OK] normalize repairs nil buckets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/f1/w/tests/tprops' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/f1/w/tests/tprops' # test exit=1; expected tests failed: 1 [FAILED] size: exactly 8 KB is accepted, one byte over is refused @@ -1070,7 +1079,7 @@ f1: exit=1 expected_failed=1 ok [OK] propsJson carries all three buckets, always as objects [OK] clone gives fresh buckets: editing the copy cannot reach the original [OK] normalize repairs nil buckets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/f2/w/tests/tprops' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/f2/w/tests/tprops' # test exit=1; expected tests failed: 1 [FAILED] keys: 64 per object is accepted, 65 is refused, and it is per object @@ -1103,7 +1112,7 @@ f2: exit=1 expected_failed=1 ok [OK] propsJson carries all three buckets, always as objects [OK] clone gives fresh buckets: editing the copy cannot reach the original [OK] normalize repairs nil buckets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/f3/w/tests/tprops' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/f3/w/tests/tprops' # test exit=1; expected tests failed: 1 [FAILED] depth: 8 containers is accepted, 9 is refused @@ -1180,7 +1189,7 @@ f3: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/f/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/f/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped @@ -1257,7 +1266,7 @@ f: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/g/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/g/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] GM: ignores walls, step cap and the lock; bounds still apply @@ -1334,7 +1343,7 @@ g: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/h/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/h/w/tests/tmoverules' # test exit=1; expected tests failed: 2 [FAILED] corner clipping: path passes the wall end closer than r though both ends are clear [FAILED] leg of the path inside r of a non-start wall blocks even if start and end are clear @@ -1410,13 +1419,13 @@ h: exit=1 expected_failed=2 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/i/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/i/w/tests/tmoverules' [FAILED] P1: probes longer than the cap get one fixed nack regardless of the scene [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail) [OK] P4: probing cannot unlock or move a locked token [OK] doors beyond the bound: opening or closing them changes no reply -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/i/w/tests/tprobing' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/i/w/tests/tprobing' # test exit=1; expected tests failed: 2 [FAILED] step cap = scene default without vision, token vision radius with it [FAILED] P1: probes longer than the cap get one fixed nack regardless of the scene @@ -1494,7 +1503,7 @@ i: exit=1 expected_failed=2 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [FAILED] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/j/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/j/w/tests/tmoverules' # test exit=1; expected tests failed: 2 [FAILED] wall added within r of the circle (centre not on it) sets stuck; exactly r does not [FAILED] Q14: a door closed 10 px from a token: pushed to its side, clear by r, not blocked; GM-owned too @@ -1572,7 +1581,7 @@ j: exit=1 expected_failed=2 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/k/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/k/w/tests/tmoverules' # test exit=1; expected tests failed: 2 [FAILED] KEEP: opening one door / removing one wall while another overlaps -> still blocked; last one frees [FAILED] KEEP: wall update away from one of two overlapping walls keeps blocked @@ -1648,7 +1657,7 @@ k: exit=1 expected_failed=2 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/l/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/l/w/tests/tmoverules' # test exit=1; expected tests failed: 3 [FAILED] GM moves a stuck token clear -> free; to another wall-overlapping spot -> still blocked [FAILED] GM drops a token inside a wall -> blocked; a door counts only while closed @@ -1727,7 +1736,7 @@ l: exit=1 expected_failed=3 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/m/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/m/w/tests/tmoverules' # test exit=1; expected tests failed: 3 [FAILED] Q14: a door closed 10 px from a token: pushed to its side, clear by r, not blocked; GM-owned too [FAILED] push: centre on the door line -> side of the previous position; no history -> left of a->b @@ -1806,7 +1815,7 @@ m: exit=1 expected_failed=3 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/n/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/n/w/tests/tmoverules' # test exit=1; expected tests failed: 2 [FAILED] push: one side blocked by another wall -> the other side; out of bounds -> the other side [FAILED] push: both sides invalid -> squeezed in place; door open -> still squeezed (KEEP); GM can move it @@ -1888,7 +1897,7 @@ n: exit=1 expected_failed=2 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/o/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/o/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] push: centre on the door line -> side of the previous position; no history -> left of a->b @@ -1922,7 +1931,7 @@ o: exit=1 expected_failed=1 ok [OK] one wall carries the typed record plus the derived kind in the proto-2 shape [OK] `walls` is the full list plus the scene, `wall` is one upsert, `wall_gone` an id [OK] the fan-out frames carry no n: the sender stamps it per recipient -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/p/w/tests/tprotocol' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/p/w/tests/tprotocol' # test exit=1; expected tests failed: 1 [FAILED] refill is continuous at 30/s, capped at the burst @@ -1958,7 +1967,7 @@ p: exit=1 expected_failed=1 ok [OK] one wall carries the typed record plus the derived kind in the proto-2 shape [OK] `walls` is the full list plus the scene, `wall` is one upsert, `wall_gone` an id [OK] the fan-out frames carry no n: the sender stamps it per recipient -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/q/w/tests/tprotocol' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/q/w/tests/tprotocol' # test exit=1; expected tests failed: 1 [FAILED] reqId boundaries: 0 and 2^31-1 pass, 2^31 and -1 are malformed @@ -1994,7 +2003,7 @@ q: exit=1 expected_failed=1 ok [OK] one wall carries the typed record plus the derived kind in the proto-2 shape [OK] `walls` is the full list plus the scene, `wall` is one upsert, `wall_gone` an id [OK] the fan-out frames carry no n: the sender stamps it per recipient -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/r/w/tests/tprotocol' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/r/w/tests/tprotocol' # test exit=1; expected tests failed: 1 [FAILED] nine malformed frames are tolerated, the tenth closes @@ -2020,7 +2029,7 @@ r: exit=1 expected_failed=1 ok [OK] the malformed window is per connection and fires on the tenth frame [OK] a Pong is recorded on the right connection [OK] a snapshot hands out every live connection without holding the lock afterwards -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s/w/tests/tconns' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s/w/tests/tconns' # test exit=1; expected tests failed: 1 [FAILED] the frame counter starts at 1 on each connection and is never global @@ -2038,7 +2047,7 @@ s: exit=1 expected_failed=1 ok [OK] kind is derived from the switches, never stored (5.8) [OK] undefined and null are the same as an absent field [OK] adds count from 1 and the counter advances -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: UNIQUE constraint failed: wall.scene_id, wall.id [DbError] [FAILED] a removal never renumbers and the next add never reuses the id [OK] the id counter survives a reload, even when the newest wall was removed @@ -2047,7 +2056,7 @@ s: exit=1 expected_failed=1 ok [OK] nullable height and label use SQL literals and round-trip as none, not 0 or '' [OK] authoring runs with synchronous=FULL and leaves NORMAL behind (Q12) [OK] a failing write leaves memory and the pragma alone -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: UNIQUE constraint failed: wall.scene_id, wall.id [DbError] [FAILED] walls load in id order whatever the insertion order was [OK] a zero-length wall is invalid and writes nothing @@ -2065,7 +2074,7 @@ s: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/t/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/t/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] a removal never renumbers and the next add never reuses the id @@ -2084,7 +2093,7 @@ t: exit=1 expected_failed=1 ok [OK] undefined and null are the same as an absent field [OK] adds count from 1 and the counter advances [OK] a removal never renumbers and the next add never reuses the id -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: UNIQUE constraint failed: wall.scene_id, wall.id [DbError] [FAILED] the id counter survives a reload, even when the newest wall was removed [FAILED] add, update, door set and remove round-trip through a reload @@ -2108,7 +2117,7 @@ t: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/u/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/u/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] the id counter survives a reload, even when the newest wall was removed @@ -2125,7 +2134,7 @@ u: exit=1 expected_failed=1 ok [OK] undefined and null are the same as an absent field [OK] adds count from 1 and the counter advances [OK] a removal never renumbers and the next add never reuses the id -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: UNIQUE constraint failed: wall.scene_id, wall.id [DbError] [FAILED] the id counter survives a reload, even when the newest wall was removed [FAILED] add, update, door set and remove round-trip through a reload @@ -2149,7 +2158,7 @@ u: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/v/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/v/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] the id counter survives a reload, even when the newest wall was removed @@ -2181,10 +2190,10 @@ v: exit=1 expected_failed=1 ok [OK] the switch-set invariants reject door-only settings on a non-door (#55) [OK] storable is the last gate: a secret or locked non-door is refused [OK] a label is 1..64 code points, trimmed and free of control characters (#55) -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: CHECK constraint failed: open = 0 OR door = 1 [DbError] [FAILED] a wall is never open: the stored row normalizes it -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: CHECK constraint failed: open = 0 OR door = 1 [DbError] [FAILED] update keeps the row's id and open flag unless the door switch is cleared [OK] dot patching: only the given fields change @@ -2194,7 +2203,7 @@ v: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/w/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/w/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] a wall is never open: the stored row normalizes it @@ -2235,7 +2244,7 @@ w: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/x/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/x/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] a zero-length wall is invalid and writes nothing @@ -2276,7 +2285,7 @@ x: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/y/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/y/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] both endpoints must be inside [0,w] x [0,h]; the border itself is allowed @@ -2297,7 +2306,7 @@ y: exit=1 expected_failed=1 ok [OK] add, update, door set and remove round-trip through a reload [OK] door.set refuses to open a secret or locked door, closing either is allowed (#56) [OK] nullable height and label use SQL literals and round-trip as none, not 0 or '' -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: CHECK constraint failed: open = 0 OR door = 1 [DbError] [FAILED] authoring runs with synchronous=FULL and leaves NORMAL behind (Q12) [OK] a failing write leaves memory and the pragma alone @@ -2311,7 +2320,7 @@ y: exit=1 expected_failed=1 ok [OK] a wall is never open: the stored row normalizes it [OK] update keeps the row's id and open flag unless the door switch is cleared [OK] dot patching: only the given fields change -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError Unhandled exception: CHECK constraint failed: open = 0 OR door = 1 [DbError] [FAILED] unknown ids are not-found, wrong kinds are their own outcome [OK] the first wall of a fresh scene is id 1, not 0 @@ -2319,7 +2328,7 @@ y: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/z/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/z/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] unknown ids are not-found, wrong kinds are their own outcome @@ -2360,7 +2369,7 @@ z: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/z2/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/z2/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] add, update, door set and remove round-trip through a reload @@ -2401,7 +2410,7 @@ z2: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s1/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s1/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] presets expand to switches only through the one resolve path (#55) @@ -2440,7 +2449,7 @@ s1: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s2/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s2/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] storable is the last gate: a secret or locked non-door is refused @@ -2481,7 +2490,7 @@ s2: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s3/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s3/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] presets expand to switches only through the one resolve path (#55) @@ -2537,7 +2546,7 @@ s3: exit=1 expected_failed=1 ok [OK] prototype scene, all tokens, doors closed and opened [OK] random wall fields, cell 32 and 25 [OK] negative control: the oracle notices a missing and an invented cell -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s4/w/tests/tgeometry' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s4/w/tests/tgeometry' # test exit=1; expected tests failed: 1 [FAILED] one-way: sight_dir names the blind side (left is the (-dy, dx) normal) @@ -2558,7 +2567,7 @@ s4: exit=1 expected_failed=1 ok [OK] a removal never renumbers and the next add never reuses the id [OK] the id counter survives a reload, even when the newest wall was removed [OK] add, update, door set and remove round-trip through a reload -/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError +/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble/pkgs2/db_connector-0.1.0-4f2e67d0e4b61af9ac5575509305660b473f01a4/db_connector/db_sqlite.nim(211) dbError AND sight_dir = 'both') [DbError] [FAILED] door.set refuses to open a secret or locked door, closing either is allowed (#56) [OK] nullable height and label use SQL literals and round-trip as none, not 0 or '' @@ -2580,7 +2589,7 @@ s4: exit=1 expected_failed=1 ok [OK] one field is enough; a patch with none is invalid [OK] the non-settable columns are unknown fields: alone they leave no patch field [OK] field shapes: text by the 6.5 rule, numbers finite, extra an object -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s5/w/tests/tworld' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s5/w/tests/tworld' # test exit=1; expected tests failed: 1 [FAILED] door.set refuses to open a secret or locked door, closing either is allowed (#56) @@ -2596,7 +2605,7 @@ s5: exit=1 expected_failed=1 ok [FAILED] a geometry change retracts the marker and a re-earn gets a fresh id [OK] a placement change retracts too; height and label never do [OK] a solid wall with the switch on mints nothing; clearing the switch retracts -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s6/w/tests/tmarkers' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s6/w/tests/tmarkers' # test exit=1; expected tests failed: 1 [FAILED] a geometry change retracts the marker and a re-earn gets a fresh id @@ -2612,19 +2621,20 @@ s6: exit=1 expected_failed=1 ok [OK] a geometry change retracts the marker and a re-earn gets a fresh id [FAILED] a placement change retracts too; height and label never do [OK] a solid wall with the switch on mints nothing; clearing the switch retracts -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/s7/w/tests/tmarkers' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/s7/w/tests/tmarkers' # test exit=1; expected tests failed: 1 [FAILED] an untouched marker survives a refresh: it is memory, not current sight s7: exit=1 expected_failed=1 ok ## aa: the egress ignores LOS, gm_only and ownership # diff server/views.nim -> mutated copy: -# 268c268 +# 281c281 # < if not pv[].visibleTo(t, playerId): continue # --- # > if false: continue [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [FAILED] the set of tokens follows the visibility rule [OK] a player frame carries no GM-only field and no wall-like key @@ -2658,7 +2668,7 @@ s7: exit=1 expected_failed=1 ok [OK] a player never receives another player's list [OK] a Context is six addresses: in-place changes are visible through the borrow [OK] building a Context and egressing does not scale with the explored sets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/aa/w/tests/tviews' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/aa/w/tests/tviews' # test exit=1; expected tests failed: 1 [FAILED] the set of tokens follows the visibility rule @@ -2682,7 +2692,7 @@ aa: exit=1 expected_failed=1 ok [OK] another token needs to be inside the polygon [FAILED] a gm_only token inside the LOS is not visible to anyone else [OK] a player with no vision token sees only what they control -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ab/w/tests/tvision' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ab/w/tests/tvision' # test exit=1; expected tests failed: 1 [FAILED] a gm_only token inside the LOS is not visible to anyone else @@ -2706,19 +2716,20 @@ ab: exit=1 expected_failed=1 ok [OK] another token needs to be inside the polygon [OK] a gm_only token inside the LOS is not visible to anyone else [FAILED] a player with no vision token sees only what they control -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ac/w/tests/tvision' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ac/w/tests/tvision' # test exit=1; expected tests failed: 1 [FAILED] a controlled token is always visible, gm_only included ac: exit=1 expected_failed=1 ok ## ad: no token_gone when a token leaves the view # diff server/views.nim -> mutated copy: -# 698c698 +# 717c717 # < result.add tokenGoneFrame(id) # --- # > discard [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [OK] the set of tokens follows the visibility rule [OK] a player frame carries no GM-only field and no wall-like key @@ -2752,19 +2763,20 @@ ac: exit=1 expected_failed=1 ok [OK] a player never receives another player's list [OK] a Context is six addresses: in-place changes are visible through the borrow [OK] building a Context and egressing does not scale with the explored sets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ad/w/tests/tviews' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ad/w/tests/tviews' # test exit=1; expected tests failed: 1 [FAILED] leaving view sends `token_gone` once, and never for a token that was never sent ad: exit=1 expected_failed=1 ok ## ae: a player token frame carries the GM-only kind # diff server/views.nim -> mutated copy: -# 433c433 +# 449c449 # < "statuses": statusKindsJson(v.statuses), "props": buckets, "cprops": cprops # --- # > "statuses": statusKindsJson(v.statuses), "props": buckets, "kind": "npc", "cprops": cprops [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [OK] the set of tokens follows the visibility rule [FAILED] a player frame carries no GM-only field and no wall-like key @@ -2798,7 +2810,7 @@ ad: exit=1 expected_failed=1 ok [OK] a player never receives another player's list [OK] a Context is six addresses: in-place changes are visible through the borrow [OK] building a Context and egressing does not scale with the explored sets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ae/w/tests/tviews' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ae/w/tests/tviews' # test exit=1; expected tests failed: 1 [FAILED] a player frame carries no GM-only field and no wall-like key @@ -2824,14 +2836,14 @@ ae: exit=1 expected_failed=1 ok [OK] another token needs to be inside the polygon [OK] a gm_only token inside the LOS is not visible to anyone else [OK] a player with no vision token sees only what they control -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/af/w/tests/tvision' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/af/w/tests/tvision' # test exit=1; expected tests failed: 1 [FAILED] moving adds cells and never forgets the old ones af: exit=1 expected_failed=1 ok ## ag: the chunk row stride is dropped # diff server/explored.nim -> mutated copy: -# 56c56 +# 97c97 # < ((cy mod ChunkCells) * ChunkCells) + (cx mod ChunkCells) # --- # > (cy mod ChunkCells) + (cx mod ChunkCells) @@ -2846,14 +2858,14 @@ af: exit=1 expected_failed=1 ok [OK] restore: two players' explored never mix [OK] restore: an empty store restores nothing and a removed player takes its chunks [OK] a mutation-scale chunk write stays inside the 4.3 commit budget -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ag/w/tests/texplored' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ag/w/tests/texplored' # test exit=1; expected tests failed: 1 [FAILED] the chunk bitmap layout is pinned ag: exit=1 expected_failed=1 ok ## ah: a cell coordinate is used as a chunk coordinate # diff server/explored.nim -> mutated copy: -# 46c46 +# 87c87 # < cell div ChunkCells # --- # > cell @@ -2870,14 +2882,14 @@ ag: exit=1 expected_failed=1 ok [FAILED] restore: two players' explored never mix [OK] restore: an empty store restores nothing and a removed player takes its chunks [OK] a mutation-scale chunk write stays inside the 4.3 commit budget -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ah/w/tests/texplored' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ah/w/tests/texplored' # test exit=1; expected tests failed: 1 [FAILED] one chunk covers 64x64 cells ah: exit=1 expected_failed=1 ok ## ai: restore forgets the decoded cells # diff server/explored.nim -> mutated copy: -# 146c146 +# 187c187 # < result.mgetOrPut(pid, PlayerVision()).explored.incl idx # --- # > discard @@ -2900,14 +2912,14 @@ ah: exit=1 expected_failed=1 ok [FAILED] restore: two players' explored never mix [OK] restore: an empty store restores nothing and a removed player takes its chunks [OK] a mutation-scale chunk write stays inside the 4.3 commit budget -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ai/w/tests/texplored' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ai/w/tests/texplored' # test exit=1; expected tests failed: 1 [FAILED] restore: the stored cells come back exactly ai: exit=1 expected_failed=1 ok ## aj: explored chunks keyed by scene, not player # diff server/explored.nim -> mutated copy: -# 127c127 +# 168c168 # < db.exec(ps, c.playerId, sceneId, c.cx, c.cy, c.bits) # --- # > db.exec(ps, sceneId, sceneId, c.cx, c.cy, c.bits) @@ -2930,14 +2942,14 @@ ai: exit=1 expected_failed=1 ok [FAILED] restore: two players' explored never mix [FAILED] restore: an empty store restores nothing and a removed player takes its chunks [OK] a mutation-scale chunk write stays inside the 4.3 commit budget -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/aj/w/tests/texplored' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/aj/w/tests/texplored' # test exit=1; expected tests failed: 1 [FAILED] restore: two players' explored never mix aj: exit=1 expected_failed=1 ok ## ak: a chunk rewrite is ignored # diff server/explored.nim -> mutated copy: -# 116c116 +# 157c157 # < ON CONFLICT(player_id, scene_id, cx, cy) DO UPDATE SET bits = excluded.bits""" # --- # > ON CONFLICT(player_id, scene_id, cx, cy) DO NOTHING""" @@ -2952,14 +2964,14 @@ aj: exit=1 expected_failed=1 ok [OK] restore: two players' explored never mix [OK] restore: an empty store restores nothing and a removed player takes its chunks [OK] a mutation-scale chunk write stays inside the 4.3 commit budget -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ak/w/tests/texplored' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ak/w/tests/texplored' # test exit=1; expected tests failed: 1 [FAILED] a second write to the same chunk replaces the bitmap ak: exit=1 expected_failed=1 ok ## al: dirty chunks keyed by row only # diff server/explored.nim -> mutated copy: -# 105c105 +# 146c146 # < let key = ccy * sc.chunkCols + ccx # --- # > let key = ccy @@ -2974,19 +2986,20 @@ ak: exit=1 expected_failed=1 ok [OK] restore: two players' explored never mix [OK] restore: an empty store restores nothing and a removed player takes its chunks [OK] a mutation-scale chunk write stays inside the 4.3 commit budget -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/al/w/tests/texplored' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/al/w/tests/texplored' # test exit=1; expected tests failed: 1 [FAILED] two chunks in one chunk row are both written al: exit=1 expected_failed=1 ok ## am: the owner bucket reaches a non-controller # diff server/views.nim -> mutated copy: -# 284c284 +# 297c297 # < propsOwner: (if mine: objectOf(t.props[pbOwner]) else: nil), # --- # > propsOwner: t.props[pbOwner], [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [OK] the set of tokens follows the visibility rule [OK] a player frame carries no GM-only field and no wall-like key @@ -3020,7 +3033,7 @@ al: exit=1 expected_failed=1 ok [OK] a player never receives another player's list [OK] a Context is six addresses: in-place changes are visible through the borrow [OK] building a Context and egressing does not scale with the explored sets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/am/w/tests/tviews' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/am/w/tests/tviews' # test exit=1; expected tests failed: 1 [FAILED] a player who sees the token gets the public bucket only @@ -3097,7 +3110,7 @@ am: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [FAILED] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/an/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/an/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] wall added within r of the circle (centre not on it) sets stuck; exactly r does not @@ -3174,7 +3187,7 @@ an: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ao/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ao/w/tests/tmoverules' # test exit=1; expected tests failed: 2 [FAILED] a squeeze from a failed grow clears when a later shrink ends the overlap [FAILED] a shrink that still overlaps keeps the stuck entry @@ -3202,7 +3215,7 @@ ao: exit=1 expected_failed=2 ok [OK] propsJson carries all three buckets, always as objects [OK] clone gives fresh buckets: editing the copy cannot reach the original [OK] normalize repairs nil buckets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ap/w/tests/tprops' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ap/w/tests/tprops' # test exit=1; expected tests failed: 1 [FAILED] 64 keys per bucket, the 65th is refused and nothing changes @@ -3279,7 +3292,7 @@ ap: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/aq/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/aq/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] grow inside r of a wall pushes it out by the minimal perpendicular distance @@ -3354,7 +3367,7 @@ aq: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ar/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ar/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] grow with no room on either side squeezes the token and leaves it in place @@ -3431,7 +3444,7 @@ ar: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/as/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/as/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] push: both sides invalid -> squeezed in place; door open -> still squeezed (KEEP); GM can move it @@ -3460,7 +3473,7 @@ as: exit=1 expected_failed=1 ok [OK] propsJson carries all three buckets, always as objects [OK] clone gives fresh buckets: editing the copy cannot reach the original [OK] normalize repairs nil buckets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/at/w/tests/tprops' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/at/w/tests/tprops' # test exit=1; expected tests failed: 1 [FAILED] 64 keys per bucket, the 65th is refused and nothing changes @@ -3537,7 +3550,7 @@ at: exit=1 expected_failed=1 ok [OK] a GM-sourced lock refuses player moves without touching the walls entries [OK] a wall added over a GM-locked token only adds the walls entry [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/au/w/tests/tmoverules' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/au/w/tests/tmoverules' # test exit=1; expected tests failed: 1 [FAILED] a grow that already fits does not move the token @@ -3575,7 +3588,7 @@ au: exit=1 expected_failed=1 ok [FAILED] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/av/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/av/w/tests/tcharacters' # test exit=1; expected tests failed: 2 [FAILED] a character owner sees the actual name without any reveal row [FAILED] a linked token borrows the character's names, so one reveal covers all of them @@ -3614,7 +3627,7 @@ av: exit=1 expected_failed=2 ok [OK] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/aw/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/aw/w/tests/tcharacters' # test exit=1; expected tests failed: 2 [FAILED] a first sighting records what the player knows right now [FAILED] a rename follows the subject, and a player who was never told keeps not knowing @@ -3653,7 +3666,7 @@ aw: exit=1 expected_failed=2 ok [OK] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ax/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ax/w/tests/tcharacters' # test exit=1; expected tests failed: 1 [FAILED] a rename follows the subject, and a player who was never told keeps not knowing @@ -3691,7 +3704,7 @@ ax: exit=1 expected_failed=1 ok [OK] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [FAILED] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/ay/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/ay/w/tests/tcharacters' # test exit=1; expected tests failed: 1 [FAILED] a linked token carries no names of its own (they belong to the character) @@ -3729,7 +3742,7 @@ ay: exit=1 expected_failed=1 ok [OK] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [FAILED] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/az/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/az/w/tests/tcharacters' # test exit=1; expected tests failed: 1 [FAILED] a character still figured by a token is in use (6.5) @@ -3767,7 +3780,7 @@ az: exit=1 expected_failed=1 ok [OK] a character rename follows the snapshots of everyone who met it [FAILED] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/b1/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/b1/w/tests/tcharacters' [OK] 12 characters from the documented alphabet [OK] freshId never returns an id that is taken [OK] a name is trimmed, non-empty and free of control characters @@ -3830,7 +3843,7 @@ b1: exit=1 expected_failed=1 ok [FAILED] a character rename follows the snapshots of everyone who met it [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) [OK] a character still figured by a token is in use (6.5) -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/b2/w/tests/tcharacters' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/b2/w/tests/tcharacters' # test exit=1; expected tests failed: 2 [FAILED] a character rename rewrites the live snapshots and the rows alike (#30, #27) [FAILED] a character rename follows the snapshots of everyone who met it @@ -3838,12 +3851,13 @@ Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/b2/w/tests/t b2: exit=1 expected_failed=2 ok ## b3: cprops carries the character owner bucket # diff server/views.nim -> mutated copy: -# 287c287 +# 300c300 # < cpropsPublic: objectOf(if ch.isSome and not ownsCharacter: ch.get.props[pbPublic] # --- # > cpropsPublic: objectOf(if ch.isSome and not ownsCharacter: ch.get.props[pbOwner] [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [OK] the set of tokens follows the visibility rule [OK] a player frame carries no GM-only field and no wall-like key @@ -3879,19 +3893,20 @@ b2: exit=1 expected_failed=2 ok [OK] a player never receives another player's list [OK] a Context is six addresses: in-place changes are visible through the borrow [OK] building a Context and egressing does not scale with the explored sets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/b3/w/tests/tviews' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/b3/w/tests/tviews' # test exit=1; expected tests failed: 1 [FAILED] cprops carries the character's public bucket to a non-owner, and never the owner bucket b3: exit=1 expected_failed=1 ok ## b4: a player is sent every character # diff server/views.nim -> mutated copy: -# 290c290 +# 303c303 # < if c.owner != playerId: continue # --- # > if false: continue [OK] every token, in token order, with controller and both names [OK] a GM-controlled token shows controller null + [OK] seen_by lists the players whose existing sight sees each token, ascending [OK] the GM never gets vision polygons or explored cells [OK] the set of tokens follows the visibility rule [OK] a player frame carries no GM-only field and no wall-like key @@ -3925,15 +3940,15 @@ b3: exit=1 expected_failed=1 ok [OK] a player never receives another player's list [OK] a Context is six addresses: in-place changes are visible through the borrow [OK] building a Context and egressing does not scale with the explored sets -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/b4/w/tests/tviews' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/b4/w/tests/tviews' # test exit=1; expected tests failed: 1 [FAILED] a player gets only its own characters, without owner, reveal_all or revealed b4: exit=1 expected_failed=1 ok ## c1: the tile gate ignores the explored set # diff server/tiles.nim -> mutated copy: -# 123c123 -# < if sc.cellIndex(cx, cy) in explored: return true +# 139c139 +# < if cy * sc.cols + cx in explored: return true # --- # > if true: return true [OK] canonical numbers: digits only, bounded, no leading zero @@ -3948,7 +3963,7 @@ b4: exit=1 expected_failed=1 ok [FAILED] a tile is allowed when any overlapping cell is explored [FAILED] the explored overlap respects the scene border [OK] a request built from one record stays internally consistent when the scene is swapped -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c1/w/tests/ttiles' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/c1/w/tests/ttiles' # test exit=1; expected tests failed: 2 [FAILED] an unexplored tile is refused [FAILED] a tile is allowed when any overlapping cell is explored @@ -3956,10 +3971,10 @@ Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c1/w/tests/t c1: exit=1 expected_failed=2 ok ## c2: the tile gate needs every overlapping cell # diff server/tiles.nim -> mutated copy: -# 123c123 -# < if sc.cellIndex(cx, cy) in explored: return true +# 139c139 +# < if cy * sc.cols + cx in explored: return true # --- -# > if sc.cellIndex(cx, cy) notin explored: return false +# > if cy * sc.cols + cx notin explored: return false [OK] canonical numbers: digits only, bounded, no leading zero [OK] a canonical URL parses to its three integers [OK] leading zero tile coordinates are malformed @@ -3972,7 +3987,7 @@ c1: exit=1 expected_failed=2 ok [FAILED] a tile is allowed when any overlapping cell is explored [FAILED] the explored overlap respects the scene border [FAILED] a request built from one record stays internally consistent when the scene is swapped -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c2/w/tests/ttiles' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/c2/w/tests/ttiles' # test exit=1; expected tests failed: 2 [FAILED] an unexplored tile is refused [FAILED] a tile is allowed when any overlapping cell is explored @@ -3980,7 +3995,7 @@ Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c2/w/tests/t c2: exit=1 expected_failed=2 ok ## c3: an out-of-grid tile coordinate is accepted # diff server/tiles.nim -> mutated copy: -# 77c77 +# 93c93 # < x >= 0 and y >= 0 and x < tileCols(sc) and y < tileRows(sc) # --- # > x >= 0 and y >= 0 @@ -3996,14 +4011,14 @@ c2: exit=1 expected_failed=2 ok [OK] a tile is allowed when any overlapping cell is explored [OK] the explored overlap respects the scene border [OK] a request built from one record stays internally consistent when the scene is swapped -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c3/w/tests/ttiles' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/c3/w/tests/ttiles' # test exit=1; expected tests failed: 1 [FAILED] a tile coordinate outside the grid is out of range c3: exit=1 expected_failed=1 ok ## c4: a leading-zero tile coordinate is canonical # diff server/tiles.nim -> mutated copy: -# 55c55 +# 71c71 # < if raw[0] == '0' and raw.len > 1: return false # --- # > discard @@ -4019,7 +4034,7 @@ c3: exit=1 expected_failed=1 ok [OK] a tile is allowed when any overlapping cell is explored [OK] the explored overlap respects the scene border [OK] a request built from one record stays internally consistent when the scene is swapped -Error: execution of an external program failed: '/tmp/fffmut.Gg6RRD/c4/w/tests/ttiles' +Error: execution of an external program failed: '/tmp/fffmut.hyr7SV/c4/w/tests/ttiles' # test exit=1; expected tests failed: 1 [FAILED] leading zero tile coordinates are malformed diff --git a/results/nimble-test.log b/results/nimble-test.log index f5d5cf8..a9e26ec 100644 --- a/results/nimble-test.log +++ b/results/nimble-test.log @@ -1,6 +1,6 @@ - Info: Using the environment variable: NIMBLE_DIR='/home/davide/Projects/GDR/FFF_vtt-m64/.devbox/nimble' + Info: Using the environment variable: NIMBLE_DIR='/home/davide/Projects/GDR/FFF_vtt-m76/.devbox/nimble' Info: using /nix/store/0cbdz34lsakfirycixckf6ypsd8hazhg-x86_64-unknown-linux-gnu-nim-wrapper-2.2.12/bin/nim for compilation - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tauth (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tauth (from package fff_vtt) using c backend Nim Output [Suite] GM key (fff-vtt gm-key) ... [OK] first run creates the single GM and prints a key; re-run prints the same key ... [OK] --new rotates: new key, old key invalid, GM sessions revoked, same player @@ -15,7 +15,7 @@ ... [OK] only the hash is stored; the token itself appears nowhere ... [OK] unknown hash gives no player; revoking one player leaves the other alone Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tcharacters (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tcharacters (from package fff_vtt) using c backend Nim Output [Suite] the name rule (DESIGN 8: one copy, used by every frame) ... [OK] an owner, a reveal_all and a per-player reveal each expose the actual name ... [OK] visibleName picks the name the recipient knows @@ -48,7 +48,7 @@ ... [OK] player.remove hands the player's characters to the GM (DESIGN 3.2) ... [OK] a character still figured by a token is in use (6.5) Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tconfig (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tconfig (from package fff_vtt) using c backend Nim Output [Suite] config defaults ... [OK] defaults: dev origin, port 9000, state dir run ... [OK] state dir is joined, not concatenated @@ -75,7 +75,7 @@ ... [OK] --help is not an error and asks for usage, even with a broken env ... [OK] usage lists the three keys and says the bind is fixed Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tconns (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tconns (from package fff_vtt) using c backend Nim Output [Suite] total cap ... [OK] 16 reservations succeed, the 17th is refused ... [OK] a cancelled reservation gives the slot back @@ -96,7 +96,7 @@ ... [OK] a Pong is recorded on the right connection ... [OK] a snapshot hands out every live connection without holding the lock afterwards Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tcrypto (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tcrypto (from package fff_vtt) using c backend Nim Output [Suite] sha256 ... [OK] FIPS 180-4 known answers ... [OK] padding boundaries: 55, 56 and 64 byte messages differ and are stable @@ -110,23 +110,23 @@ ... [Suite] constant-time compare ... [OK] equal only for identical strings, including the empty case Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb (from package fff_vtt) using c backend - Nim Output /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(403, 3) template/generic instantiation of `test` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(412, 9) template/generic instantiation of `withTransaction` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/db.nim(298, 12) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(403, 3) template/generic instantiation of `test` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(412, 9) template/generic instantiation of `withTransaction` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/db.nim(299, 10) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(425, 3) template/generic instantiation of `test` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(434, 9) template/generic instantiation of `authoringTransaction` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/world.nim(440, 14) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(425, 3) template/generic instantiation of `test` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdb.nim(434, 9) template/generic instantiation of `authoringTransaction` from here - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/world.nim(441, 12) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(403, 3) template/generic instantiation of `test` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(412, 9) template/generic instantiation of `withTransaction` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/db.nim(298, 12) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(403, 3) template/generic instantiation of `test` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(412, 9) template/generic instantiation of `withTransaction` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/db.nim(299, 10) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(425, 3) template/generic instantiation of `test` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(434, 9) template/generic instantiation of `authoringTransaction` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/world.nim(440, 14) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(396, 1) template/generic instantiation of `suite` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(425, 3) template/generic instantiation of `test` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdb.nim(434, 9) template/generic instantiation of `authoringTransaction` from here + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/world.nim(441, 12) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] ... [Suite] open ... [OK] creates the file, sets WAL, synchronous NORMAL, busy_timeout, foreign_keys ... [Suite] migrate @@ -145,7 +145,7 @@ ... [OK] withTransaction rolls back a Defect and leaves the connection usable ... [OK] authoringTransaction rolls back a Defect and restores NORMAL Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tdetach (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tdetach (from package fff_vtt) using c backend Nim Output [Suite] detachedJson ... [OK] rebuilds nodes and string payloads ... [OK] mutating the source leaves the copy alone @@ -158,11 +158,11 @@ ... [Suite] the premise this guards (world.parseFlags) ... [OK] parseFlags returns the caller's node by reference, not a copy Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/testutil (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/testutil (from package fff_vtt) using c backend Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/texplored (from package fff_vtt) using c backend - Nim Output /home/davide/Projects/GDR/FFF_vtt-m64/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/texplored (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] ... [Suite] chunk format ... [OK] the chunk bitmap layout is pinned ... [OK] one chunk covers 64x64 cells @@ -177,10 +177,10 @@ ... [OK] restore: two players' explored never mix ... [OK] restore: an empty store restores nothing and a removed player takes its chunks ... [Suite] cost - ... chunk write: avg 0.012 ms, p99 0.030 ms over 200 commits + ... chunk write: avg 0.011 ms, p99 0.022 ms over 200 commits ... [OK] a mutation-scale chunk write stays inside the 4.3 commit budget Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tgeometry (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tgeometry (from package fff_vtt) using c backend Nim Output [Suite] visibility ... [OK] open space is a circle ... [OK] wall blocks @@ -234,12 +234,12 @@ ... [OK] random wall fields, cell 32 and 25 ... [OK] negative control: the oracle notices a missing and an invented cell Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tinstancelock (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tinstancelock (from package fff_vtt) using c backend Nim Output [Suite] instance lock ... [OK] acquires, creates the lock file, releases and re-acquires ... [OK] release is idempotent Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tlogging (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tlogging (from package fff_vtt) using c backend Nim Output [Suite] redaction by value ... [OK] a secret passed as a field value never appears in the output ... [OK] a secret inside free text, the event name or a nested value is scrubbed too @@ -256,10 +256,10 @@ ... [OK] messages below the level are dropped ... [OK] no fields is still one valid line Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tmarkers (from package fff_vtt) using c backend - Nim Output /home/davide/Projects/GDR/FFF_vtt-m64/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/markers.nim(29, 8) Warning: imported and not used: 'faults' [UnusedImport] + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tmarkers (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/markers.nim(29, 8) Warning: imported and not used: 'faults' [UnusedImport] ... [Suite] player markers (5.8, #59/#60) ... [OK] a marked window seen by any part of its extent mints one anchor marker ... [OK] an untouched marker survives a refresh: it is memory, not current sight @@ -267,7 +267,7 @@ ... [OK] a placement change retracts too; height and label never do ... [OK] a solid wall with the switch on mints nothing; clearing the switch retracts Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tmoverules (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tmoverules (from package fff_vtt) using c backend Nim Output [Suite] pathClear, r = 0 (ported prototype move tests) ... [OK] crossing blocked, parallel ok ... [OK] grazing an endpoint is blocked @@ -344,7 +344,7 @@ ... [OK] a wall added over a GM-locked token only adds the walls entry ... [OK] the GM clear of the walls entries leaves a GM-sourced entry alone (no rule runs) Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tprobing (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tprobing (from package fff_vtt) using c backend Nim Output [Suite] probing (T8) ... [OK] P1: probes longer than the cap get one fixed nack regardless of the scene ... [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes @@ -352,7 +352,7 @@ ... [OK] P4: probing cannot unlock or move a locked token ... [OK] doors beyond the bound: opening or closing them changes no reply Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tprops (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tprops (from package fff_vtt) using c backend Nim Output [Suite] caps (6.1, numbers FIXED owner-delegated by #22) ... [OK] 64 keys per bucket, the 65th is refused and nothing changes ... [OK] an existing key can still be overwritten at the cap @@ -377,7 +377,7 @@ ... [OK] clone gives fresh buckets: editing the copy cannot reach the original ... [OK] normalize repairs nil buckets Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tprotocol (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tprotocol (from package fff_vtt) using c backend Nim Output [Suite] envelope (6.5 step 2) ... [OK] a well-formed intent parses and keeps its reqId and node ... [OK] reqId boundaries: 0 and 2^31-1 pass, 2^31 and -1 are malformed @@ -409,15 +409,30 @@ ... [OK] `walls` is the full list plus the scene, `wall` is one upsert, `wall_gone` an id ... [OK] the fan-out frames carry no n: the sender stamps it per recipient Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tscenegen (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tscenegen (from package fff_vtt) using c backend Nim Output [Suite] scenegen (bench scenes) ... [OK] exactly n walls, deterministic per seed, seeds differ ... [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter) ... [OK] walls are non-degenerate and axis-ish segments of room-edge length Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/ttiles (from package fff_vtt) using c backend - Nim Output /home/davide/Projects/GDR/FFF_vtt-m64/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tsessions (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] + ... [Suite] gate cache: sessions + ... [OK] a revocation drops every cached session of that player and no other + ... [OK] player removal drops the sessions and the explored bitmap + ... [OK] sessions survive a restart through the database, replaced ones do not + ... [Suite] gate cache: explored bitmap + ... [OK] the bitmap holds the same cells as the set, with the cell-index layout + ... [OK] a refresh marks only its fresh cells, and the snapshot only grows + ... [Suite] gate cache: the tile rule + ... [OK] the GM is always allowed; a player only through an explored bit + ... [OK] the URL is decided before any session is looked at + ... [OK] a scene republish changes the parse result, never a mixture + Success: Execution finished + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/ttiles (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] ... [Suite] tile URL grammar ... [OK] canonical numbers: digits only, bounded, no leading zero ... [OK] a canonical URL parses to its three integers @@ -434,7 +449,7 @@ ... [Suite] one scene record per request (#31) ... [OK] a request built from one record stays internally consistent when the scene is swapped Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/ttokens (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/ttokens (from package fff_vtt) using c backend Nim Output [Suite] ids (DESIGN 8, FIXED #3: random, opaque, 12 chars) ... [OK] 12 characters from the documented alphabet ... [OK] freshId never returns an id that is taken @@ -467,12 +482,13 @@ ... [OK] removing a token removes its status rows (FK cascade) ... [OK] status helpers keep the entry set unique and ordered Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tviews (from package fff_vtt) using c backend - Nim Output /home/davide/Projects/GDR/FFF_vtt-m64/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tviews (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] ... [Suite] GM view (3.1: everything, with the GM-only extras) ... [OK] every token, in token order, with controller and both names ... [OK] a GM-controlled token shows controller null + ... [OK] seen_by lists the players whose existing sight sees each token, ascending ... [OK] the GM never gets vision polygons or explored cells ... [Suite] player view (3.1: controlled always, LOS + not gm_only otherwise) ... [OK] the set of tokens follows the visibility rule @@ -512,15 +528,15 @@ ... [OK] a player never receives another player's list ... [Suite] egress borrows the world instead of copying it (#28) ... [OK] a Context is six addresses: in-place changes are visible through the borrow - ... #28 context build, 262144 cells x 6 players: 0.007 us (min of 5 x 100) - ... #28 egress, 262144 cells x 6 players x 40 entries: GM 0.543 ms, player 0.226 ms (min of 20) - ... #28 egress, 16384 cells x 6 players x 40 entries: GM 0.556 ms (min of 20) + ... #28 context build, 262144 cells x 6 players: 0.014 us (min of 5 x 100) + ... #28 egress, 262144 cells x 6 players x 40 entries: GM 1.173 ms, player 0.279 ms (min of 20) + ... #28 egress, 16384 cells x 6 players x 40 entries: GM 0.809 ms (min of 20) ... [OK] building a Context and egressing does not scale with the explored sets Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tvision (from package fff_vtt) using c backend - Nim Output /home/davide/Projects/GDR/FFF_vtt-m64/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] - ... /home/davide/Projects/GDR/FFF_vtt-m64/tests/tvision.nim(4, 13) Warning: imported and not used: 'algorithm' [UnusedImport] + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tvision (from package fff_vtt) using c backend + Nim Output /home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport] + ... /home/davide/Projects/GDR/FFF_vtt-m76/tests/tvision.nim(4, 13) Warning: imported and not used: 'algorithm' [UnusedImport] ... [Suite] polygons (5.1: one per controlled token with the `vision` flag) ... [OK] only the player's own vision tokens produce one, in token order ... [OK] a player with no vision token has no polygons at all @@ -541,7 +557,7 @@ ... [OK] a gm_only token inside the LOS is not visible to anyone else ... [OK] a player with no vision token sees only what they control Success: Execution finished - Compiling /home/davide/Projects/GDR/FFF_vtt-m64/tests/tworld (from package fff_vtt) using c backend + Compiling /home/davide/Projects/GDR/FFF_vtt-m76/tests/tworld (from package fff_vtt) using c backend Nim Output [Suite] scene (migration step 3, Q3: exactly one scene) ... [OK] the migration seeds scene 1 with the v1 defaults, no walls, next_wall_id 1 ... [OK] an unknown scene id is not there (the wire answers not-found) diff --git a/server/geometry.nim b/server/geometry.nim index 7b31840..9362ea2 100644 --- a/server/geometry.nim +++ b/server/geometry.nim @@ -1,4 +1,4 @@ -## 2D vision geometry. Pure, stdlib only. Ported from prototype-server-vision/src/geometry.nim (M1), revised in M2. +## 2D vision geometry. Pure, stdlib only. Ported from docs/archive/prototypes/server-vision/src/geometry.nim (M1), revised in M2. ## Move rules (swept circle, token-on-wall escape, step cap, `blocked`) live in server/moverules.nim, not here. ## Fixed in M2 (DESIGN 5.5): token exactly on a wall can move off it (moverules escape rule); the move check is the ## swept circle, not centre path + destination only; `moveBlocked` is gone from this module; cellsTouched is a scanline diff --git a/tests/refold.nim b/tests/refold.nim index 7f435c2..74dc8f7 100644 --- a/tests/refold.nim +++ b/tests/refold.nim @@ -1,5 +1,5 @@ ## TEST-ONLY reference: the prototype implementations that M2 replaced, kept verbatim (renamed) as differential oracles. -## Never imported by server code. Source: prototype-server-vision/src/geometry.nim (M1 port). +## Never imported by server code. Source: docs/archive/prototypes/server-vision/src/geometry.nim (M1 port). import std/math import geometry diff --git a/tests/tgeometry.nim b/tests/tgeometry.nim index a8780da..5f32830 100644 --- a/tests/tgeometry.nim +++ b/tests/tgeometry.nim @@ -277,7 +277,7 @@ const PrototypeTokenRadius = 20.0 ## carries one (nor its stale `tileSize`, nor index token ids). Only this seed test uses it. proc loadScene(): Scene = - # fixtures are copies of prototype-server-vision/data/scene.json; a missing file fails, never skips + # fixtures are copies of docs/archive/prototypes/server-vision/data/scene.json; a missing file fails, never skips let j = parseFile(currentSourcePath().parentDir / "fixtures" / "scene.json") for w in j["walls"]: result.walls.add Wall(a: (w["a"][0].getFloat, w["a"][1].getFloat), b: (w["b"][0].getFloat, w["b"][1].getFloat), diff --git a/tools/fogbench.nim b/tools/fogbench.nim new file mode 100644 index 0000000..bcbab3d --- /dev/null +++ b/tools/fogbench.nim @@ -0,0 +1,103 @@ +## M4 fog benchmark (#76): the 50-token, 16384 px tile map measurement the finish ticket records +## in `results/m4-fog-bench.md`. `devbox run fogbench` compiles and runs it; the log lands in +## `results/m4-fog-bench.log`. +## +## Two numbers the phone gate needs to make sense of: +## 1. server recompute on a move: one player's vision refresh (one polygon, ~5k sparse walls, +## 16384 px map) plus the egress pass for that player with 50 visible tokens; +## 2. the client's headless frame time is measured separately by `client/e2e/fogbench.test.mjs` +## (SwiftShader, so it is a floor, never the phone number it is compared with). +## +## No timing code lives in server/: this harness times the real modules from outside. +import std/[json, monotimes, times, strformat, math, options, tables, strutils, sets] +import geometry +import characters, props, tokens, views, vision, world +import scenegen + +var sink = 0 + +proc bench(name: string, n: int, f: proc(i: int)): float = + for i in 0 ..< 50: f(i) # warm-up + var sum, worst = 0.0 + for i in 0 ..< n: + let t0 = getMonoTime(); f(i) + let ms = (getMonoTime() - t0).inNanoseconds.float / 1e6 + sum += ms; worst = max(worst, ms) + echo &"{name}: n={n} avg={sum / n.float:.3f}ms worst={worst:.3f}ms" + sum / n.float + +const World = 16384.0 +const PlayerId = 2 + +## 50 tokens: the player's one sighted token at the map centre, 49 NPCs inside its radius. The +## cluster is the phone scene (50 tokens rendered with the fog on), so the wall generator's walls +## inside that box are removed: the sight cost still comes from the ~5k walls elsewhere. +proc build(): ref ContextStore = + var tokens: seq[TokenRec] + tokens.add TokenRec(id: "vision-token", scene: 1, kind: "pc", descriptiveName: "Ann", + actualName: "Ann", pos: (World / 2, World / 2), owner: PlayerId, + flags: %*{"vision": true}, visionRadius: some(300.0), radius: some(20.0), + props: newProps()) + for i in 0 ..< 49: + let dx = float((i mod 7) - 3) * 28.0 + let dy = float((i div 7) - 3) * 28.0 + tokens.add TokenRec(id: &"npc-{i}", scene: 1, kind: "npc", descriptiveName: &"T{i}", + actualName: &"T{i}", pos: (World / 2 + dx, World / 2 + dy), + owner: GmControlled, flags: %*{}, props: newProps()) + + let centre = World / 2 + var walls: seq[WallRec] + var id = 0 + for w in genScene(World, 5000, 1): + let near = max(w.a.x, w.b.x) >= centre - 400 and min(w.a.x, w.b.x) <= centre + 400 and + max(w.a.y, w.b.y) >= centre - 400 and min(w.a.y, w.b.y) <= centre + 400 + if near: continue + inc id + walls.add WallRec(id: id, a: w.a, b: w.b, thickness: 0, position: wpCenter, + blocksSight: true, blocksMovement: true, sightDir: sdBoth, + playerMarker: false, door: false, open: false, secret: false, + locked: false, height: none(float), label: none(string), + flags: newJObject()) + + result = (ref ContextStore)(scene: SceneRec( + id: 1, name: "Scene", w: World, h: World, tileSize: 32, cell: 32, + visionRadiusDefault: 400, tokenRadiusDefault: 20, artVersion: 1, nextWallId: id + 1, + extra: newJObject(), walls: walls), tokens: tokens) + for pid in 2 .. 7: + var pv: PlayerVision + pv.refresh(result.scene, result.tokens, pid) + result.visions[pid] = pv + result.encountered[pid] = initTable[string, characters.EncounteredEntry]() + +let store = build() +echo &"== M4 fog bench: 16384 px map, cell 32 ({store.scene.cols}x{store.scene.rows} cells), " & + &"{store.tokens.len} tokens, {store.scene.walls.len} walls ==" + +# 1. A move refreshes the mover's player: one polygon + its explored cells (main.refreshPlayer). +let refreshAvg = bench("server vision refresh, one player (1 polygon, radius 300, ~5k walls)", 500, proc(i: int) = + store.visions[PlayerId].refresh(store.scene, store.tokens, PlayerId) + sink += store.visions[PlayerId].polys.len) + +# 2. The same player's egress pass with all 50 tokens visible (fresh diff base = a reconnect). +let ctx = store.borrow +var firstKnown: Known +let frames = egressFrames(Recipient(isGm: false, playerId: PlayerId), ctx, firstKnown) +var kinds: seq[string] +for frame in frames: kinds.add $frame{"t"} +echo &"player egress frames with 50 visible tokens: {frames.len} frames, {kinds.join(\",\")}" +let egressAvg = bench("player egress pass, 50 visible tokens (fresh Known)", 300, proc(i: int) = + var known: Known + sink += egressFrames(Recipient(isGm: false, playerId: PlayerId), ctx, known).len) + +# 3. The steady state after the connect snapshot: a Known that already holds every frame. +var warmKnown: Known +discard egressFrames(Recipient(isGm: false, playerId: PlayerId), ctx, warmKnown) +discard bench("player egress pass, warm Known (no changes)", 2000, proc(i: int) = + sink += egressFrames(Recipient(isGm: false, playerId: PlayerId), ctx, warmKnown).len) + +echo &"explored snapshot size: {store.visions[PlayerId].explored.card} cells on the 16384 px map" +let budget = 16.7 +echo &"TARGET move path: refresh + 50-token egress {refreshAvg + egressAvg:.3f} ms vs <= {budget} ms " & + &"(one 60 fps frame): {(if refreshAvg + egressAvg <= budget: \"PASS\" else: \"MISS\")}" +echo "(sink ", sink, ")" +quit(if refreshAvg + egressAvg <= budget: 0 else: 1) diff --git a/tools/mkcorpus.nim b/tools/mkcorpus.nim index f0347af..cc07450 100644 --- a/tools/mkcorpus.nim +++ b/tools/mkcorpus.nim @@ -1,5 +1,5 @@ ## One-off corpus extractor (dev-time only; tests never read prototype paths). -## usage: nim c -r tools/mkcorpus.nim prototype-server-vision/results/leak-A.jsonl prototype-server-vision/results/leak-B.jsonl > tests/fixtures/corpus.jsonl +## usage: nim c -r tools/mkcorpus.nim docs/archive/prototypes/server-vision/results/leak-A.jsonl docs/archive/prototypes/server-vision/results/leak-B.jsonl > tests/fixtures/corpus.jsonl ## Replays the GM socket (token positions, door states per gseq) and emits one line per player `vision` message: ## {"src":"A|B","g":gseq,"id":"A|B","pos":[x,y],"open":[door ids],"poly":[[x,y]..]} (poly = what the prototype server sent, ## computed by the old geometry.nim; "open" = ALL open doors, initial states included). The scene (walls, radius, cell) is tests/fixtures/scene.json. diff --git a/tools/mutation.sh b/tools/mutation.sh index d59b460..096d248 100755 --- a/tools/mutation.sh +++ b/tools/mutation.sh @@ -205,8 +205,8 @@ run e3 "a link patch keeps the token's own names" server/tokens.nim 's/^ if r TILE_GATE="an unexplored tile is refused|a tile is allowed when any overlapping cell" TILE_ZERO="leading zero tile coordinates" TILE_RANGE="outside the grid is out of range" -run c1 "the tile gate ignores the explored set" server/tiles.nim 's/ if sc\.cellIndex(cx, cy) in explored: return true/ if true: return true/' "$TILE_GATE" -run c2 "the tile gate needs every overlapping cell" server/tiles.nim 's/ if sc\.cellIndex(cx, cy) in explored: return true/ if sc.cellIndex(cx, cy) notin explored: return false/' "$TILE_GATE" +run c1 "the tile gate ignores the explored set" server/tiles.nim 's/ if cy \* sc\.cols + cx in explored: return true/ if true: return true/' "$TILE_GATE" +run c2 "the tile gate needs every overlapping cell" server/tiles.nim 's/ if cy \* sc\.cols + cx in explored: return true/ if cy * sc.cols + cx notin explored: return false/' "$TILE_GATE" run c3 "an out-of-grid tile coordinate is accepted" server/tiles.nim 's/^ x >= 0 and y >= 0 and x < tileCols(sc) and y < tileRows(sc)$/ x >= 0 and y >= 0/' "$TILE_RANGE" run c4 "a leading-zero tile coordinate is canonical" server/tiles.nim "s/ if raw\[0\] == '0' and raw.len > 1: return false/ discard/" "$TILE_ZERO" # #65: the in-memory session cache must drop a player's entry on revocation (server/sessions.nim) diff --git a/tools/withserver.mjs b/tools/withserver.mjs index 137655f..17cffa8 100644 --- a/tools/withserver.mjs +++ b/tools/withserver.mjs @@ -1,4 +1,4 @@ -// Isolated server for the Node harnesses (ported from prototype-server-vision/tools/withserver.sh). +// Isolated server for the Node harnesses (ported from docs/archive/prototypes/server-vision/tools/withserver.sh). // Own state dir, own port, never a live session: the server is the real binary, built from the // working tree, and its stdout/stderr land in /server.log so a check can grep them. import { spawn, spawnSync } from 'node:child_process'