P2: Mail proxy restores expunged UIDs and changes retained sequence numbers #899

Open
opened 2026-10-02 17:37:53 +00:00 by kayg · 0 comments
Owner

Review target: job/mailproxy-486 at 7f796c4ca. Static evidence only; no tests run.

P2: shared virtual UIDs can return below a selected view's existing UIDs

  • Evidence: crates/plugins/mail/src/proxy.rs:156 retains the UID for each
    folder/generation/remote UID. The enabled-account filters at proxy.rs:35
    remove memberships without removing that mapping. Rows return in UID order
    (proxy.rs:159). crates/calternal-imap/src/session.rs:657 emits removals
    and EXISTS, then replaces the full selected sequence view. It has no reset
    when a newly visible UID sorts before a retained UID.
  • Result: after a Connected Account is enabled again, its old lower UIDs can
    reappear ahead of messages that the client retained. EXISTS cannot tell the
    client that those retained messages now have different sequence numbers.
    The server and client can disagree about which message a sequence number
    names. A previously expunged UID also reappears under the same UIDVALIDITY.
  • Rule: DESIGN §53 requires stable virtual UIDs and correct unified views.
  • Fix: keep append-only UID membership within each mailbox epoch. Use a
    mailbox epoch reset when visibility would restore old UIDs or insert them
    before retained UIDs, or use separate per-view UID mappings. Preserve
    upstream source coordinates in either design.
  • Test idea: allocate UIDs for two accounts, disable the account with lower
    UIDs, select the remaining account's unified view, then enable the first
    account. Assert a valid epoch reset or append-only UID and sequence behaviour.
Review target: job/mailproxy-486 at 7f796c4ca. Static evidence only; no tests run. ## P2: shared virtual UIDs can return below a selected view's existing UIDs - Evidence: `crates/plugins/mail/src/proxy.rs:156` retains the UID for each folder/generation/remote UID. The enabled-account filters at `proxy.rs:35` remove memberships without removing that mapping. Rows return in UID order (`proxy.rs:159`). `crates/calternal-imap/src/session.rs:657` emits removals and EXISTS, then replaces the full selected sequence view. It has no reset when a newly visible UID sorts before a retained UID. - Result: after a Connected Account is enabled again, its old lower UIDs can reappear ahead of messages that the client retained. EXISTS cannot tell the client that those retained messages now have different sequence numbers. The server and client can disagree about which message a sequence number names. A previously expunged UID also reappears under the same UIDVALIDITY. - Rule: DESIGN §53 requires stable virtual UIDs and correct unified views. - Fix: keep append-only UID membership within each mailbox epoch. Use a mailbox epoch reset when visibility would restore old UIDs or insert them before retained UIDs, or use separate per-view UID mappings. Preserve upstream source coordinates in either design. - Test idea: allocate UIDs for two accounts, disable the account with lower UIDs, select the remaining account's unified view, then enable the first account. Assert a valid epoch reset or append-only UID and sequence behaviour.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#899
No description provided.