Repository navigation
Mark message prefetch requests and let the server turn preloading off - #6763
Conversation
1c54f14 to
d1cf526
Compare
251d2a5 to
657f4d1
Compare
d1cf526 to
61d24d9
Compare
657f4d1 to
7e7827c
Compare
61d24d9 to
6cbc0f4
Compare
7e7827c to
7b03e5c
Compare
6cbc0f4 to
e314853
Compare
7b03e5c to
6ac16cc
Compare
e314853 to
79bbdf7
Compare
6ac16cc to
921f65a
Compare
79bbdf7 to
d6f1aeb
Compare
921f65a to
adc4b8c
Compare
d6f1aeb to
f7eb4c3
Compare
adc4b8c to
9877751
Compare
f7eb4c3 to
68a5808
Compare
9877751 to
da749fb
Compare
68a5808 to
113755a
Compare
da749fb to
35b45fc
Compare
113755a to
ce13671
Compare
35b45fc to
ac15baf
Compare
ce13671 to
697f4dc
Compare
ac15baf to
232f8f3
Compare
697f4dc to
cb81f11
Compare
232f8f3 to
73ff085
Compare
bb9ab2c to
4265639
Compare
66b34e9 to
4ac0f98
Compare
4265639 to
6f9ce45
Compare
4ac0f98 to
dd6512e
Compare
6f9ce45 to
7dc5a9f
Compare
dd6512e to
cce7913
Compare
7dc5a9f to
b029e76
Compare
cce7913 to
f880b1f
Compare
b029e76 to
d6ec8c2
Compare
f880b1f to
5bc53f9
Compare
d6ec8c2 to
6b4557c
Compare
5bc53f9 to
e04abd6
Compare
6b4557c to
6405470
Compare
e04abd6 to
5fc7b3c
Compare
6405470 to
4e71eaa
Compare
5fc7b3c to
621cac5
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: 🔵 Low · up to The change adds a prefetch marker and a server capability check for chat preloading. The remaining concern is a minor, previously raised race that could allow an unwanted room refresh, so the merge risk is low. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8e787c2b-5dab-4d84-b568-3b08dc343ed7
📒 Files selected for processing (8)
app/src/main/java/com/nextcloud/talk/chat/data/network/ChatMessageSyncer.ktapp/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.ktapp/src/main/java/com/nextcloud/talk/conversationlist/data/OfflineConversationsRepository.ktapp/src/main/java/com/nextcloud/talk/conversationlist/data/network/OfflineFirstConversationsRepository.ktapp/src/main/java/com/nextcloud/talk/conversationlist/viewmodels/ConversationsListViewModel.ktapp/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.ktapp/src/test/java/com/nextcloud/talk/chat/data/network/ChatMessageSyncerTest.ktapp/src/test/java/com/nextcloud/talk/conversationlist/viewmodels/ConversationsListViewModelForegroundRefreshTest.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
4e71eaa to
1aaa68d
Compare
📱 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 |
1aaa68d to
e42062b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Assert prefetch for the never-opened-room request. · ChatMessageSyncerTest.kt:283-302
app/src/test/java/com/nextcloud/talk/chat/data/network/ChatMessageSyncerTest.kt:283-302
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAssert
prefetchfor the never-opened-room request.When
newestMessageIdFromChatBlocksreturns0,catchUpRoomselects the backgroundinitialCatchUppath and passesprefetch = true. The request builder encodes this value as1. This fixture captures that request but does not assertprefetch, so removing or mis-passing the argument would leave the test passing without its fix.Suggested fix
assertEquals(0, fieldMapCaptor.firstValue["markNotificationsAsRead"]) + assertEquals(1, fieldMapCaptor.firstValue["prefetch"])
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f6cfa391-91e8-4e00-8211-362d1320806d
📒 Files selected for processing (1)
AGENTS.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
The client fetches a room's messages before the user asks for them, from a push notification and after a conversation list sync, and on the wire those requests are indistinguishable from the ones a user waiting on a chat screen is making. A server operator looking at request volume cannot tell what was speculative and what someone was waiting for. Send prefetch=1 on the chat requests the catch-up makes. The server ignores the parameter - the response is byte for byte the one it sends without it - so this only makes the traffic legible in an access log, where a query parameter needs no configuration to be recorded. The flag travels the same route as markNotificationsAsRead, which already separates these two cases, and defaults to false: the helpers that build the request are shared with the chat the user has open, and labelling those as prefetched would invert the very distinction this is for. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Preloading a conversation's messages before the user opens it spends the server's bandwidth on traffic nobody asked for yet. An operator who would rather not pay that can now say so: the mobile-preload-chat setting turns it off for mobile clients, and the server reports it in the chat config capabilities. Skip the catch-up when the server reports it as false. Anything else preloads - a server that reports it true, and a server too old to know the setting at all, which cannot mean the operator declined something they were never offered. Both entry points check it. The conversation list skips the whole catch-up rather than asking room by room, and the syncer checks it too, because push notifications reach it without passing the list. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Three tests in recent work passed while never reaching the code they named: an earlier guard returned first, so the assertion was never evaluated. Running the suite cannot distinguish that from a test that works, and review caught all three rather than CI. Write down the two habits that do catch it: check a new test fails without its fix, and take the fixture from the code path while the assertion still comes from the requirement. Drop the maxIssues figure from the detekt entry rather than correcting it. It claimed 80 against a real 114, and two attempts at describing the budget in prose were both wrong about when it fails. The other entries in that section only say where the config lives; this one now does the same and leaves the numbers to detekt.yml, which cannot go stale against itself. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The client fetches a conversation's messages before the user asks for them — after a push notification, and after a conversation list sync. On the wire those requests look exactly like the ones a user staring at a chat screen is waiting for, and the server has no way to say it would rather the client didn't make them at all.
Two commits, each answering one half of that, plus one unrelated note to
AGENTS.md.prefetch=1on the requests the catch-up makesA query parameter rather than a header, so it lands in a standard access log without any server configuration. Verified against a live server: the response is byte for byte the one sent without it, so the parameter is inert and purely descriptive.
The flag travels the same route as
markNotificationsAsRead, which already separates these two cases, and defaults to false. The helpers that build the request are shared with the chat the user has open (OfflineFirstChatRepositorycallsbuildFieldMaptoo), so a flag set any higher up would have labelled the messages someone is actively reading as prefetched — inverting the distinction this exists to draw. There is a test for exactly that.The
mobile-preload-chatcapabilityImplements the client side of spreed#19509. Preloading is skipped only when the server reports the setting as
false. A server that reportstrue, one that omits it, and one too old to know it at all all preload — an operator cannot have declined something they were never offered.Checked at both entry points, mirroring how
chat-keep-notificationsis already handled: the conversation list skips the whole catch-up rather than asking room by room, and the syncer checks it too, because push notifications reach it without passing the list.AGENTS.md: spotting a test that asserts nothingSeparate from the feature, and in its own commit so it can be dropped without touching the rest. Review on this series found three tests that passed while never reaching the code they named — an earlier guard returned first, so the assertion was never evaluated, and running the suite cannot tell that apart from a test that works. The two habits that do catch it are now written down: check that a new test fails without its fix, and take the fixture from the code path while the assertion still comes from the requirement.
Scope
Only message preloading. The conversation list sync is not gated: the capability is about chat messages, and an operator turning message preloading off has not asked for unread counts to go stale.
🚧 TODO
falsepath against a server that reports the capability — the test instance predates spreed#19509, so only the absent case could be exercised live🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)