Conversation
…berships A person merge moved both people's addresses and phone numbers onto the keeper wholesale (neither table has a unique index to collapse them), leaving identical duplicates and possibly two "primary" rows. Fold identical ones into one and settle a single primary so a merged record stays clean. Also flag a person carrying more than one uncancelled membership — the state a merge leaves behind (moves bypass the one-uncancelled validation) — so admins can consolidate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 suggested review level: 3 Read 📖 two small after-merge reconcilers mirroring existing ones, plus a display-only membership warning
Merging two people now folds their duplicate addresses and phone numbers into one and keeps a single primary, so a merged record isn't left with identical duplicates — and admins get flagged when a merge leaves someone with more than one active membership.
What changed
PersonServices::ReconcileAddressesfolds addresses with identical details into one viaModelDeduper#merge, which auto-repoints the folded address's inbound FKs (contact_methods.address_id,invoices.bill_to_address_id,affiliations.organization_address_id) onto the survivor.PersonServices::ReconcileContactMethodsfolds phones/sms/whatsapp with the same kind + value.Decisions worth a look
ReconcilePrimaryDesignationspattern), rather than leaving no primary. Say the word if you'd rather it always be the kept person's only.Membershipalready forbids two uncancelled per person, and cancelled historical renewals are normal, so flagging raw total would false-positive. This flags the actual anomaly a merge creates.Tests
Dedupable).🤖 Generated with Claude Code