Conversation
Base automatically changed from
maebeale/check-person-license-number
to
main
September 10, 2026 14:07
Move pay_customers off DEFERRED so ModelDeduper reassigns them (and their charges/ subscriptions via customer_id) to the survivor, and skip soft-delete unique indexes (a [owner, deleted_at] index doesn't bound live rows in MySQL) so colliding live customers move rather than one being destroyed. Then ReconcileDefaultPayCustomer settles the survivor to a single default customer (its own pre-merge default, else the newest) so Pay's payment_processor isn't ambiguous. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale
force-pushed
the
maebeale/paycustomer-dedupe
branch
from
September 10, 2026 14:08
2ff3f0e to
74e2ffd
Compare
maebeale
requested review from
jmilljr24
and
a lite review from Copilot
and removed request for
Copilot
September 10, 2026 14:30
maebeale
marked this pull request as ready for review
September 10, 2026 14:30
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 📖 contained merge-time reconciliation of Pay customers
Merging two billable people left their Stripe/Pay data behind:
pay_customerswere skipped by the deduper (deferred), so the deleted person's customer + charges were orphaned, and when both people had a default customer the survivor ended up with two — making Pay'spayment_processor(has_one … default: true) ambiguous.pay_customersoffDEFERREDsoModelDeduperreassigns them (charges/subscriptions/payment_methods follow viacustomer_id) to the survivor.[owner, deleted_at]index doesn't bound live rows to one per owner in MySQL (NULLs are distinct), so two live customers move rather than one being destroyed.PersonServices::ReconcileDefaultPayCustomer(inafter_merge) settles the survivor to a single default — its own pre-merge default, else the newest — demoting the rest.