MVP Factory Board: server FLOOR_REPLAY replay mode (#241) #247

Closed
matou-build-agent wants to merge 1 commit from agent/issue-241 into main

closes #241

What

Adds replay mode to the floor server (area: server) so the MVP Factory
Board — and the #236 morning verification — is exercisable on any machine, in
CI, with no ssh door and no reachable forge (decisive for the #191
forge-unreachable host). When FLOOR_REPLAY names a readable JSON snapshot
file, the server serves that snapshot and does not spawn the collector; a
malformed or version-skewed file is refused loudly (non-zero exit), never
broadcast.

Changes

  • fleet-tui/floor/server/protocol.js — new pure loadReplay(text) (parse +
    validate, transport/filesystem-free), reusing parseLine so a replay file is
    refused exactly as a live collector line is.
  • fleet-tui/floor/server/replay.js (new) — thin filesystem + source-selection
    layer: replayFileFrom / replayIntervalFrom env readers,
    applyReplay(file, {read, onSnapshot}) (throws loudly on
    absent/unreadable/refused, never calls the sink), and
    startSources(env, {serveReplay, startCollector}) choosing replay vs collector.
  • fleet-tui/floor/server/server.js — listen callback calls startSources;
    replay logs REPLAY mode — serving <file>; collector NOT spawned, exits
    non-zero on a bad file, honours optional FLOOR_REPLAY_INTERVAL_MS (re-read
    that logs-but-keeps-last-good on a later failure). Static serving + Origin
    allowlist unchanged.
  • fleet-tui/floor/run.sh — header documents FLOOR_REPLAY and
    FLOOR_REPLAY_INTERVAL_MS.

Tests

  • New fleet-tui/floor/server/replay.test.js (node --test): reads the file
    and sets lastText; refuses a version-skewed fixture (parseLine reject, no
    broadcast); refuses a malformed fixture; does not spawn the collector
    (spy-asserted both modes); absent/unreadable is a loud startup error; env
    readers.
  • node --test fleet-tui/floor/server/replay.test.js → # pass 6 / # fail 0.
  • Full offline bash suite green.

Manual check

FLOOR_REPLAY=fleet-tui/floor/server/fixtures/snapshot.json ./fleet-tui/floor/run.sh

serves on localhost (HTTP 200); startup log names the replayed file and
collector NOT spawned; a missing FLOOR_REPLAY file exits 1 loudly.

Screenshots: none — server-only ticket (no board page/painter in scope, per
out_of_scope); the visible surface is the startup log + HTTP 200, captured in
the manual check above and asserted by replay.test.js.

Advances #235.

closes #241 ## What Adds **replay mode** to the floor server (area: **server**) so the MVP Factory Board — and the #236 morning verification — is exercisable on any machine, in CI, with **no ssh door and no reachable forge** (decisive for the #191 forge-unreachable host). When `FLOOR_REPLAY` names a readable JSON snapshot file, the server serves that snapshot and does **not** spawn the collector; a malformed or version-skewed file is refused loudly (non-zero exit), never broadcast. ## Changes - `fleet-tui/floor/server/protocol.js` — new pure `loadReplay(text)` (parse + validate, transport/filesystem-free), reusing `parseLine` so a replay file is refused exactly as a live collector line is. - `fleet-tui/floor/server/replay.js` (new) — thin filesystem + source-selection layer: `replayFileFrom` / `replayIntervalFrom` env readers, `applyReplay(file, {read, onSnapshot})` (throws loudly on absent/unreadable/refused, never calls the sink), and `startSources(env, {serveReplay, startCollector})` choosing replay vs collector. - `fleet-tui/floor/server/server.js` — `listen` callback calls `startSources`; replay logs `REPLAY mode — serving <file>; collector NOT spawned`, exits non-zero on a bad file, honours optional `FLOOR_REPLAY_INTERVAL_MS` (re-read that logs-but-keeps-last-good on a later failure). Static serving + Origin allowlist unchanged. - `fleet-tui/floor/run.sh` — header documents `FLOOR_REPLAY` and `FLOOR_REPLAY_INTERVAL_MS`. ## Tests - New `fleet-tui/floor/server/replay.test.js` (`node --test`): reads the file and sets `lastText`; refuses a version-skewed fixture (parseLine reject, no broadcast); refuses a malformed fixture; does not spawn the collector (spy-asserted both modes); absent/unreadable is a loud startup error; env readers. - `node --test fleet-tui/floor/server/replay.test.js` → `# pass 6 / # fail 0`. - Full offline bash suite green. ## Manual check ``` FLOOR_REPLAY=fleet-tui/floor/server/fixtures/snapshot.json ./fleet-tui/floor/run.sh ``` serves on localhost (HTTP 200); startup log names the replayed file and `collector NOT spawned`; a missing `FLOOR_REPLAY` file exits 1 loudly. **Screenshots:** none — server-only ticket (no board page/painter in scope, per `out_of_scope`); the visible surface is the startup log + HTTP 200, captured in the manual check above and asserted by `replay.test.js`. Advances #235.
sandcastle: #241 — MVP Factory Board: server FLOOR_REPLAY replay mode (advances #235)
All checks were successful
ci / test (pull_request) Successful in 5m16s
ci / static (pull_request) Successful in 2m30s
1c1f13ab2f
Add replay mode to the floor server so the board (and the #236 morning
verification) is exercisable on any machine, in CI, with no ssh door and no
reachable forge — decisive for the #191 forge-unreachable host.

Key decisions / files:
- protocol.js: new pure `loadReplay(text)` (parse+validate, transport/fs-free)
  reusing parseLine so a replay file is refused exactly as a live line is.
- replay.js (new): thin fs + source-selection layer — `replayFileFrom` /
  `replayIntervalFrom` env readers, `applyReplay(file,{read,onSnapshot})`
  (throws loudly on absent/unreadable/refused, never calls the sink), and
  `startSources(env,{serveReplay,startCollector})` picking replay vs collector.
- server.js: listen callback calls startSources; replay logs "REPLAY mode —
  serving <file>; collector NOT spawned", exits non-zero on a bad file, honours
  optional FLOOR_REPLAY_INTERVAL_MS (logs-but-keeps-last-good on later failure).
- run.sh: header documents FLOOR_REPLAY + FLOOR_REPLAY_INTERVAL_MS.
- replay.test.js (new, node --test): reads file/sets lastText, refuses
  version-skewed + malformed (no broadcast), does not spawn collector
  (spy-asserted both modes), absent/unreadable is a loud startup error.

No collector change, no board page/painter, no tui/**, no writes.
fleet-tui/** is vendor-excluded — no re-vendor. STATUS header + journal added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner

Superseded, close unmerged (Ben, 2026-10-17). This PR's commit 1c1f13ab was rebased onto main (only STATUS.md's header conflicted; header trimmed under the 2048-byte docs budget) and fast-forwarded as 32cd7b7 — now on main at a3c9f50. Tests re-run on the rebased commit: node --test board 14/14, protocol 11/11, replay 6/6; tests/docs-budget-test.sh 4/4. Nothing left to merge here; #241 is done by that commit.

Superseded, close unmerged (Ben, 2026-10-17). This PR's commit `1c1f13ab` was rebased onto `main` (only `STATUS.md`'s header conflicted; header trimmed under the 2048-byte docs budget) and fast-forwarded as `32cd7b7` — now on `main` at `a3c9f50`. Tests re-run on the rebased commit: `node --test` board 14/14, protocol 11/11, replay 6/6; `tests/docs-budget-test.sh` 4/4. Nothing left to merge here; #241 is done by that commit.
ben closed this pull request 2026-10-17 05:03:55 +00:00
All checks were successful
ci / test (pull_request) Successful in 5m16s
ci / static (pull_request) Successful in 2m30s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory!247
No description provided.