Show the complete mailbox; sync_limit now caps body prefetch only

The local store was capped at sync_limit, so IMAP only ever listed the
newest N messages — a search in Thunderbird (the only search UI we have)
silently missed everything older. Now the syncer lists the *full* mailbox
metadata for every folder, and sync_limit governs only how many recent
message bodies are pre-warmed offline. Bodies outside that window are
fetched on demand the first time a client opens the message.

A one-time full-metadata sync (marker full_metadata_synced_v1) completes
the mailbox view on first launch after upgrade.

Crucially, an empty body is now stored as rfc2822 = None rather than a
rendered "(No body available)" placeholder: the placeholder looked like a
real body to the IMAP layer and suppressed the on-demand fetch. CachedMail
gains body_loaded to track whether the body (not just the headers) is final.

Validated live on a 19,322-message INBOX (26,965 mails total across
folders): full listing, on-demand body fetch (~0.1-0.4s), in-memory cache
on re-fetch.
This commit is contained in:
Anthony
2026-05-29 18:45:08 +02:00
parent c401349d24
commit 472eb7880e
7 changed files with 183 additions and 61 deletions
-1
View File
@@ -192,7 +192,6 @@ async fn main() -> anyhow::Result<()> {
store.clone(),
local_store.clone(),
backend.clone(),
cfg.sync_limit,
bus_ids_for_handler,
event_rx,
shutdown_rx.clone(),