feat(core): wire sendRoomMessage's opt-in durable-recording flag - #137
Merged
Merged
Conversation
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.
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 PR is included in version 2.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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 an optional durable parameter to sendRoomMessage; 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.
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, not two independent ones. bridge-mesh.ts constructs it once via createNodeFsStorage(oplogDirFor(slot)) and wires it to both the transport and the store's own identity.
This closes out the two pieces #50's own tracking called "genuinely open" after #136 -- the opt-in send-path mechanism is now real, and the storage-construction half of the catch-up policy (where MeshStore's own KeyValueStorage instance actually lives) is wired end to end. What's still deliberately not built: proactively calling sendDataFrame with an initial data-have after a durable append, and deciding which peers' logs to track for catch-up -- genuine per-deployment policy choices, not mechanical wiring, and each is small enough to add later without touching anything landed here.
Tested with real identities and a real minted token throughout (recordRoomSendNotice genuinely mints and signs, so an opaque placeholder token fails outright) -- the durable-send test decodes the stored bytes back out and runs them through a real verifyRoomNotice, not just checking the append succeeded.
Refs #50.