Repository navigation
federation: require current membership on send_join retries - #718
Open
basnijholt wants to merge 1 commit into
Open
basnijholt wants to merge 1 commit into
basnijholt wants to merge 1 commit into
Conversation
The event handler distinguishes a newly appended join from a join it already handled. Use that distinction before returning the room state: a retry still succeeds while its user is joined, but an old join alone no longer establishes membership. Do not look up membership again for a newly appended join. Assisted-by: MindRoom DevAgent:openai/gpt-6.2-astra <https://github.com/mindroom-ai/mindroom>
This branch has not been deployed
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.
What does this PR do?
/send_joinreturns the room state when the join event is accepted. When the submitted join had already been handled before (a retry), the handler returned the state on the strength of that stored event alone. A join the server accepted earlier for a user who has since left therefore still returned the room's current state.The event handler already tells a newly appended join from one it handled before. A retry now succeeds only while its user is still joined; a new join needs no second lookup. Membership lookup errors propagate instead of counting as an answer.
Found through MindRoom. Fork change: mindroom-ai/mindroom-tuwunel#114.
Tests:
send_join::tests::only_join_retries_require_current_membership: a new join skips the membership lookup, a retry for a joined user succeeds, a retry for a user who left is refused. It fails without the fix (the retry for the departed user succeeds).Validation:
nightly-2026-11-03, the formatter upstream uses sincee754d6cdd):cargo fmt --all -- --checkpasses.cargo clippy --offline --locked -p tuwunel_api_federation --all-targets --all-features -- -D warningspasses.cargo test -p tuwunel_api_federation -p tuwunel --lib --test federation_membership_refusal: 45 passed.Checklist
cargo fmtand satisfies clippy and rustc lints; any allowed lint is justified by an obvious reason or a comment.src/core/config/mod.rsdoc comments and the regeneratedtuwunel-example.tomlis committed. (No config changes.)docs/. (No user-facing docs change.)