Merged
Conversation
069f520 to
a6f8f9c
Compare
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="alembic/versions/c9e4f54f0a2b_canonicalize_duplicate_custom_scope_links.py">
<violation number="1" location="alembic/versions/c9e4f54f0a2b_canonicalize_duplicate_custom_scope_links.py:73">
P1: Migration queries lack a `source` filter, risking deletion of legitimate org-created custom scopes. All three steps match scopes solely by `name`, but the `scope` table has a `source` column (`'platform'` / `'custom'`). Adding a filter like `AND custom_scope.source = 'platform'` (if the seeding bug wrote duplicates with platform source) or an equivalent constraint would prevent accidental deletion of intentional org-specific custom scopes that coincidentally share a name with a platform scope. This is especially important given the migration is irreversible.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
alembic/versions/c9e4f54f0a2b_canonicalize_duplicate_custom_scope_links.py
Show resolved
Hide resolved
daryllimyt
pushed a commit
that referenced
this pull request
Feb 27, 2026
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.
Problem
Registry action scopes were being seeded in two places: as platform scopes (organization_id = NULL) and again as per-organization custom scopes. Because both used the same scope
names, this created duplicate scope records and redundant role_scope links, which inflated RBAC data and made scope assignment non-canonical.
Solution
This PR makes platform scopes the single source of truth for registry actions and removes duplicate data paths:
Summary by cubic
Canonicalizes duplicate registry action scopes by remapping role-scope links to platform scopes and deleting redundant custom scopes. Seeding now inserts platform scopes only, and the migration is constrained to registry action scopes (execute) to avoid touching unrelated scopes.
Bug Fixes
Migration
Written for commit c098cd6. Summary will update on new commits.