Conversation
Add a common/tests meta-test that walks accounts/teams/shelters/reports Mutation resolvers and fails unless each one gates on the grant predicates (require_can/can_anywhere/can_obj/visible — or a scoped *_get/*_queryset load, ADR 0001 §2.6), delegates to a service/selector that does, or is deliberately exempted with a reason (auth + self-service mutations in accounts, plus create_organization). Verified by negative checks: a new ungated mutation is caught, a delegated gate passes, and a stale exemption entry fails the suite.
Contributor
Reviewer's GuideIntroduces a heuristic AST-based CI tripwire for grant gating: every mutation in accounts, reports, shelters, and teams must gate directly, delegate once to a gated service/selector, or use a documented valid exemption, while configuration and exemption drift fail loudly. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
CI lint (uv run ruff format --check .) caught a wrap that fits on one line (108 < 120 columns).
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
A meta-test (
common/tests/test_org_mutation_gating.py) that fails CI when a mutation in a grant-cutover module (accounts,teams,shelters,reports) ships without a grant gate.Rule
Each
@mutationresolver in those schemas must either:require_can(/can_anywhere(/can_obj(/visible(/ scoped*_get/*_querysetload (ADR 0001 §2.6), orshelters.schemaresolvers pass, orGATE_EXEMPTwith a reason — only the non-org mutations:login,logout,update_current_user,update_user_profile,delete_current_user,create_organization.A second test keeps the exemption table honest: a stale entry (no such mutation any more) or a missing reason fails the suite. It is a heuristic tripwire, not a proof — the docstring says so; the point is every new mutation forces a conscious gate-or-exempt decision.
Verified
common/tests232 passed; ruff clean.Stacked on #2452 (last layer of the perm stack). Frontend for the header removal: #2452; meta-test stack position: after it.
Summary by Sourcery
Enforce conscious grant-gating decisions for every mutation in grant-cutover modules.
Enhancements:
Tests:
Chores: