Skip to content

Commit every message on one serial queue, under a key - #50

Merged
andreisavu merged 1 commit into
mainfrom
claude/pr2-serial-commit-queue
Sep 9, 2026
Merged

Commit every message on one serial queue, under a key#50
andreisavu merged 1 commit into
mainfrom
claude/pr2-serial-commit-queue

Conversation

@andreisavu

Copy link
Copy Markdown
Contributor

PR 2 of the stack that SPLIT_PLAN.md on #48 cuts from that branch. Branches from main after #49.

The one idea

The record becomes a log, and every message commits on one serial queue.

  • log/log.ts replaces record.ts. RoomLog.commit runs the key check, the readThrough check, the append and the cache update inside one link of a promise chain, and what the room does with a fresh message runs there too, before the next commit starts. A message exists when its write is confirmed: a write that fails leaves nothing on the record, nothing on the stream, and wakes nobody. A repeated key hands back the message the first commit landed. Rule 5 is enforced where the write happens.
  • Keys. A seat's say and the assistant's two tools take Pi's tool call id as the key; deliver({ key }) takes the key the host passes, or a fresh one. Message gains key.
  • The composition is checked against the replayed record, so a name the record knows as a person is refused at the first call, and a visit is checked after the replay.
  • The entries on the storage do not change: messages only. Logs written before this PR resume unchanged.

The tests that pin it

  • test/log.test.ts: a repeated key lands once and returns the first message; of two commits under one readThrough, one lands and the other is refused with what it missed and consumes no seq; a message is invisible until its write resolves; a commit whose write fails leaves nothing, and the next one takes its seq.
  • test/session.test.ts: the new cases on deliver with a key and on a failed write.
  • test/presence.test.ts: reworked onto the queue, same claims.
  • The invariants now check that every key names one message.

Extract

git cherry-pick -x 0f44d6c on #49, with the path change to log/log.ts. Two conflicts, both against #49's layout: the import block in session.ts and the layering sentence in agent.md. Two additions the plan did not list: the simple faultyOpener returns to test/support/storage.ts because the fourth log test needs it (#49 had dropped it; PR 6 replaces it with the tapped version), and the layer table in docs/toolchain.md §1 gains the log/ row.

What a later PR adds on top

  • PR 4: the close and composition entry kinds, Row, RowData and write().
  • PR 5: the lease entry kind.
  • PR 6: the doubt path, cursor, known, found, the "in doubt" tests.
  • PR 12: the checkpoint entry kind and compact.

Checks

pnpm format && pnpm check is green, 120 tests. Every doc link resolves. The build's three TS4023 lines from test/live/support.ts are on main too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SJjjR3S6iwqEbDXsRDJgiq


Generated by Claude Code

The record becomes a log. log/log.ts replaces record.ts. RoomLog.commit
runs the key check, the readThrough check, the append and the cache
update inside one link of a promise chain, and what the room does with a
fresh message runs there too. A message exists when its write is
confirmed: a write that fails leaves nothing on the record, nothing on
the stream, and wakes nobody. A repeated key hands back the message the
first commit landed. The entries on the storage do not change: messages
only.

A seat's say and the assistant's two tools take Pi's tool call id as
the key; a delivery takes the key the host passes, or a fresh one. The
composition is checked against the replayed record, so a name the record
knows as a person is refused at the first call, and a visit is checked
after the replay.

The test storage regains the faulty opener, which the log's fourth test
needs. The layer table gains the log/ row.

This is PR 2 of the stack SPLIT_PLAN.md cuts from #48. It carries
0f44d6c from that branch, with the path change to log/log.ts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJjjR3S6iwqEbDXsRDJgiq
@andreisavu
andreisavu merged commit cb00740 into main Sep 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants