@mrciphersmith/roomyx 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,46 @@ patch and never a minor. The rule, the reason, and an audit of the four of seven
13
13
  releases that followed it are in
14
14
  [`docs/roomyx/versioning.md`](docs/roomyx/versioning.md) and decision D-13.
15
15
 
16
+ ## [0.6.2] — 2026-09-10
17
+
18
+ A patch: two reader fixes a fuzzer found, and three testing harnesses. Nothing
19
+ removed, no default changed — `^0.6.0` gets it automatically.
20
+
21
+ ### Fixed
22
+
23
+ - **A log line that is not valid JSON now says which file and which line.** It
24
+ threw a bare `SyntaxError: Unexpected token` — no path, no line number — from
25
+ inside the one function whose purpose is to say
26
+ `Invalid "message" line 12 in /path/room.jsonl`. Found by fuzzing: of two
27
+ thousand damaged logs, every unparseable one refused without naming what it
28
+ had refused.
29
+ - **A byte-order mark no longer makes a room unreadable.** Editors add one, it
30
+ is not part of the JSON, and it made the first line unparseable — which meant
31
+ the whole room.
32
+
33
+ ### Added
34
+
35
+ - **`bun run soak`** — a soak harness. The three worst defects this project
36
+ shipped were functions of volume over time and invisible to a unit test by
37
+ construction. It compresses the clock by poll count rather than wall time, so
38
+ an hour of a live room costs a minute, and asserts trends rather than
39
+ thresholds.
40
+ - **`bun scripts/fuzz-log.ts`** — fuzzes the log reader, which is the single
41
+ funnel all three read tools go through. Asserts that it terminates, that every
42
+ refusal names the file and the line, and that anything the writer accepts the
43
+ reader loads.
44
+ - **`bun scripts/replay.ts <room.jsonl>`** — replays a real recorded room
45
+ through the real view at several widths and checks what reached the screen.
46
+ The rendering defects that shipped were all content-dependent and every one
47
+ survived a suite whose fixtures are three short ASCII messages.
48
+
49
+ ### Known
50
+
51
+ - The wrap defect is **not synthetic**. Replaying a real nine-message room at
52
+ width 80 — the most ordinary terminal width there is — loses the final letter
53
+ of `continuation` every time; at 60, 100 and 140 it is intact. Still not
54
+ worked around, for the reason recorded in `test/client/wrap-defect.test.ts`.
55
+
16
56
  ## [0.6.1] — 2026-09-10
17
57
 
18
58
  **A patch, and the first release numbered by the rule rather than by feel.**
package/README.md CHANGED
@@ -334,3 +334,28 @@ Full architecture and the reasoning behind each decision:
334
334
  ## License
335
335
 
336
336
  MIT
337
+
338
+ ## Soak testing
339
+
340
+ ```bash
341
+ bun run soak # ~2 min, about 3 hours of a live room
342
+ bun scripts/soak.ts --polls 20000 # ~7 min, about a working day
343
+ ```
344
+
345
+ The three worst defects this project has shipped were invisible to a unit test
346
+ by construction: an idle client that exhausted the native renderable pool after
347
+ about 2.7 hours, a server that retained every session it ever accepted, and one
348
+ malformed log line that took a client from one connection to 510 in ten seconds.
349
+ Each is a function of volume over time, and the suite's longest test runs forty
350
+ seconds and asserts a state.
351
+
352
+ `scripts/soak.ts` compresses the clock by poll count rather than by wall time —
353
+ the 2.7-hour death is 3275 state polls, which at a 20 ms interval is sixty-five
354
+ seconds — and drives a real `ChatView` and a real `RoomClient` against a real
355
+ `roomyx serve`, through a proxy that counts every request. It reports **trends**,
356
+ not thresholds: a threshold has to be guessed and is wrong on someone else's
357
+ machine, while "the renderable count grew with the transcript and not with the
358
+ poll loop" is true or false everywhere.
359
+
360
+ It is not in `bun test` on purpose. It takes minutes, and a suite people skip is
361
+ worse than one they run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "MCP server + terminal UI for startup-room: live room status, chat, per-agent modal, an installable room registry, and skill-sync.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -37,7 +37,10 @@
37
37
  "test": "bun test",
38
38
  "typecheck": "tsc --noEmit",
39
39
  "lint": "eslint src test",
40
- "check": "bun run lint && bun run typecheck && bun test"
40
+ "check": "bun run lint && bun run typecheck && bun test",
41
+ "soak": "bun scripts/soak.ts",
42
+ "fuzz": "bun scripts/fuzz-log.ts",
43
+ "replay": "bun scripts/replay.ts"
41
44
  },
42
45
  "dependencies": {
43
46
  "@modelcontextprotocol/sdk": "^1.25.0",
package/src/log/store.ts CHANGED
@@ -2,13 +2,32 @@ import { readFileSync } from "node:fs";
2
2
  import { messageLineSchema, stateLineSchema } from "./schema";
3
3
  import type { AgentDetail, MessageEnvelope, RoomState, RosterEntry } from "./types";
4
4
 
5
+ /**
6
+ * `JSON.parse`, with the one thing it never says: where.
7
+ *
8
+ * A line that is not valid JSON used to throw a bare `SyntaxError: Unexpected
9
+ * token` — no path, no line number — from inside a function whose whole purpose
10
+ * is to say `Invalid "message" line 12 in /path/room.jsonl`. Found by fuzzing:
11
+ * of two thousand damaged logs, every unparseable one refused without naming
12
+ * the file it had refused.
13
+ */
14
+ function parseLine(text: string, describe: () => string): unknown {
15
+ try {
16
+ return JSON.parse(text);
17
+ } catch (error) {
18
+ throw new Error(`${describe()}: not valid JSON — ${error instanceof Error ? error.message : String(error)}`);
19
+ }
20
+ }
21
+
5
22
  /**
6
23
  * Reads the room log (see roomyx/README.md for the on-disk format) without
7
24
  * ever writing to it. The first line is the state header; every following
8
25
  * line is a message.
9
26
  */
10
27
  export function loadRoomLog(path: string): { state: RoomState; messages: MessageEnvelope[] } {
11
- const raw = readFileSync(path, "utf8");
28
+ // Editors add a byte-order mark; it is not part of the JSON and it made the
29
+ // first line unparseable, which made the whole room unreadable.
30
+ const raw = readFileSync(path, "utf8").replace(/^\uFEFF/, "");
12
31
  const lines = raw.split("\n").filter((line) => line.trim().length > 0);
13
32
 
14
33
  if (lines.length === 0) {
@@ -16,7 +35,9 @@ export function loadRoomLog(path: string): { state: RoomState; messages: Message
16
35
  }
17
36
 
18
37
  const [headerLine, ...rest] = lines as [string, ...string[]];
19
- const headerResult = stateLineSchema.safeParse(JSON.parse(headerLine));
38
+ const headerResult = stateLineSchema.safeParse(
39
+ parseLine(headerLine, () => `Room log at ${path} must start with a valid "state" line`),
40
+ );
20
41
  if (!headerResult.success) {
21
42
  throw new Error(
22
43
  `Room log at ${path} must start with a valid "state" line: ${headerResult.error.message}`,
@@ -31,7 +52,9 @@ export function loadRoomLog(path: string): { state: RoomState; messages: Message
31
52
  };
32
53
 
33
54
  const messages: MessageEnvelope[] = rest.map((line, index) => {
34
- const result = messageLineSchema.safeParse(JSON.parse(line));
55
+ const result = messageLineSchema.safeParse(
56
+ parseLine(line, () => `Invalid "message" line ${index + 2} in ${path}`),
57
+ );
35
58
  if (!result.success) {
36
59
  // +2: 1-indexed lines, plus the header line already consumed.
37
60
  throw new Error(`Invalid "message" line ${index + 2} in ${path}: ${result.error.message}`);