Fix: TeamMemberSplit Referential Integrity (Issue #58) - #82
Open
gramseostudio-dev wants to merge 1 commit into
Open
Fix: TeamMemberSplit Referential Integrity (Issue #58)#82gramseostudio-dev wants to merge 1 commit into
gramseostudio-dev wants to merge 1 commit into
Conversation
|
@gramseostudio-dev is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
gramseostudio-dev
force-pushed
the
main
branch
from
August 18, 2026 01:59
c484d5d to
9b202f8
Compare
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.
Closes #58
Problem Description
User deletion was configured with
onDelete: 'CASCADE'on theTeamMemberSplitentity. This caused that if a user was deleted (e.g., account closure), their record in the team split configuration silently disappeared. This broke the business invariant where team split percentages must sum exactly to 100%, leaving bounties linked to that team stuck in aMERGEDstate without the ability to release the escrow (stuck MERGED bounty).Applied Changes
TeamMemberSplit.userrelation fromonDelete: 'CASCADE'toonDelete: 'RESTRICT'. This ensures the database blocks user deletion if they still have active financial commitments in a team.1784600000000-UpdateTeamMemberSplitOnDeleteto update the foreign key constraint on theteam_member_splitstable.test/team-split-integrity.e2e-spec.ts) that empirically verifies that deleting a user with active team memberships is successfully blocked by the database constraint.Design Notes / Considerations
The choice of
RESTRICTaligns with the established policy of other financial entities in the system (such asPayment.escrow). We recognize that this blocks legitimate user account deletions if they belong to an active team. We consider this a necessary safeguard for current financial integrity. It is our team's commitment to implement a future soft-delete or team membership deactivation mechanism, allowing users to "leave" older teams without needing to wipe their user record and without breaking foreign key restrictions.