Let contacts have multiple email addresses
Summary
Intent: People use more than one email address (work and personal, old domain and new), and today each address ends up as a separate duplicate contact. Merging two contacts throws away the duplicate's email. With this change a contact keeps one primary email plus any number of additional ones, and every place that looks a person up by email checks all of them.
humans.emailstays the primary address and is still what gets displayed and copied. Additional addresses live inhumans.metadata_json.$.additionalEmails. This needs no schema change: E2EE 1.4.23 rejects new tables, and new synced columns need CloudSync alters. Older clients and mobile keep seeing the primary address.- Contact page: an Add email button sits under Email. Each additional address can be edited (saved on blur or Enter) or removed. The read-only view lists every address.
- Lookups by email now check additional addresses too. This covers calendar attendee sync (
list_humans_by_emailsand the insert-if-missing guards), event participant creation (find_human_ids_by_email), owner self-detection in render/STT/capture queries, voiceprint remote-participant exclusion, speaker-assign contact matching, and contact search. merge_humansnow keeps the duplicate's primary and additional emails as additional emails on the kept contact. If the kept contact has no email, it takes the duplicate's primary.- The duplicate-contact banner also flags contacts with the same name, not just an overlapping email.
Linear: ANLG-464
Demo
Not recorded yet. The UI hasn't been exercised in a running app; only the automated checks below ran, all on a Linux VM.
Verification
cargo test --locked -p db-app -p tauri-plugin-calendar -p tauri-plugin-session -p voiceprint, all passing. New tests cover: an attendee matching an additional email, update normalization, and merge keeping both contacts' emails.cargo clippy --locked --all-targets --no-deps -D warningsis clean for db-app, calendar, and session.voiceprintalready fails clippy on main atmatching.rs:60.pnpm -F @anlg/desktop typecheck, vitest for contacts plus the touched query tests,oxlint,dprint.
Link to Devin session: https://app.devin.ai/sessions/8909b7359dcd4db0820e11b7751cb257
Open in Devin Desktop: https://app.devin.ai/desktop/session/8909b7359dcd4db0820e11b7751cb257?variant=devin
Requested by: @ComputelessComputer
Summary by cubic
Lets contacts keep multiple email addresses instead of splitting each address into a duplicate contact and dropping emails during merge.
- The primary address stays in
humans.email; extra addresses live inhumans.metadata_json.$.additionalEmailswith no schema change. - The contact page gains an Add email button; each additional address can be edited or removed.
- Every email lookup checks additional addresses: calendar attendee sync, event participant creation, owner self-detection (even with an empty primary), voiceprint exclusion, speaker matching, and contact search.
- Merging keeps both contacts' emails on the kept contact and takes the duplicate's primary when the kept contact has none.
- Updating the primary email re-normalizes additional addresses; pending edits are tracked so blur and remove don't clobber each other, and failed writes clear the pending state.
- The duplicate-contact banner now also flags contacts sharing the same name.