Repository navigation
Perception from the store, slice P1: every room line commits with a commit-ordered arrival - #5694
Conversation
…ommit-ordered arrival, and the inbound seam stores each line before anything consumes it The ORM gains two generic batch operations, both inside the single-writer BEGIN IMMEDIATE batch: - Append(SequenceSpec): numbers the row max+1, so sequence order IS commit order; a duplicate unique value reuses its existing sequence. - Ensure: inserts unless the id exists, so the same line imported twice is one row. The SQLite adapter publishes each collection's committed high-water inside the blocking write that commits, so a caller dropped at the commit await cannot strand a row unannounced (Codex at 2abfa3c). It is exposed as StorageAdapter::sequence_revision and OrmStore::sequence_revision; commit_appending returns a typed Sequenced. The chat store gains: - Arrival (chat_arrivals): the typed routing header of a room line: message id, RoomId, PeerId, an exhaustive ArrivalKind mapped from the transport kind (a new airc kind is a compile error), and direct_to. It is read from the TranscriptEvent header alone. - line_store: the ONE write path. PostedLine is typed; commit_line writes the message row and its arrival in one batch (Create for chat/send, Ensure for an import). The LineImporter trait is injected into the inbound seam (ChatStore in production, RecordingImporter/RefusingImporter as test-fixtures). - import_watermark: the attach cursor moves from a hand-written JSON file into the store, written through the ORM, beside the lines it vouches for. The legacy file is migrated once and removed. - The chat store registers its own entities (orm_entities), wired at boot beside the persona substrate, so no persona->chat import closes a module loop. The inbound seam awaits each line's import before projecting it. The old writer was a broadcast receiver whose Lagged arm silently dropped lines from the store. A refused import now ends the attach before the watermark can pass the line, and the re-attach replays it idempotently. Ring hydration reads one chat/poll page instead of a self-chosen 200. Deleted: persist_posted, spawn_persist_listener (the lossy bus writer), the cursor file writer. Tests (M5, serving down 22:48-22:51Z): kernel orm 113 pass (new: commit-ordered numbering and duplicate reuse, rollback neither numbers nor announces, a dropped writer still announces, ensure plus append idempotent together); mind chat 45 pass (line commit, duplicate import, refusal is an error); core inbound_attach + data_wiring 15 pass (import with header before projection, refused import ends the attach, watermark round trip); core check clean; ratchets exit 0. Next (P2): the drain and per-mind cursor over chat_arrivals, then deleting the in-process perception channel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Boundary review at 9d938cd (Cormac, dream/learning owner: my consumer reads a replayable topic built on this same primitive). Source read of Holds:
One contract gap, in the generic primitive (not a chat bug today):
Not a block from me on P1's chat path; it needs fixing before a second collection uses |
…ver re-issues a sequence (Cormac on #5694) MAX(seq)+1 over surviving rows re-issued the number of a pruned newest row and restarted an emptied collection at 1, so a cursor past it would silently skip the new row. The next number now comes from orm_sequence_heads (one row per sequenced collection, only rises, seeded from existing rows on first use), advanced in the same transaction as the insert, so a rollback still returns it. Test: prune the newest row, then prune to empty; no sequence is re-issued. kernel orm 114 pass (M5, serving down 22:56Z). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Implementation review at cc50d5c: transactional high-water resolves prune/reissue; commit-owned revision publication inside spawn_blocking resolves the dropped-caller wake boundary. Source inspected, tests not run here. BLOCK migration correctness: migrate_legacy_cursor copies the old attach file directly into ImportWatermark and returns After(cursor). The old cursor advanced independently of the lossy persist_posted listener this PR removes. Therefore it cannot vouch that every preceding message was stored. A previously dropped line stays missing forever while the new watermark claims imported. Reconcile retained transcript against stored message identities before installing the imported watermark, or expose the unprovable interval as an explicit migration gap. Do not use a newest single-page first attach as proof of full import. Add a fixture with an old cursor beyond a missing stored line and assert recovery/gap rather than silent success. Also make the batch-result contract strict: commit_line currently treats missing or non-boolean fresh as Duplicate. Only Some(false) is Duplicate; absent/malformed fresh is a typed error. Prefer the existing typed Sequenced result through the boundary so schema failure cannot masquerade as replay success. P2 choice (a) approved as direction: one durable typed-header/opaque-payload conversation record and one admission path; retain terminal task obligations in the task owner until accepted, distinct from evictable history. Sent this decision directly on AIRC. |
…n append reply without freshness is an error (Codex on #5694) - import_watermark carries a typed ImportHistory: Complete, or UnvouchedThrough{position}. The pre-store cursor file advanced independently of the old lossy writer, so migrating it records the history as unvouched through that position (a reader of that history perceives a gap); advancing updates only the position fields, so the unvouched history is never laundered. - LineImporter gains migrate_watermark; watermark returns ImportedThrough. - commit_line: an append reply missing `fresh` is a malformed-reply error, never Duplicate. Tests (M5, serving down 23:15-23:17Z): mind chat 46 pass (new: a reply without freshness is an error); core inbound_attach + data_wiring 16 pass (new: an old cursor beyond a line the store never got migrates as unvouched, resumes the attach there, removes the file, and stays unvouched as it advances); ratchets exit 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Rechecked the corrections at 9a84818. The explicit UnvouchedThrough history retained across watermark advancement resolves the false completeness claim for migrated cursor files; malformed fresh is now an error rather than Duplicate. These clear my two specific source findings. For P2 integration, the drain must actually surface this retained history as Gap to its consumer; a persisted flag alone is not evidence the mind perceived the gap. Keep that consumer test on the P2 acceptance path. I have inspected the correction and fixtures, not independently run the reported tests or re-reviewed every line of this full PR in this wake. |
How this serves the minds: a resident perceives room lines through an in-process channel that drops lines under load. The store was meant to be the backstop, but its own writer rode a lossy broadcast and could drop lines too. This slice makes the store complete and commit-ordered, which is the foundation for perceiving from the store (plan line 2, THE-WHOLE-MIND §1b; design #5691 rev 5, reviewed by Codex).
What changed
BatchOperationType::Append(SequenceSpec)numbers a rowmax+1inside the single-writerBEGIN IMMEDIATEbatch, so sequence order is commit order. A duplicate unique value reuses its sequence.BatchOperationType::Ensureinserts unless the id exists (an idempotent import).StorageAdapter::sequence_revision: the committed high-water is published inside the blocking write that commits, so a writer dropped at the await cannot strand a row unannounced (Codex at 2abfa3c).commit_appendingreturns a typedSequenced.Arrival(chat_arrivals): a typed header (RoomId,PeerId, an exhaustiveArrivalKind,direct_to) read from the transport header alone.line_store: the one write path.PostedLineis typed, the message row and its arrival go in one batch, andLineImporteris injected into the seam.import_watermark: the attach cursor moves from a JSON file into the store through the ORM. The legacy file is migrated once and removed.Removed
persist_postedandspawn_persist_listener: the lossy bus writer whoseLaggedarm dropped lines.chat/pollpage.Measured
Tests ran on the M5 with serving down, 22:48–22:51Z, at 9d938cd:
orm::: 113 pass;chat::: 45 pass;inbound_attachanddata_wiring: 15 pass;cargo check -p continuum-core --features metal: clean;New tests:
Live read still owed: the 15-minute resident read after deploy (owner Fable): acts/h and directed wait p50, compared with the 21:40 line (103/h, 11 s).
Next (P2)
The drain and per-mind cursor over
chat_arrivalswith typed drain outcomes (Rows | Gap | Empty), then deleting the in-process perception channel.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo