matrix-org / matrix-org/matrix-js-sdk
Indexed DB can have inconsistency in membership event content
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
It's possible for the sync store to have incorrect content of a m.room.member event in roomsData.join.$roomID.state[*], but correct content for that same event in roomsData.join.$roomID.timeline[*].
To reproduce:
- Visit develop.element.io in two tabs, each tab signed in with a different user
- Create/visit a room that has both users in it
- Have one user leave the room
- With the user that remains in the room:
- Open Element devtools and view Explore room state >
m.room.member> MXID of user who left - Open browser devtools and view Indexed DB for https://develop.element.io > matrix-js-sdk:riot-web-sync > sync
- Open Element devtools and view Explore room state >
- See that Element devtools shows the correct value of
content.membership="leave" - See that the Indexed DB has the same value for
content.membershipin thetimelineevent for the same eventID - See that the Indexed DB has an *incorrect value of
content.membership="join"in thestateevent for the same eventID
With that said, any client that uses timeline to load state won't have any problems (and I assume Element Web does that, as it has accurate member lists in rooms). But if a client were read from state, it would get incorrect data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the Indexed DB sync store receives roomsData.join.$roomID.state[*] and timeline[*] events, using the two-user reproduction described in the issue. Compare the stored m.room.member event content for the same event ID in both paths; done means both entries preserve the correct membership value, such as leave.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100