Skip to content

API: membership dedup migration leaves loser profile links as active rows #812

Description

@radandevist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't workingpr806-residueDeferred findings from the PR #806 review-fix loop; handled separately

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions