refactor(schema): remove member relation from app/organization#1701
refactor(schema): remove member relation from app/organization#1701rohilsurana wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 27538676235Coverage increased (+0.002%) to 43.633%Details
Uncovered Changes
Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
Summary
Removes the
memberrelation fromapp/organizationin the SpiceDB schema. After the parent PR (#1700) dropped+ memberfromorg.get, this relation had zero schema consumers — no permission resolved through it. This PR completes the removal by also stopping Go code from writing it.Stacked on #1700.
Schema change
definition app/organization { relation platform: app/platform relation granted: app/rolebinding relation pat_granted: app/rolebinding - relation member: app/user | app/group#member | app/serviceuser relation owner: app/user | app/serviceuserGo changes (core/membership)
orgRoleToRelation— non-owner roles now return""(was"member"). Only the owner role produces anownerrelation.AddOrganizationMember— skips SpiceDB relation write when the role doesn't map to a relation (non-owner adds create only the policy+rolebinding, which is sufficient for allgranted->permissions).SetOrganizationMemberRole— uses newreplaceOrRemoveRelationhelper: deletes oldownerrelation (if any), creates new only if non-empty. Demoting an owner to viewer now removes theownerrelation with no replacement.removeRelations— parameterized with explicit relation names. Org sweeps only[owner]; group sweeps[owner, member](groupmemberrelation is still live).linkGroupToOrg/unlinkGroupFromOrg— removed theorg#member@group#membertuple write/delete. This tuple made group members resolve as org members via thememberrelation — no longer needed since+ memberis gone from all org permissions.Existing SpiceDB tuples
Old
org#member@userandorg#member@group#membertuples remain in SpiceDB but are harmless — no permission definition references them, so they're unreachable by anyCheckorLookupSubjectscall.Test plan
go build ./...passesmake lintcleango test -race ./core/membership/... -count=2passes (17 test expectations updated)