Skip to content

feat(core): record a room.send as a durable room-notice in the sender's own oplog - #135

Merged
Mearman merged 1 commit into
mainfrom
feat/room-notice-on-send
Sep 16, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/room-notice-on-send

Conversation

@Mearman

@Mearman Mearman commented Sep 16, 2026

Copy link
Copy Markdown
Member

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.

…'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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-16T02:31:13.008341Z 3362289 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 090af14 into main Sep 16, 2026
6 checks passed
@Mearman
Mearman deleted the feat/room-notice-on-send branch September 16, 2026 02:31
@github-actions

Copy link
Copy Markdown

🎉 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant