fix: don't publish membership on invite-accept, bundle with first message#109
Merged
fix: don't publish membership on invite-accept, bundle with first message#109
Conversation
…sage The member pruning logic (post_apply_cleanup) immediately removes members who have no messages in recent_messages. When invite-accept published a membership-only delta, the new member was pruned on every peer before their first message could arrive, causing the six-peer test to fail. Instead, store the invitation credentials locally (AuthorizedMember, invite chain, MemberInfo) and let build_rejoin_delta bundle membership atomically with the first message. This ensures the member always has at least one message when added, preventing pruning. Changes: - CLI: accept_invitation no longer adds member to local state or sends membership UPDATE to the network - UI: get_response handler no longer applies invitation delta or triggers ProcessRooms sync - UI: can_send_message now checks self_authorized_member as fallback, matching can_participate behavior Fixes #108 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Problem
The six-peer regression test consistently fails because the member pruning logic
(
post_apply_cleanup) immediately removes members who have no messages inrecent_messages. When invite-accept published a membership-only delta (withoutany messages), the new member was pruned on every peer before their first message
could arrive. This caused a chicken-and-egg problem: the member needed to send a
message to stay, but their messages were rejected because they weren't in the
members list.
Approach
Instead of publishing membership immediately on invite-accept, store the
invitation credentials locally (AuthorizedMember, invite chain, MemberInfo) and
let
build_rejoin_deltabundle membership atomically with the first message.This ensures the member always has at least one message when added, preventing
post_apply_cleanupfrom pruning them.Key insight: A member with a valid invitation is still a member, even if they're
not in the active members list. The active members list only tracks members who
have recent messages.
Changes
CLI (
cli/src/api.rs):accept_invitationno longer adds member to local room_state or sendsmembership UPDATE to the network
build_rejoin_deltaUI (
get_response.rs):self_member_infofor use during rejoinUI (
room_data.rs):can_send_messagenow checksself_authorized_memberas fallback,matching
can_participatebehavior — a user with a valid invite can sendmessages even if not yet in the active members list
Testing
cargo test --package river-core— all 7 tests passcargo test --package riverctl --lib— all 4 tests passcargo clippy— clean (no new warnings)Fixes
Closes #108
[AI-assisted - Claude]