This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
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.
A third batch of refactors to the sync handler #11532
A third batch of refactors to the sync handler #11532
Changes from 8 commits
7aee344
bca64f9
7662ba4
6ff95ee
0d0783c
a5deabb
50fee89
8bd3565
824ae4e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a change in behaviour, where we will no longer log for joins where there was no previous membership event (ie, first-time joins). But #4422 got fixed a long time ago - I suggest you rip this whole thing out rather than trying to maintain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the commit comment for this change:
to be more precise: all membership events for the calling user. But I think that's what you meant.
hrrrm.
joined_room_ids
is populated based oncurrent_state_events
;events
is populated based on the timeline.I assert it is possible for
current_state_events
to have you as not-joined, even though the only thing visible in the timeline is a join event. For example:prev_event
s predate the ban, but will not make it into current_state_events (because bans win over joins in state res, essentially).Now, that's certainly an edge case, and I haven't run through the entire logic here to see if it doesn't get caught somewhere else, but it makes me hesitate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh bugger. Thanks for spotting this (and hopefully spelling out the logic made it easier to spot the flaw in my reasoning).
I think this is arcane enough to deserve a test case. I'll see if I can cook up something in complement if I get time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a reliable test case might be tricky, since I suspect you need to exploit a race to make it happen :-S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the race, sorry? Oh---I guess the initial checks for "are you banned from this room" need to pass, but then the ban event comes in before your join event is accepted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/accepted/persisted/, but pretty much, yes. The case above relies on your homeserver generating a join event with
prev_events
that precede the ban (so that it passes the "are you banned" test) but then giving that join event astream_ordering
after that of the ban (so that it comes down/sync
after the ban). Obviously, that can only happen if the two are racing each other.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Sounds like a Synapse-specific test is more appropriate then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this has the same problem as bca64f9.