Fix state_after for left rooms including post-leave lazy-loaded memberships - #20169
Open
barodeur wants to merge 5 commits into
Open
Fix state_after for left rooms including post-leave lazy-loaded memberships#20169barodeur wants to merge 5 commits into
state_after for left rooms including post-leave lazy-loaded memberships#20169barodeur wants to merge 5 commits into
Conversation
…rships In the incremental-sync path with MSC4222 (use_state_after) and lazy-loading of members enabled, the membership events of timeline senders were fetched from the room's *current* state. For a room the user has left, current state can include state from after the leave, which must not be disclosed. Mirror _compute_state_delta_for_full_sync: pass `joined` down and, for non-joined rooms, fetch the memberships as of `end_token` (the user's leave point) via state groups instead.
3 tasks
barodeur
marked this pull request as ready for review
September 1, 2026 16:29
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.
The bug
TL;DR: with the experimental MSC4222 implementation enabled (
use_state_after) and lazy-loading of room members, an incremental/synccould disclose state from after the user's leave in a left room'sstate_after.lazy_load_members: trueanduse_state_after=true.state_aftercontains Bob's post-leave membership event from step 4Alice should not see the new per-room display name of Bob.
The fix
Copy what has been done for
_compute_state_delta_for_full_sync: passjoineddown and, for rooms the user is no longer joined to, fetch the memberships as ofend_tokenvia state groups (get_state_ids_at) instead of current state.Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.