Skip mark-read when the server tracks none of the loaded messages - #6654
Skip mark-read when the server tracks none of the loaded messages#6654gpunto wants to merge 4 commits into
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. Walkthrough
ChangesRead-state eligibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change narrows mark-read suppression to channels with no server-tracked messages and adds focused coverage for the affected cases; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
andremion
left a comment
There was a problem hiding this comment.
Looks good. One scope question and one nit inline, both optional.
|



Goal
Develop port of #6646. The mark-read guard from #6644 skips whenever the last item in the list is the current user's own local-only message, which also suppresses legitimate mark-read in channels the server does have messages for. An
errormessage is terminal, so a rejected or moderation-bounced send stays the last item and keeps those channels unread indefinitely.Skip only when the server tracks none of the loaded messages. Read state leaves out our own not-yet-persisted messages, and silent, shadowed and deleted ones from anyone, so none of them can resolve a mark-read call. Silent is documented as not marking a channel unread, and a deleted message is removed from read state by
HandleMessageDeleted, so a channel holding only those has nothing to mark read. Deleted for the current user only does not count, since the message stays in the channel for everyone else.Part of AND-1395
Implementation
MessageListController.markLastMessageReadInternal: replace the "last item is our own local-only message" check with "no loaded message is one the server tracks", via a newMessage.isInServerReadStatepredicate covering local-only,silentandshadowed.randomMessagerandomises bothsilentanddeletedAt, which the gate now keys on, so gate-dependent tests build their messages through atrackedMessagehelper that pins them, and thenowMessagehelper pins them too. This includes the two unread-label tests that only exist here, one of which asserts state computed inside the branch the gate guards.ChannelStateImpl.shouldIgnoreUpsertiondrops other users' shadowed messages). The check stays as defensive cover and its test says so.The deleted case will be ported to v6 separately, since #6646 merged without it.
Testing
ui-commonsuite rerun to confirm the gate no longer depends on a randomised field.last_read_message_id.Summary by CodeRabbit