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>