Skip to content

Conversation

@anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Jul 3, 2025

Fixes: #14683

This PR aims to fix the edge case where a user has multiple membership events for a single room in a single sync period, and ends up receiving both down /sync. This confuses the client, as they don't know which membership event is the latest - only the server does.

Thus we exclude "older" membership events from /sync, where ordering is defined by events' "stream_ordering". Now clients will only get one membership event per room per sync - the latest.

Associated Complement tests: matrix-org/complement#787

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

This commit aims to fix the edge case where a user has multiple
membership events for a single room in a single sync period, and ends up
receiving both down /sync. This confuses the client, as they don't know
which membership event is the latest - only the server does.

Thus we exclude "older" membership events from /sync, where ordering is
defined by events' "stream_ordering". Now clients will only get one
membership event per room per sync - the latest.
@@ -0,0 +1 @@
Only include latest membership events for each user/room combination in a single incremental legacy sync response. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this also fixes #1413 (join/leave) vs (leave/invite)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/sync should not include a room in 'leave' and 'invite'

3 participants