fix: include mailboxPath in IMAP email ID to prevent UID collisions #511

Merged
guettlibot merged 6 commits from issue-502-fix-email-id-collision-mailbox into main 2026-06-07 03:31:00 +00:00
6 Commits
Author SHA1 Message Date
Thomas SharedInboxandClaude Sonnet 4.6 9feba5cd31 ci: re-trigger CI (transient SSH tunnel failure)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 05:25:09 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 b944e22b8b fix(test): apply dart format and prefer_single_quotes lint fixes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 05:16:08 +02:00
Thomas SharedInbox da98967100 Merge remote-tracking branch 'origin/main' into HEAD 2026-06-07 05:11:43 +02:00
Bot of Thomas Güttler f400a8dbdd Merge branch 'main' into issue-502-fix-email-id-collision-mailbox 2026-06-07 04:52:38 +02:00
Bot of Thomas Güttler 884d191206 Merge branch 'main' into issue-502-fix-email-id-collision-mailbox 2026-06-07 04:27:17 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 af2abdb7f6 fix: include mailboxPath in IMAP email ID to prevent UID collisions
IMAP UIDs are mailbox-scoped, so UID 50 in INBOX and UID 50 in Archive
are different emails. The old ID scheme `accountId:uid` caused silent
overwrites via insertOnConflictUpdate. The new scheme is
`accountId:mailboxPath:uid`.

Schema migration v41 re-derives IDs for existing IMAP email rows from
the (account_id, mailbox_path, uid) columns already stored, updates the
email_bodies foreign key accordingly, patches thread_id fields that
were set to the email's own ID (no Message-ID header), and rebuilds the
threads table from the corrected email rows.

Closes #502

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 23:56:52 +02:00