Skip to content

Mark message prefetch requests and let the server turn preloading off - #6763

Draft
AndyScherzinger wants to merge 2 commits into
feat/noid/conversation-list-foreground-syncfrom
feat/noid/mark-prefetch-requests
Draft

AndyScherzinger wants to merge 2 commits into
feat/noid/conversation-list-foreground-syncfrom
feat/noid/mark-prefetch-requests

Conversation

@AndyScherzinger

@AndyScherzinger AndyScherzinger commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Stack — review and merge bottom-up. Each PR targets the branch below it, so it shows its parents' commits until they merge.

  1. #6744 — modifiedSince delta sync
  2. #6745 — periodic background refresh
  3. #6746 — foreground refresh loop
  4. #6763 — prefetch marking + mobile-preload-chat capability ← you are here

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.

prefetch=1 on the requests the catch-up makes

A 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 (OfflineFirstChatRepository calls buildFieldMap too), 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-chat capability

Implements the client side of spreed#19509. Preloading is skipped only when the server reports the setting as false. A server that reports true, 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-notifications is 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.

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

  • Verify the false path against a server that reports the capability — the test instance predates spreed#19509, so only the absent case could be exercised live

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@AndyScherzinger AndyScherzinger added this to the 25.1.0 milestone Sep 23, 2026
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from 1c54f14 to d1cf526 Compare September 23, 2026 14:21
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from 251d2a5 to 657f4d1 Compare September 23, 2026 14:21
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from d1cf526 to 61d24d9 Compare September 23, 2026 15:12
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from 657f4d1 to 7e7827c Compare September 23, 2026 15:12
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from 61d24d9 to 6cbc0f4 Compare September 24, 2026 06:09
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from 7e7827c to 7b03e5c Compare September 24, 2026 06:09
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from 6cbc0f4 to e314853 Compare September 24, 2026 08:29
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from 7b03e5c to 6ac16cc Compare September 24, 2026 08:29
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from e314853 to 79bbdf7 Compare September 24, 2026 14:43
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from 6ac16cc to 921f65a Compare September 24, 2026 14:43
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from 79bbdf7 to d6f1aeb Compare September 24, 2026 16:33
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from 921f65a to adc4b8c Compare September 24, 2026 16:33
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>
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/conversation-list-foreground-sync branch from d6f1aeb to f7eb4c3 Compare September 24, 2026 16:59
@AndyScherzinger
AndyScherzinger force-pushed the feat/noid/mark-prefetch-requests branch from adc4b8c to 9877751 Compare September 24, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant