feat(mesh-store): converge room membership as a per-agent element set - #34
Merged
Conversation
Wire-format groundwork for convergent membership merges: four records holding the room revision of each agent's latest join to and leave from the member and invited lists, with members and invited as derived views.
Room membership was merged by version-gated record replacement with a union on equal revisions, which protected concurrent joins of different agents but made a leave or kick racing a concurrent join converge with the joiner retained — a kicked agent stayed a member until the next room mutation resolved the tie. Membership is now a last-write-wins element set: each room carries the revision of every agent's latest join to and leave from the member and invited lists, an agent is in a list when their join strictly outranks their leave, and merges take the highest revision per agent per list. Joins of different agents are independent keys and never interact, and an exact join/leave tie resolves to out, so a kick racing a join converges with the kick honoured. The members and invited arrays become derived views refreshed after every mutation and merge, replacing the hand-maintained pushes and filters at each site. Scalar room fields keep the version gate; only membership switched to element merge, so renames and edits still heal through the higher version replacing the record. The FileStore maintains the same operation maps so its records stay shape-compatible.
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 1.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Sep 9, 2026
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.
Follow-up to #29, resolving the equal-version join/leave boundary documented on #27 properly instead of accepting it.
Membership was merged by version-gated replacement with a union on equal revisions — which protected concurrent joins of different agents but made a kick racing a concurrent join converge with the joiner retained until some later mutation resolved the tie. Membership is now a last-write-wins element set: each room carries the revision of every agent's latest join to and leave from the member and invited lists; an agent is in a list exactly when their join strictly outranks their leave; merges take the highest revision per agent per list.
Consequences:
membersandinvitedarrays become derived views, refreshed after every mutation and merge — the hand-maintained pushes and filters at each mutation site are gone, along with the tie-union special case in both merge paths.Scalar room fields keep the version gate from #29 (renames and edits still heal through wholesale replace); only membership switched to element merge. The FileStore maintains the same maps so its records stay shape-compatible.
Tests pin both concurrency outcomes — kick-beats-racing-join in both sync directions, and both-of-two-concurrent-joins surviving with identical member lists — alongside the existing convergence suite. 23 tests, three clean rounds, lint/typecheck/build green.