Skip to content

WAIT: Match interstitial duplicates on legal first name too#1826

Open
maebeale wants to merge 1 commit into
mainfrom
maebeale/interstitial-legal-first-name-match
Open

WAIT: Match interstitial duplicates on legal first name too#1826
maebeale wants to merge 1 commit into
mainfrom
maebeale/interstitial-legal-first-name-match

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 PR, suggested 👤 review level: 📖 Read — light-logic: small, contained change to the duplicate-person name query

What is the goal of this PR and why is this important?

The new-person duplicate interstitial matched the typed first name (and its nickname variants) only against the stored first_name column. A returning registrant whose legal name lives in legal_first_name (nickname in first_name) who types their legal name slipped past the name check — the exact duplicate the interstitial exists to surface.

This is the follow-up to the registration-side fix (PublicRegistration#find_matching_person), ported the other direction: high-recall instead of swapping in the conservative matcher.

How did you approach the change?

  • Match the first-name variants against either first_name or legal_first_name (period/space normalized, mirroring the existing column normalization).
  • Count a legal-name hit as an exact name match so the "name match" badge and sort order behave like a first-name hit.
  • Failing test first (red/green): added a "Legal first name matching" context to the request spec.

Anything else to add?

Kept the interstitial's own normalization (strip ./spaces, nickname variants) rather than the registration matcher's plain LOWER — fully aligning the two normalizations is a separate, larger change and isn't needed to close this duplicate.

The new-person duplicate interstitial matched the typed first name (and its
nickname variants) only against the stored first_name column. A returning
registrant whose legal name lives in legal_first_name (with a nickname in
first_name) slipped past the name check when they typed their legal name — the
exact duplicate this surfaces is meant to prevent.

Mirror the registration matcher (PublicRegistration#find_matching_person): match
the first-name variants against either first_name or legal_first_name, and count
a legal-name hit as an exact name match for badge/sort purposes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
duplicate_ids.add(person.id)
exact_name = NicknameMap.normalize(person.first_name) == normalized_first
exact_name = NicknameMap.normalize(person.first_name) == normalized_first ||
NicknameMap.normalize(person.legal_first_name) == normalized_first

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: A legal-name hit counts as an exact name match ("name match" badge + name-priority sort), matching how a first_name hit is treated. normalized_first is never blank here (guarded by if first_name.presence), so a nil/blank legal_first_name normalizes to "" and can't false-match.

duplicate_ids.add(person.id)
exact_name = NicknameMap.normalize(person.first_name) == normalized_first
exact_name = NicknameMap.normalize(person.first_name) == normalized_first ||
NicknameMap.normalize(person.legal_first_name) == normalized_first

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: A legal-name hit counts as an exact name match (name-match badge + name-priority sort), matching how a first_name hit is treated. normalized_first is never blank here (guarded by if first_name.presence), so a nil/blank legal_first_name normalizes to an empty string and can't false-match.

@maebeale maebeale marked this pull request as ready for review June 22, 2026 03:24
@maebeale maebeale changed the title Match interstitial duplicates on legal first name too WAIT: Match interstitial duplicates on legal first name too Jun 22, 2026
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