Skip to content

Let contacts have multiple email addresses - #8044

Merged
devin-ai-integration[bot] merged 7 commits into
mainfrom
devin/1791516419-contact-multiple-emails
Oct 9, 2026
Merged

devin-ai-integration[bot] merged 7 commits into
mainfrom
devin/1791516419-contact-multiple-emails

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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.email stays the primary address and is still what gets displayed and copied. Additional addresses live in humans.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_emails and 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_humans now 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 warnings is clean for db-app, calendar, and session. voiceprint already fails clippy on main at matching.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 in humans.metadata_json.$.additionalEmails with 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.

Written for commit e51f2b8. Summary will update on new commits.

View guided diff Turn on auto-fix

devin-ai-integration Bot and others added 2 commits October 9, 2026 03:49
Additional emails live in humans.metadata_json $.additionalEmails and
participate in every human-by-email match (calendar sync, session
participants, owner self checks, voiceprint remote detection, contact
search). Merging keeps both contacts' emails; the desktop contact
details view can add/edit/remove additional emails.

Co-Authored-By: John <john@fastrepl.com>
…anged

Co-Authored-By: John <john@fastrepl.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 1 finding needs your review

Devin fixed 6 of 7 findings on e51f2b8. Click a finding below to jump to its comment.

For your review (1)

Fixed by Devin (6)

  • Edited email survives immediate removal
  • Failed email edits persist on retry
  • Owner aliases fail with empty primary email
  • Speaker picker misses additional addresses
  • Primary email change leaves duplicate address
  • Calendar alias lookup lacks SQL coverage

View all findings in Devin Review

Devin Review

devin-ai-integration Bot and others added 2 commits October 9, 2026 04:06
- Track pending additional-email edits so blur + remove writes don't
  clobber each other, and match rows by value.
- Let owner self-alias checks match additional emails even when the
  owner's primary email is empty.
- Match additional emails in speaker-assignment search and lookups.
- Re-normalize additional emails when the primary email is updated.
- Add db-app coverage for additional-email matching and inserts.

Co-Authored-By: John <john@fastrepl.com>
- Rows track their last committed value so a blur-then-remove or a
  second edit before the live query refresh can't leave the stale
  entry behind.
- A failed write clears the pending list so the next edit does not
  persist a rejected state.

Co-Authored-By: John <john@fastrepl.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +36 to +37
// The json_valid / json_type guards keep one malformed synced metadata
// row from breaking the whole query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Helper comments repeat implementation

The new helper comments describe their SQL behavior rather than why it matters. Repository guidance asks comments to explain the reason, not restate the code.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This finding is about an earlier revision. In 8ca9071 I removed the doc comments that only restated the SQL. The two comments that remain say why each guard exists: the json_valid/json_type guard stops one malformed synced metadata row from breaking the whole query, and the non-empty-primary helper stops an empty primary from blocking alias matching. I'm leaving them in.

@devin-ai-integration
devin-ai-integration Bot merged commit ef50a51 into main Oct 9, 2026
25 checks passed
@ComputelessComputer
ComputelessComputer deleted the devin/1791516419-contact-multiple-emails branch October 9, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant