MVP Factory Board: server — FLOOR_REPLAY replay mode #241

Closed
opened 2026-10-15 16:58:05 +00:00 by matou-build-agent · 2 comments

Part of the MVP Factory Board pipeline (#234 scope, this ticket's spec in #235).

Priority tonight: worked ahead of the general queue this evening for Ben's morning test (NZ). Depends on BT-1 (replay serves the v5 fixture).

What

Add replay mode to the floor server (area: 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.

  • fleet-tui/floor/server/server.js: when FLOOR_REPLAY names a readable JSON file, the server does not spawn the collector. It reads the file, runs it through parseLine (a version-skewed/malformed fixture is refused loudly, exactly as a live line would be), sets it as lastText, and broadcasts to every client on connect. Optional re-read on FLOOR_REPLAY_INTERVAL_MS (default off). Static serving + Origin allowlist unchanged. Log a startup line naming the replayed file so the operator sees the collector was skipped.
  • fleet-tui/floor/run.sh: document FLOOR_REPLAY (and FLOOR_REPLAY_INTERVAL_MS) in the header. The var already flows through the exec env — the change is the doc line + the server-side handling.
  • Factor the replay-load into a pure helper (e.g. loadReplay(text) in protocol.js or a sibling) so it is unit-testable with no live socket.

Test (red first)

fleet-tui/floor/server/replay.test.js (new, node --test): replay reads the named file and sets lastText, replay refuses a version-skewed fixture (parseLine reject, no broadcast), replay does not spawn the collector, absent/unreadable FLOOR_REPLAY is a loud startup error.
Run: node --test fleet-tui/floor/server/replay.test.js.

Acceptance

  • FLOOR_REPLAY=<file> serves that snapshot without spawning the collector; a bad/version-skewed file is refused loudly, not broadcast.
  • run.sh documents the variable; a startup log names the replayed file.
  • Named tests green; close-report includes FLOOR_REPLAY=fleet-tui/floor/server/fixtures/snapshot.json ./fleet-tui/floor/run.sh as the manual check and the node --test command + pass line.

out_of_scope

No collector change; no board page/painter; no tui/**; no writes. Touch STATUS.md with one short header line only + journal (hazard #230). fleet-tui/** vendor-excluded — no re-vendor.

Advances #235.

Part of the MVP Factory Board pipeline (#234 scope, this ticket's spec in #235). **Priority tonight:** worked ahead of the general queue this evening for Ben's morning test (NZ). Depends on BT-1 (replay serves the v5 fixture). ## What Add **replay mode** to the floor server (area: **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. - `fleet-tui/floor/server/server.js`: when `FLOOR_REPLAY` names a readable JSON file, the server **does not spawn the collector**. It reads the file, runs it through `parseLine` (a version-skewed/malformed fixture is refused loudly, exactly as a live line would be), sets it as `lastText`, and broadcasts to every client on connect. Optional re-read on `FLOOR_REPLAY_INTERVAL_MS` (default off). Static serving + Origin allowlist unchanged. Log a startup line naming the replayed file so the operator sees the collector was skipped. - `fleet-tui/floor/run.sh`: document `FLOOR_REPLAY` (and `FLOOR_REPLAY_INTERVAL_MS`) in the header. The var already flows through the `exec` env — the change is the doc line + the server-side handling. - Factor the replay-load into a pure helper (e.g. `loadReplay(text)` in `protocol.js` or a sibling) so it is unit-testable with no live socket. ## Test (red first) `fleet-tui/floor/server/replay.test.js` (new, `node --test`): `replay reads the named file and sets lastText`, `replay refuses a version-skewed fixture (parseLine reject, no broadcast)`, `replay does not spawn the collector`, `absent/unreadable FLOOR_REPLAY is a loud startup error`. Run: `node --test fleet-tui/floor/server/replay.test.js`. ## Acceptance - `FLOOR_REPLAY=<file>` serves that snapshot without spawning the collector; a bad/version-skewed file is refused loudly, not broadcast. - `run.sh` documents the variable; a startup log names the replayed file. - Named tests green; close-report includes `FLOOR_REPLAY=fleet-tui/floor/server/fixtures/snapshot.json ./fleet-tui/floor/run.sh` as the manual check and the `node --test` command + pass line. ## out_of_scope No collector change; no board page/painter; no `tui/**`; no writes. Touch `STATUS.md` with **one short header line only** + journal (hazard #230). `fleet-tui/**` vendor-excluded — no re-vendor. Advances #235.
Author
Member

close-report for #241 — status success

✅ close-report gates passed — every claim verified against the PR head. PR #247 (#247) is open and green; a human merges it and the merge closes this issue via closes #241 (MERGE_AUTHORITY=human).

envelope
{
  "issue": 241,
  "status": "success",
  "commits": [
    "1c1f13ab2f3d3fb78d8dc12677c09065c4017b48"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/journal/2026-10-16-241.md",
    "fleet-tui/floor/run.sh",
    "fleet-tui/floor/server/protocol.js",
    "fleet-tui/floor/server/replay.js",
    "fleet-tui/floor/server/replay.test.js",
    "fleet-tui/floor/server/server.js"
  ],
  "tests": [
    {
      "command": "node --test fleet-tui/floor/server/replay.test.js",
      "exit_code": 0
    },
    {
      "command": "node --test fleet-tui/floor/server/protocol.test.js",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL $t; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "FLOOR_REPLAY=<file> serves that snapshot without spawning the collector": "server.js serveReplay/startSources (fleet-tui/floor/server/server.js, replay.js); manual check FLOOR_REPLAY=...snapshot.json served HTTP 200 with startup log 'REPLAY mode — serving <file>; collector NOT spawned'; test 'replay does not spawn the collector' in replay.test.js",
    "a bad/version-skewed file is refused loudly, not broadcast": "applyReplay throws + process.exit(1) on refusal (replay.js, server.js); tests 'replay refuses a version-skewed fixture (parseLine reject, no broadcast)' and 'replay also refuses an unparseable (malformed) fixture'; manual check missing file exited 1 loudly",
    "run.sh documents the variable": "fleet-tui/floor/run.sh header documents FLOOR_REPLAY + FLOOR_REPLAY_INTERVAL_MS",
    "a startup log names the replayed file": "server.js startSources logs 'floor: REPLAY mode — serving <file>; collector NOT spawned' (verified in manual smoke test)",
    "replay-load factored into a pure helper": "loadReplay(text) added to fleet-tui/floor/server/protocol.js; file/source wiring in new fleet-tui/floor/server/replay.js",
    "named tests green (node --test)": "node --test fleet-tui/floor/server/replay.test.js => pass 6 / fail 0; the four named cases present plus malformed + env-reader coverage",
    "STATUS.md one short header line + journal (hazard #230)": "STATUS.md gained one short #241 header line; docs/journal/2026-10-16-241.md added in same commit; docs-budget-test green"
  },
  "summary": "Added FLOOR_REPLAY replay mode to the floor server (pure loadReplay + replay.js wiring, server.js/run.sh, replay.test.js) so the board runs with no collector, ssh, or forge.",
  "blockers": []
}
**close-report** for #241 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the PR head. PR #247 (https://git.matou.nz/Matou/dev-factory/pulls/247) is open and green; a human merges it and the merge closes this issue via `closes #241` (MERGE_AUTHORITY=human). <details><summary>envelope</summary> ```json { "issue": 241, "status": "success", "commits": [ "1c1f13ab2f3d3fb78d8dc12677c09065c4017b48" ], "changed_files": [ "STATUS.md", "docs/journal/2026-10-16-241.md", "fleet-tui/floor/run.sh", "fleet-tui/floor/server/protocol.js", "fleet-tui/floor/server/replay.js", "fleet-tui/floor/server/replay.test.js", "fleet-tui/floor/server/server.js" ], "tests": [ { "command": "node --test fleet-tui/floor/server/replay.test.js", "exit_code": 0 }, { "command": "node --test fleet-tui/floor/server/protocol.test.js", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL $t; done", "exit_code": 0 } ], "criteria": { "FLOOR_REPLAY=<file> serves that snapshot without spawning the collector": "server.js serveReplay/startSources (fleet-tui/floor/server/server.js, replay.js); manual check FLOOR_REPLAY=...snapshot.json served HTTP 200 with startup log 'REPLAY mode — serving <file>; collector NOT spawned'; test 'replay does not spawn the collector' in replay.test.js", "a bad/version-skewed file is refused loudly, not broadcast": "applyReplay throws + process.exit(1) on refusal (replay.js, server.js); tests 'replay refuses a version-skewed fixture (parseLine reject, no broadcast)' and 'replay also refuses an unparseable (malformed) fixture'; manual check missing file exited 1 loudly", "run.sh documents the variable": "fleet-tui/floor/run.sh header documents FLOOR_REPLAY + FLOOR_REPLAY_INTERVAL_MS", "a startup log names the replayed file": "server.js startSources logs 'floor: REPLAY mode — serving <file>; collector NOT spawned' (verified in manual smoke test)", "replay-load factored into a pure helper": "loadReplay(text) added to fleet-tui/floor/server/protocol.js; file/source wiring in new fleet-tui/floor/server/replay.js", "named tests green (node --test)": "node --test fleet-tui/floor/server/replay.test.js => pass 6 / fail 0; the four named cases present plus malformed + env-reader coverage", "STATUS.md one short header line + journal (hazard #230)": "STATUS.md gained one short #241 header line; docs/journal/2026-10-16-241.md added in same commit; docs-budget-test green" }, "summary": "Added FLOOR_REPLAY replay mode to the floor server (pure loadReplay + replay.js wiring, server.js/run.sh, replay.test.js) so the board runs with no collector, ssh, or forge.", "blockers": [] } ``` </details>
Owner

Landed on main as 32cd7b7 (rebase of PR #247's 1c1f13ab, 2026-10-17, by Ben's session). PR #247 is superseded and closed unmerged. Verification on the rebased commit: node --test fleet-tui/floor/server/replay.test.js 6/6 (board 14/14, protocol 11/11 alongside); tests/docs-budget-test.sh 4/4 after trimming the STATUS.md header. Closing by hand — the closes #241 body on PR #247 never fires because that PR is not merged.

Landed on `main` as `32cd7b7` (rebase of PR #247's `1c1f13ab`, 2026-10-17, by Ben's session). PR #247 is superseded and closed unmerged. Verification on the rebased commit: `node --test fleet-tui/floor/server/replay.test.js` 6/6 (board 14/14, protocol 11/11 alongside); `tests/docs-budget-test.sh` 4/4 after trimming the STATUS.md header. Closing by hand — the `closes #241` body on PR #247 never fires because that PR is not merged.
ben closed this issue 2026-10-17 05:04:02 +00:00
Sign in to join this conversation.
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.

Reference
Matou/dev-factory#241
No description provided.