feat(core): retire the last two mesh-wide broadcast sites for directed room.notify - #142
Merged
Merged
Conversation
…d room.notify federation-bridge.ts's own onRoomMessage local fan-out and room-lifecycle.ts's own post-join room_members delivery both used to ride deliverLocallyAndBroadcast's legacy broadcastPatch. Both now send via DeliveryEngine's own directed primitives instead. onRoomMessage gains a new DeliveryEngine.deliverRoomMessageToMember, which emits a delivered receipt back to the message's sender and delivers via deliverToMember, skipping fed:-prefixed shadow members entirely -- they have no addressable mesh device of their own, and federation.ts's own link forwarding already reaches the real remote participant. joinRoom's own room_members delivery to the joining agent (who can be remote, per its own doc comment about convergence/admin bookkeeping) now calls deliverToMember directly with the room's own path, which is made public on DeliveryEngine for this and any future collaborator that already knows the exact member and room-path to address. room-send-retry-queue.test.ts's own retry-count assertion is updated to count only the "hello" message's own retries rather than the bare total: a join's own room_members notification to a not-yet-connected member is now a real, legitimately-queued directed send of its own, alongside whatever the test is actually retrying.
Mearman
marked this pull request as ready for review
September 16, 2026 04:42
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.31.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.
Part of #48. Closes out the deliverLocallyAndBroadcast retirement started across the two prior PRs in this series -- every remaining call site is converted.
federation-bridge.ts's ownonRoomMessagelocal fan-out (delivering a message that arrived over a federation link to every local room member) androom-lifecycle.ts's own post-joinroom_membersdelivery (to the joining agent, who per its own doc comment about convergence/admin bookkeeping can be remote) both used to ride the legacy mesh-widebroadcastPatch.onRoomMessagenow calls a newDeliveryEngine.deliverRoomMessageToMember, which emits a delivered receipt back to the message's sender and delivers viadeliverToMember, explicitly skippingfed:-prefixed shadow members -- they represent a remote federation participant with no addressable mesh device of their own, sofederation.ts's own link forwarding is what actually reaches them, not this local fan-out. Confirmed via the existingfed:-prefix filtering convention already used elsewhere in the same file (getFederatedRoomMemberships).joinRoom's ownroom_membersdelivery now callsdeliverToMemberdirectly with the room's own path -- made public onDeliveryEnginesince this is the second external collaborator (afterRoomLifecycle) that already knows the exact member and room-path to address.Found and fixed a real regression while verifying:
room-send-retry-queue.test.ts's first test asserted an exact total retry count (attempts.length === 2), which broke oncejoinRoom's own new directedroom.notifyalso became a real, independently-queued retry for the same not-yet-connected member -- both entries replay on reconnect, so the real count jumps straight to 3 and the exact-equality check never holds. Fixed by asserting on the "hello" message's own retry count specifically, which is what the test actually cares about, rather than a brittle total that assumes nothing else is ever queued for the same member. Confirmed against main (clean, 409ms) vs this branch pre-fix (hangs to the full 20s timeout) before diagnosing, and verified the root cause directly via temporary tracing rather than guessing.Test plan
pnpm typecheckpnpm lintpnpm test(795/795)pnpm build