Skip to content

feat(core): retire the last two mesh-wide broadcast sites for directed room.notify - #142

Merged
Mearman merged 1 commit into
mainfrom
feat/directed-federation-notify
Sep 16, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/directed-federation-notify

Conversation

@Mearman

@Mearman Mearman commented Sep 16, 2026

Copy link
Copy Markdown
Member

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 own onRoomMessage local fan-out (delivering a message that arrived over a federation link to every local room member) and room-lifecycle.ts's own post-join room_members delivery (to the joining agent, who per its own doc comment about convergence/admin bookkeeping can be remote) both used to ride the legacy mesh-wide broadcastPatch.

onRoomMessage now calls a new DeliveryEngine.deliverRoomMessageToMember, which emits a delivered receipt back to the message's sender and delivers via deliverToMember, explicitly skipping fed:-prefixed shadow members -- they represent a remote federation participant with no addressable mesh device of their own, so federation.ts's own link forwarding is what actually reaches them, not this local fan-out. Confirmed via the existing fed:-prefix filtering convention already used elsewhere in the same file (getFederatedRoomMemberships).

joinRoom's own room_members delivery now calls deliverToMember directly with the room's own path -- made public on DeliveryEngine since this is the second external collaborator (after RoomLifecycle) 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 once joinRoom's own new directed room.notify also 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

  • New RED tests confirmed failing for the right reason before implementation
  • pnpm typecheck
  • pnpm lint
  • pnpm test (795/795)
  • pnpm build

…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
Mearman marked this pull request as ready for review September 16, 2026 04:42
@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-16T04:49:33.746677Z fa66b70 Draft marked ready
ℹ️ 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 ffd60b8 into main Sep 16, 2026
6 checks passed
@Mearman
Mearman deleted the feat/directed-federation-notify branch September 16, 2026 04:49
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.31.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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