Skip to content

add optional swapped with, allows check for swapped given_name/name fields - #640

Merged
mabiede merged 1 commit into
mainfrom
feature/duplicates-with-name-swapped
Aug 31, 2026
Merged

add optional swapped with, allows check for swapped given_name/name fields#640
mabiede merged 1 commit into
mainfrom
feature/duplicates-with-name-swapped

Conversation

@mabiede

@mabiede mabiede commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 27, 2026 10:24
@mabiede mabiede self-assigned this Aug 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the duplicate-contact detection logic so that contacts are also detected as duplicates when given_name and name were entered swapped (e.g., John Doe vs Doe John). It updates the duplicate similarity SQL generation and its prefilter (“blocking”) logic, and adds a regression test plus a changelog entry.

Changes:

  • Add swapped_with metadata to compared columns to express name/given-name swap counterparts.
  • Extend similarity scoring and blocking conditions to treat consistent swaps as a match (while keeping the block selective by requiring both swap directions).
  • Add an Alcotest regression case for swapped firstname/lastname, and document the behavior change in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pool/test/duplicate_contacts_test.ml Adds a test asserting swapped first/last names are detected as duplicates with score 1.0.
pool/app/duplicate_contacts/repo.ml Updates generated SQL for similarity scoring and blocking to account for swapped name/given_name pairs.
pool/app/duplicate_contacts/entity.ml Introduces Column.swapped_with and configures swap pairing for namegiven_name.
CHANGELOG.md Notes the duplicate-check behavior change under unreleased.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mabiede
mabiede requested a review from PossessedC0bra August 27, 2026 10:31
Comment thread pool/app/duplicate_contacts/repo.ml
@PossessedC0bra
PossessedC0bra self-requested a review August 31, 2026 13:10
@mabiede
mabiede merged commit b4841d9 into main Aug 31, 2026
10 checks passed
@mabiede
mabiede deleted the feature/duplicates-with-name-swapped branch August 31, 2026 13:10
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.

3 participants