feat(core): record a room.send as a durable room-notice in the sender's own oplog - #135
Merged
Merged
Conversation
…'s own oplog recordRoomSendNotice mints a self-certifying room-notice for a room.send via wire-mesh-core's createRoomNotice, CBOR-encodes it (cbor2's own deterministic-encoding preset, matching handshake.ts's established convention), and appends it to the sender's own oplog via appendOwnEntry. Round-trip fidelity is the critical property here -- tested by decoding the stored bytes back and running them through a real verifyRoomNotice, not just checking the append succeeded. Deliberately not wired into sendRoomMessage's own default path: a caller decides per-message whether durability is worth the extra local write, matching the design's own "delivery and durable catch-up are the same artifact, opt-in per message" principle. Wiring this into a bridge's own send path, and the actual catch-up policy (when to send data-have, which peers' logs to track), stay their own separate, still-open piece. identity-store.ts gains oplogDirFor(slot), a sibling directory of the identity file mirroring its own per-(harness, cwd) naming convention -- the storage location a caller would back recordRoomSendNotice's KeyValueStorage dependency with via createNodeFsStorage.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Sep 16, 2026
|
🎉 This PR is included in version 2.25.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Mearman
added a commit
that referenced
this pull request
Sep 16, 2026
sendRoomMessage gains an optional durable parameter; when true, it also records the message as a room-notice in the sender's own oplog via recordRoomSendNotice (#135), alongside the existing wire- authenticated fan-out. Deliberately opt-in per call, not automatic -- a caller decides per message whether it should be catch-up-able, matching this codebase's own established design for the mechanism. MeshStoreIdentity gains a dataStorage field (a KeyValueStorage instance), the same one WireMeshTransport's own frame responder (#136) reads and writes, so a durable send and a peer's later data-request against this device's log operate on one shared oplog. bridge-mesh.ts constructs it once via createNodeFsStorage(oplogDirFor(slot)) and wires it to both the transport and the store's own identity. Every existing fake MeshStoreIdentity fixture across the test suite needed the new required field added -- an opaque placeholder for the many tests that never exercise durable sends, a real in-memory KeyValueStorage for the ones (room-messaging-durable-send.test.ts, test-transport.ts's shared harness) that do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds recordRoomSendNotice: mints a self-certifying room-notice for a room.send via wire-mesh-core's createRoomNotice, CBOR-encodes it (cbor2's own deterministic-encoding preset, matching handshake.ts's established convention), and appends it to the sender's own oplog via appendOwnEntry. Both new primitives only actually became consumable after #133/#134 caught up agent-comms' own wire-mesh-core pin and fixed wire-mesh's own publishing gap for them.
Round-trip fidelity is the property that actually matters here, so that's what's tested -- decoding the stored bytes back out and running them through a real verifyRoomNotice, not just checking the append call succeeded. Confirmed the test can actually fail (flipped a byte in the encoded output, watched it fail for the right reason, reverted) before trusting the green run.
Deliberately not wired into sendRoomMessage's own default path: a caller decides per-message whether durability is worth the extra local write, matching #50's own design note that recording is "opt-in per message, not automatic." Wiring this into a bridge's own send path, and the actual catch-up policy (when to send data-have, which peers' logs to track, when to actually invoke this), stay their own separate, still-open piece.
Also adds identity-store.ts's oplogDirFor(slot) -- a sibling directory of the identity file, mirroring its own per-(harness, cwd) naming convention, for whoever wires this up to back the KeyValueStorage dependency with createNodeFsStorage.
Refs #50.