C12.6: IMAP sync
This commit is contained in:
32 files changed
+2343
-276
No files matched your search
@@ -0,0 +1,11 @@
|
||||
FAIL
|
||||
|
||||
1. crates/ely-mail-engine/src/imap.rs:139 — Missing `EXISTS` silently becomes an empty mailbox. If `EXAMINE` returns UIDVALIDITY and tagged OK but omits the required message count, `sync::one` deletes every cached message and records a successful sync. The independent probe returned `Ok(Report { removed: 1, .. })`, zero cached messages and a new last-sync time. Keep the count optional until validated and return a protocol error before changing local data when it is absent. Add a regression asserting both failure and cache preservation. Evidence: `.work/C12.6-r1-probes.log`, `an_examine_without_exists_does_not_delete_mail`; [RFC 3501 §6.3.1–6.3.2](https://www.rfc-editor.org/rfc/rfc3501.html#section-6.3.1).
|
||||
|
||||
2. crates/ely-mail-engine/src/imap.rs:285 — A concurrent flag notification makes a valid header/body fetch fail. Another client can change an asked UID's flags while it is being downloaded; a valid body response followed by `* 1 FETCH (UID 1 FLAGS (\Seen))` is rejected as `UID 1 came without a body`, aborting synchronization and discarding the fetched batch. Unsolicited FETCH responses can include UID. Accumulate attributes by UID, process flag updates separately, and validate the requested section after the command completes rather than requiring it in every response. Evidence: `.work/C12.6-r1-probes.log`, `concurrent_flags_do_not_make_a_body_fetch_fail`; [RFC 3501 §7](https://www.rfc-editor.org/rfc/rfc3501.html#section-7).
|
||||
|
||||
3. crates/ely-mail-engine/src/store/folders.rs:43 — Folder reconciliation treats INBOX's case variants as different identities. After caching `INBOX`, a subsequent LIST spelling it `inbox` deletes its messages and originals even with unchanged UIDVALIDITY and UIDs. Messages older than 90 days then return only as headers, losing their offline bodies. The probe's previously cached MessageId became absent after this case change. Normalize INBOX consistently for reconciliation and mailbox lookup while preserving other mailbox names' case distinctions, and test retention of the original bytes. Evidence: `.work/C12.6-r1-probes.log`, `inbox_casing_does_not_destroy_cached_mail`; [RFC 3501 §5.1](https://www.rfc-editor.org/rfc/rfc3501.html#section-5.1).
|
||||
|
||||
4. crates/ely-mail-engine/src/imap.rs:123 — Special-use discovery relies entirely on optional attributes in ordinary LIST responses. A server may advertise `LIST-EXTENDED SPECIAL-USE` and return its Sent/Drafts/Trash roles only when requested with `RETURN (SPECIAL-USE)`. This implementation never discovers capabilities or requests those attributes, so such folders are stored with `role = None`; the probe returned no Sent role despite the advertised capability. Discover the supported capabilities and request special-use attributes when available, retaining ordinary LIST for servers without the extension. Add coverage for a server that omits roles from ordinary LIST. Evidence: `.work/C12.6-r1-probes.log`, `roles_are_discovered_when_only_extended_list_carries_them`; [RFC 6154 §2](https://www.rfc-editor.org/rfc/rfc6154.html#section-2).
|
||||
|
||||
5. crates/ely-mail-engine/src/imap.rs:186 — Default body synchronization downloads attachments without a request. `BODY.PEEK[]` retrieves the entire MIME message, and `sync.rs:148` persists it as `Fetched::Whole`. With the existing multipart sample classified as recent, the independent sync probe cached `report.pdf` and all nine attachment bytes automatically. Larger attachments are likewise transferred and stored, contrary to PRD §12.3's attachment-on-demand default. Fetch and cache the message's body sections separately from attachment payloads; retrieve attachment bytes only on request or explicit complete offline retention, and test that default synchronization leaves those payloads uncached. Evidence: `.work/C12.6-r1-probes.log`, `a_default_recent_body_sync_does_not_fetch_attachments`.
|
||||
@@ -0,0 +1,9 @@
|
||||
FAIL
|
||||
|
||||
1. crates/ely-mail-engine/src/store/schema.rs:2 — The schema changes overwrite V1 without adding a migration. A database created by the completed C12.3/C12.5 implementation already has `user_version = 1`, so opening it skips upgrading and leaves `synced`, `role`, `uidvalidity` and `missing` absent. The independent probe opened the exact HEAD schema successfully, then `Store::synced` failed with `no such column: synced`; folder synchronization and message reads likewise reference absent columns. Preserve the existing V1 and append a versioned migration, with a regression that reopens a populated previous-version database and verifies its data and synchronization. Evidence: `.work/C12.6-r2-probes.log`, `probe_an_existing_v1_store_is_upgraded`.
|
||||
|
||||
2. crates/ely-mail-engine/src/imap/parts.rs:110 — Multipart attachment dispositions are ignored before descending into their children, leaving round 1 defect 5 incompletely fixed. For a recent multipart/mixed message containing an attached multipart/alternative whose child is text/plain, every leaf is classified as body content, `Node::complete()` returns true, and sync downloads and stores the whole attachment through `BODY.PEEK[]`. The independent probe cached `nested.mime`, including its private attachment payload, without a request. Classify an attached multipart as one omitted entity before descending, retain its part number in `missing`, and cover multipart attachments in the synchronization regression. This matches the existing MIME reader and [RFC 2183 §2.9](https://www.rfc-editor.org/rfc/rfc2183.html#section-2.9). Evidence: `.work/C12.6-r2-probes.log`, `probe_multipart_attachments_stay_on_demand`.
|
||||
|
||||
3. crates/ely-mail-engine/src/imap/parts.rs:142 — The attachment check overrides multipart/related semantics and omits inline body content. A recent HTML message with a CID PNG marked `Content-Disposition: attachment` is valid and is classified as an inline image by the existing MIME reader, but synchronization never requests its payload. The probe completed synchronization with empty image bytes instead of the PNG bytes; the message is then marked body-cached and subsequent default syncs skip it. Apply related-container semantics before disposition checks when selecting body parts, and test related roots and CID images carrying attachment dispositions. [RFC 2387 §4](https://www.rfc-editor.org/rfc/rfc2387.html#section-4) requires ignoring the disposition type within multipart/related. Evidence: `.work/C12.6-r2-probes.log`, `probe_related_images_marked_attachment_are_cached`.
|
||||
|
||||
4. apps/ely-mail/src/syncing.rs:35 — A TLS initialization failure is discarded instead of appearing as a synchronization failure. If the local store opens but platform TLS initialization returns an error, startup synchronization returns after a generic log message, creates no `Syncing` entry, and the account view displays neither synchronization status nor the actual failure reason required by §12.3. The GPUI probe injected `platform trust store unavailable` and confirmed that the account had no failure state. Preserve the original TLS error in the account's synchronization state and render it through the existing failure banner; add startup coverage with failed TLS initialization. Evidence: `.work/C12.6-r2-app-probes.log`, `probe_tls_initialization_failure_is_shown_as_a_sync_failure`.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
1. crates/ely-mail-engine/src/store/folders.rs:106 — The first sync deletes an upgraded cache even when UIDVALIDITY has not changed. V2 leaves `mailboxes.uidvalidity` NULL, so `open_mailbox` calls `without_mail` and deletes every existing message and original before comparing their stored UIDVALIDITY with the server's. The independent probe upgraded a populated v1 database, confirmed its cached body survived opening, then called the same `open_mailbox(INBOX, 7)` used by sync: the message with UIDVALIDITY 7 disappeared and the message count became zero. For mail older than 90 days, synchronization restores only headers, losing its offline body. Reconcile existing message identities with the reported UIDVALIDITY when initializing the new column; preserve matching cached messages. Extend the migration regression through the first synchronization, including an older cached body. Evidence: `.work/C12.6-r3/probes.log`, `probe_a_migrated_body_survives_its_first_examine`.
|
||||
|
||||
2. crates/ely-mail-engine/src/imap/parts.rs:159 — Related-root selection cannot resolve a multipart child named by `start`. It uses `id(child)`, which always returns None for multipart nodes, then falls back to the first child and marks the actual root as an omitted attachment. A valid multipart/related message with a CID image first and a multipart/alternative root second (`Content-ID: <root>`, `start="<root>"`) loses both its plain and HTML bodies. The independent reconstruction probe read `hello` from the full message, but the selected sections omitted part 2 and the cached message had neither text nor HTML. Sync nevertheless stores it as body-cached, so later default syncs skip repairing it. Resolve related roots using their MIME headers when BODYSTRUCTURE cannot supply Content-ID, and cover a non-first multipart root through reconstruction and synchronization. Evidence: `.work/C12.6-r3/probes.log`, `probe_related_multipart_start_root_is_cached`.
|
||||
Reference in new issue
Block a user