element-hq / element-hq/synapse
Faster room joins: `device_lists.left` not emitted in `/sync` response when completing the join and discovering that a user is actually not in the room
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#13886](https://github.com/matrix-org/synapse/issues/13886).
---
See the commented out check in the `TestPartialStateJoin/Device_list_tracking/Device_list_no_longer_tracked_for_user_incorrectly_believed_to_be_in_room` complement test.
That test case is roughly:
1. A room starts with `@charlie:remote`, `@derek:remote` (moderator) and `@fred:remote` (admin)
2. `@fred:remote` leaves the room.
3. `@alice:local` partial state joins the room.
4. `@elsie:remote` joins the room.
5. `@fred:remote` "bans" `@derek:remote`, citing their join event as auth. The local homeserver does not know that `@fred:remote` is no longer in the room and accepts the event.
6. `@derek:remote` kicks `@elsie:remote`. The local homeserver incorrectly rejects the kick because it thinks `@derek:remote` has been banned.
7. The partial state join completes and `@elsie:remote` is discovered to really have been kicked.
8. No `device_lists.left` entry is emitted.
Contributor guide
Research direction
Start with the commented-out check in the TestPartialStateJoin/Device_list_tracking/Device_list_no_longer_tracked_for_user_incorrectly_believed_to_be_in_room complement test. Trace partial-state join completion and the /sync device-list handling, then run this test and verify that completing the join emits the expected device_lists.left entry for the user discovered to have left.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100