Skip to content

feat(BA-7731): carry the role's scope and the permission's bit in the responses - #14446

Merged
HyeockJinKim merged 2 commits into
mainfrom
BA-7731
Sep 9, 2026
Merged

feat(BA-7731): carry the role's scope and the permission's bit in the responses#14446
HyeockJinKim merged 2 commits into
mainfrom
BA-7731

Conversation

@HyeockJinKim

@HyeockJinKim HyeockJinKim commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • A role belongs to one scope since BA-7730, but nothing said which one on the way out. RoleNode, RoleGQL and the v1 RoleDTO now carry scope_type and scope_id, read off the row as an EntityType and an EntityID — no element enum stands between the column and the wire.
  • A permission row answers with permission, the bit it actually holds. operation stays, carrying the same bit named as an action, and is deprecated.
  • PermissionBitGQL moves from entity_share to the shared rbac scope module. entity_share imports rbac, so reading the enum back from rbac closed a circle. The enum is unreleased, so the move leaves the schema unchanged.

Schema changes

Every change is additive; the graphql-inspector check reports no breaking change.

+ permission: PermissionBit!   (Added in 26.9.0)
+ operation  @deprecated       (Deprecated since 26.9.0. Use `permission`.)
+ scopeType: String!           (Added in 26.9.0)
+ scopeId: UUID!               (Added in 26.9.0)

Not in scope

The v1 REST PermissionDTO and ObjectPermissionDTO keep operation alone. The v1 types module has no bit enum, and mirroring the deprecation there would make v1 depend on v2. Dropping the scope from the permission rows themselves is BA-7732.

Test plan

  • pants lint and pants check --changed-dependents=transitive over the change set
  • pants test --changed-since --changed-dependents=direct (11 targets)
  • CI

Resolves BA-7731

🤖 Generated with Claude Code

https://claude.ai/code/session_013UiMJNt9dasPDtpBP7sSsC


📚 Documentation preview 📚: https://sorna--14446.org.readthedocs.build/en/14446/


📚 Documentation preview 📚: https://sorna-ko--14446.org.readthedocs.build/ko/14446/

… responses

A role now belongs to one scope, but nothing said which one on the way out.
The response says it, and a permission row says the bit it holds under the
name the bit has.

- `RoleNode`, `RoleGQL` and the v1 `RoleDTO` carry `scope_type` and
  `scope_id`, read off the row as an `EntityType` and an `EntityID`. No
  element enum stands between the column and the wire.
- A permission row answers with `permission`, the bit it holds.
  `operation` stays as the same bit named as an action, deprecated.
- `PermissionBitGQL` moves to the shared rbac scope module. It sat in
  `entity_share`, which imports rbac, so reading it from rbac closed a
  circle. The enum is unreleased, so the schema is unchanged by the move.

Every schema change here is additive.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UiMJNt9dasPDtpBP7sSsC
Copilot AI balanced review requested due to automatic review settings September 9, 2026 01:28
@HyeockJinKim
HyeockJinKim requested a review from a team as a code owner September 9, 2026 01:28
@github-actions github-actions Bot added size:L 100~500 LoC area:docs Documentations comp:manager Related to Manager component comp:common Related to Common component labels Sep 9, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UiMJNt9dasPDtpBP7sSsC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed changes have no unresolved approval-blocking issues.

Pull request overview

Adds role scope metadata and exposes explicit permission bits while preserving the deprecated operation field.

Changes:

  • Adds scope_type and scope_id to role responses.
  • Adds permission and deprecates operation.
  • Relocates the shared GraphQL permission enum.
  • Updates adapters, DTOs, schemas, tests, and changelogs.
File summaries
File Description
tests/unit/manager/api/gql/rbac/test_permission_mutations.py Updates permission fixtures.
tests/unit/common/dto/manager/v2/rbac/test_response.py Tests scope and permission response fields.
tests/unit/client_v2/test_rbac.py Updates role response fixtures.
tests/unit/client_v2/test_rbac_client.py Updates client fixtures.
src/ai/backend/manager/api/rest/rbac/role_adapter.py Maps role scope into v1 responses.
src/ai/backend/manager/api/gql/rbac/types/scope.py Hosts the shared permission-bit enum.
src/ai/backend/manager/api/gql/rbac/types/role.py Exposes role scope fields.
src/ai/backend/manager/api/gql/rbac/types/permission.py Exposes permission bits and deprecates operation.
src/ai/backend/manager/api/gql/entity_share/types.py Reuses the shared permission-bit enum.
src/ai/backend/manager/api/adapters/rbac/adapter.py Maps scope and permission data into DTOs.
src/ai/backend/common/dto/manager/v2/rbac/response.py Extends v2 response models.
src/ai/backend/common/dto/manager/rbac/response.py Extends v1 role responses.
docs/manager/graphql-reference/v2-schema.graphql Updates the v2 GraphQL schema reference.
docs/manager/graphql-reference/supergraph.graphql Updates the composed schema.
changes/14446.feature.md Documents the new response fields.
changes/14446.deprecation.md Documents the operation deprecation.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@HyeockJinKim
HyeockJinKim merged commit 8d40f0c into main Sep 9, 2026
46 of 48 checks passed
@HyeockJinKim
HyeockJinKim deleted the BA-7731 branch September 9, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:common Related to Common component comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants