fix(invitation): remove user relation on invitation delete#1678
fix(invitation): remove user relation on invitation delete#1678whoAbhishekSah wants to merge 1 commit into
Conversation
Invitation creation writes two SpiceDB tuples on the invitation object: app/invitation:<id>#user and app/invitation:<id>#org. Delete filtered by the org relation name only, so the #user tuple leaked on every accept, expire, and delete, accumulating orphan relations. Drop the relation-name filter so Delete removes every relation anchored on the invitation object (same pattern role.Delete already uses). Adds an e2e regression assertion: after accepting an invitation, no relation remains on the invitation object. Refs #1661 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR fixes a relation leakage bug in invitation deletion where the user relation tuple was not being cleaned up. The implementation change broadens relation deletion to remove both user and org tuples, and a regression test verifies the fix works correctly after invitation acceptance. ChangesInvitation relation cleanup fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 27010255188Coverage increased (+0.005%) to 43.226%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
What
Invitation creation writes two SpiceDB tuples anchored on the invitation object:
app/invitation:<id>#user@app/user:<email>app/invitation:<id>#org@app/organization:<org>Invitation.Deletefiltered the relation delete by the org relation name only, so the#usertuple was left behind on every accept, expire, and delete. These orphan tuples accumulated in SpiceDB over time.Fix
Drop the
RelationNamefilter inDeleteso it removes every relation anchored on the invitation object (the same patternrole.Deletealready uses).Acceptalready routes its cleanup throughDelete, so accept is covered too.Test
Extends the existing
TestInvitationAPIaccept flow with an assertion that, after accepting an invitation,ListRelationsreturns no relation on the invitation object. Verified the assertion fails without the fix (leftover#usertuple) and passes with it.Addresses gap (3) of #1661.