Conversation
Contributor
Reviewer's GuideThis follow-up fixes reconcile cleanup so stale organization groups revoke mirrored authority without changing teardown behavior, documents the membership/grant and deletion invariants, preserves widget database routing, and adds regression and teams schema authorization-canary coverage. Sequence diagram for reconciling stale organization groupssequenceDiagram
participant Reconciler
participant PermissionGroup
participant Member
participant Grant
Reconciler->>PermissionGroup: reconcile_org_groups(org)
Reconciler->>PermissionGroup: PermissionGroup.objects.filter(...).prefetch_related(user_set)
loop each stale group member
Reconciler->>Member: unmirror_membership_grants(member, [permission_group])
Member->>Grant: revoke mirrored Grant
end
Reconciler->>PermissionGroup: PermissionGroup.objects.filter(pk__in=...).delete()
PermissionGroup-->>Reconciler: structural MTI cascade removes group memberships
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
vecchp
force-pushed
the
feat/perm/clients-grant-cutover
branch
from
September 10, 2026 21:18
a71e056 to
c20b0ba
Compare
…y, nits
F1 reconcile_org_groups unmirrors stale derived rows before deleting them,
so an org-type change fully revokes (mirrored Grants no longer survive
config cleanup); teardown deletes keep leaving Grants standing.
F2 signal docstring states the sanctioned exception precisely (m2m-manager
writers only); helper duplication already consolidated in #2451.
F3 same-row direct-grant revocation pinned by test + GrantAdmin fieldset
description (unique constraint makes both grants one row).
F4 moot — accounts/extensions.py deleted in 590dc50.
F5 set(dict) -> .keys().
F6 stale delete_orphaned_group refs corrected (services.py, admin.py);
tear-down described as the structural MTI cascade (migration 0007).
F7 LoadedRowRawIdWidget preserves the original widget's using kwarg.
F8 teams/tests/test_authz_registry.py canary added (4 fields).
vecchp
force-pushed
the
chore/perm-2443-review-fixes
branch
from
September 10, 2026 21:18
fb435d0 to
70757e9
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.
What
Follow-up to #2443's adversarial review (Mike's "Previous review items — status" comment): the code fixes for the outstanding findings, stacked on the clients cutover (#2455) so the chain keeps merging bottom-up. #2443 itself is untouched — merge it (and the chain) first.
Findings
reconcile_org_groupsunmirrors each stale derived row's members before deleting it (unmirror_membership_grants), so dropping an org type now fully revokes both arms; teardown deletes keep leaving Grants standing. Pinned bytest_reconcile_of_a_stale_group_unmirrors_the_grant.bulk_create/raw SQL/loaddata/queryset.updatebypass — ADR 0001 §4 phase 2). Helper duplication was already consolidated in #2451 (common/tests/utils.py).test_removing_a_membership_revokes_a_same_row_direct_grant;GrantAdminnow carries a fieldset description warning that the unique constraint makes a direct grant and a membership mirror the same row.PERMISSION_DENIED_MESSAGEaccounts/extensions.pywas deleted by590dc503(dead org-admin machinery); no non-test hardcoded literal remains.set(scoped_roles_for_groups(objs)).keys().accounts.signals.delete_orphaned_grouprefsservices.py(×2) and theadmin.pychange_viewdocstring found alongside; tear-down now described as the structural MTI cascade (migration 0007).LoadedRowRawIdWidgetdropsusinggetattr(widget, "using", None).teams/tests/test_authz_registry.pymirrors the shelters pattern: everyQuery/Mutationfield must be registered with its authorization route (4 fields:teams,create_team,update_team,delete_team).X-Organization-IDheader is fully retired (#2450 / #2452).Validation
ruff check+ruff format --checkclean on changed filesLanding order unchanged: #2415 + #2443 → #2444 → … → #2455 → this, bottom-up.
Summary by Sourcery
Harden organization-group permission reconciliation and teams authorization coverage.
Bug Fixes:
Enhancements:
Tests: