bug: /sync with full_state=true and since returns no rooms when nothing changed #2390
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Compliance
Continuwuity/Web Interface
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No milestone
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity#2390
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What is the bug?
If I call /sync with full_state=true and a since token, and nothing has happened in my rooms since that token, rooms.join comes back empty even though the account is joined to rooms. As far as I understand the spec, full_state=true should return all joined rooms in this case. After a restart, Home Assistant's Matrix integration (matrix-nio) then believes it is in no rooms and refuses to load.
I have a one-line fix and will open a PR.
Steps to reproduce
Server name and version
private 26.8.1 (also reproduced on 26.9.1)
Additional context
No response
This is not how sync works - the rooms will be included in rooms.join when they have new events, but with
full_state=true, they will also be included with the fullstatebefore the timeline, instead of the normal deltaThanks for taking a look. I appreciate the correction about how sync normally works, and I may well be misreading the spec, so here is how I got to this.
Docs: the spec describes
full_stateas "Controls whether to include the full state for all rooms the user is a member of", and says "all state events will be returned, even ifsinceis non-empty" (spec). I read "all rooms" as every joined room, including ones with no new events. I'd be happy to be corrected if you read it differently.Synapse: the reference server seems to behave that way. It loops over all joined rooms "even if there are no new events" (code), passes
full_stateasalways_include(code), and skips its early return for empty rooms when it's set (code). Sytest also has a test called "Full state sync includes joined rooms" (test). Withoutfull_state, quiet rooms are left out, as you describe, and the PR doesn't change that.In practice: this breaks for me. I run Home Assistant with the
matrix_extendedintegration, which uses matrix-nio. It saves the sync token, and after a restart it syncs withsinceandfull_state=true. matrix-nio recommends this pattern (matrix-nio#292). On Continuwuityrooms.joincomes back empty, so the client concludes it is in no rooms and fails to load.Is there a reason you'd prefer
full_stateto only cover rooms with new events? For example, the cost for accounts with many rooms, or something else? If it's intentional, I'm happy to look for another approach or a different fix.The current behaviour is the behaviour described in the spec, for multiple reasons including performance. There is no reference server. It is the client's job to persist state.