Repository navigation
Don't delete conversations that arrive while a list sync is in flight - #6749
AndyScherzinger wants to merge 1 commit into
Conversation
📱 QA build
The QA build installs alongside a released Nextcloud app, so you can keep Downloading the file requires a GitHub account, so open this link on the |
cd90e54 to
88d6996
Compare
d94e69b to
554f690
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: f13dcaf9-a12c-479b-b7ad-5e14bac0aa90
📒 Files selected for processing (4)
app/src/main/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepository.ktapp/src/main/java/com/nextcloud/talk/data/database/dao/ConversationsDao.ktapp/src/main/java/com/nextcloud/talk/utils/preview/ComposePreviewUtilsDaos.ktapp/src/test/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepositoryTest.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
54a04a5 to
3b4e209
Compare
ec32a68 to
ea5f8bd
Compare
|
Note for review, since #6746 landed The mutex there serialises room list syncs of the same account against each other. The race it fixes is a delta response being written after a full sync has deleted a conversation, putting it back. This PR fixes a different race: a room list sync against anything else that writes a conversation while its request is in flight — a single-room fetch, a room joined on another device, one the user just created. None of those take the room list lock, so serialising syncs leaves the window open. The response still cannot mention a conversation that did not exist when the server answered, and reconciling against the rows as they are after the answer still reads that as a conversation the user left. One thing did improve from the merge, by accident rather than design. The id snapshot is taken inside No change needed here; rebased onto the merge and both of that commit's new tests pass alongside this one. |
ea5f8bd to
57fb176
Compare
129c230 to
9422f58
Compare
dee9e74 to
8969782
Compare
A conversation list sync reads the locally known conversations after the server has answered, and treats every one the response does not mention as a conversation the user left. A conversation that reached the database while the request was in flight - a single-room fetch, a room joined on another device, one the user just created - was never in that response and could not have been, so it was deleted, taking its cached messages and chat blocks with it through the foreign key cascade. Take the known conversation ids before the request goes out and reconcile removals only against those. Anything that appeared afterwards is left alone until the next full sync, which is the first one whose response can speak about it at all. Reading the conversations themselves earlier would not do: that same read feeds the pending local state guard, which needs the freshest state to protect a favourite or read marker that is still on its way to the server. Only the removal reconcile wants the older snapshot, so only it gets one, as an id query that does not load the rows. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
8969782 to
8df0755
Compare
A conversation list sync reads the locally known conversations after the server has answered, and treats every one the response does not mention as a conversation the user left. A conversation that reached the database while the request was in flight — a single-room fetch, a room joined on another device, one the user just created — was never in that response and could not have been, so it was deleted, taking its cached messages and chat blocks with it through the foreign key cascade.
What it does
Takes the set of known conversation ids before the request goes out, and reconciles removals only against those. A conversation that appeared afterwards is left alone until the next full sync, which is the first one whose response could actually speak about it.
Why not simply read the conversations earlier
The same read feeds
preservePendingLocalState, which needs the freshest local state to protect an in-flight favourite or read marker. Moving it earlier would trade this bug for that one. Only the removal reconcile wants the older snapshot, so only it gets one — as an id-only query, so the extra read does not load every conversation row.Note for reviewers
detektis red on this branch. It is red onmastertoo, at the same count: 111 weighted issues against amaxIssuesof 110, measured onmasterwith this branch stashed. This change adds none.🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)