Where: apps/api/Migrations/20260714135430_AddUserAccountMembershipUniqueness.cs:125
Problem: With legacy duplicate accounts old/new where only old is assigned profile P, the migration inserts new-P and soft-deletes old but leaves old-P. Profile endpoints then report two assigned users for one actual active membership, and may sort/page by that false count.
Fix: After copying assignments, hard-delete user_account_profiles belonging to loser IDs before soft-deleting the accounts. Extend the migration spec to assert the loser link is absent and the total link count is one, across staff/tenant/project dedup partitions.
Filed from the PR #806 review-fix loop (round 7, gpt-5.6-sol @ high). Branch feat/front-2-full-parity-handoff. Not a blocker; deferred for separate handling.
Where:
apps/api/Migrations/20260714135430_AddUserAccountMembershipUniqueness.cs:125Problem: With legacy duplicate accounts old/new where only old is assigned profile P, the migration inserts new-P and soft-deletes old but leaves old-P. Profile endpoints then report two assigned users for one actual active membership, and may sort/page by that false count.
Fix: After copying assignments, hard-delete
user_account_profilesbelonging to loser IDs before soft-deleting the accounts. Extend the migration spec to assert the loser link is absent and the total link count is one, across staff/tenant/project dedup partitions.Filed from the PR #806 review-fix loop (round 7, gpt-5.6-sol @ high). Branch
feat/front-2-full-parity-handoff. Not a blocker; deferred for separate handling.