Skip to content

feat(BA-5349): add GraphQL query for entity-operation combinations#10537

Open
fregataa wants to merge 4 commits intomainfrom
feat/BA-5349
Open

feat(BA-5349): add GraphQL query for entity-operation combinations#10537
fregataa wants to merge 4 commits intomainfrom
feat/BA-5349

Conversation

@fregataa
Copy link
Member

@fregataa fregataa commented Mar 26, 2026

Summary

  • Add rbac_entity_operation_combinations GraphQL query that exposes valid entity-operation combinations from the RBAC action registry, enabling the frontend to discover which operations are available per entity type
  • Extract RBAC_ACTION_REGISTRY shared constant and add build_operation_description() for generating human-readable operation descriptions
  • Add DTOs (OperationInfo, EntityOperationCombinationInfo), GQL types (OperationInfoGQL, EntityOperationCombinationGQL), and resolver following the existing rbac_scope_entity_combinations pattern

Test plan

  • Unit tests for build_operation_description() covering all action names and underscored element types
  • Unit tests for resolver: structure validation, operation sorting, entity type sorting, registry coverage
  • All existing RBAC tests pass (tests/unit/manager/api/gql/rbac::)
  • pants fmt, pants fix, pants lint all pass

Example

query {
    rbacEntityOperationCombinations {
        entityType
        operations {
            operation
            description
            requiredPermission
        }
    }
}

Resolves BA-5349

🤖 Generated with Claude Code


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


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

Copilot AI review requested due to automatic review settings March 26, 2026 05:44
@github-actions github-actions bot added size:L 100~500 LoC comp:manager Related to Manager component comp:common Related to Common component labels Mar 26, 2026
fregataa added a commit that referenced this pull request Mar 26, 2026
@fregataa fregataa added this to the 26.4 milestone Mar 26, 2026
@github-actions github-actions bot added the area:docs Documentations label Mar 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new RBAC-focused GraphQL query that exposes valid entity/action-name combinations derived from a centralized RBAC action registry, so the frontend can discover which actions are available per entity type.

Changes:

  • Introduce rbac_entity_operation_combinations GraphQL root field and supporting GQL types/DTOs.
  • Extract shared RBAC_ACTION_REGISTRY constant and add build_operation_description() helper for human-readable action descriptions.
  • Add unit tests for the description builder and the new resolver (structure, sorting, and registry coverage).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/manager/api/gql/rbac/test_entity_operation_combinations.py Adds unit tests for build_operation_description() and the new GraphQL resolver.
src/ai/backend/manager/services/factory.py Switches permission controller wiring to use centralized RBAC_ACTION_REGISTRY.
src/ai/backend/manager/api/gql/schema.py Registers the new rbac_entity_operation_combinations query in the main GraphQL schema.
src/ai/backend/manager/api/gql/rbac/types/permission.py Adds GQL output types for operation info and entity-operation combinations.
src/ai/backend/manager/api/gql/rbac/types/init.py Exposes the new RBAC GQL types via package exports.
src/ai/backend/manager/api/gql/rbac/resolver/permission.py Implements the rbac_entity_operation_combinations resolver using RBAC_ACTION_REGISTRY.
src/ai/backend/manager/api/gql/rbac/resolver/init.py Exports the new resolver.
src/ai/backend/manager/api/gql/rbac/init.py Re-exports the new query field and types at the RBAC module level.
src/ai/backend/manager/actions/action/rbac.py Adds build_operation_description() helper for action descriptions.
src/ai/backend/manager/actions/action/init.py Introduces centralized RBAC_ACTION_REGISTRY constant and exports it.
src/ai/backend/common/dto/manager/v2/rbac/response.py Adds DTOs for operation info and entity-operation combinations.
src/ai/backend/common/dto/manager/v2/rbac/init.py Exposes the new DTOs via package exports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fregataa fregataa marked this pull request as draft March 26, 2026 07:22
fregataa added a commit that referenced this pull request Mar 27, 2026
@fregataa fregataa requested a review from ironAiken2 March 27, 2026 03:55
@fregataa fregataa marked this pull request as ready for review March 27, 2026 03:55
fregataa and others added 3 commits March 27, 2026 12:56
Add rbac_entity_operation_combinations query that exposes valid
entity-operation combinations from the RBAC action registry,
enabling the frontend to discover available operations per entity.

- Add build_operation_description() for human-readable descriptions
- Add OperationInfo and EntityOperationCombinationInfo DTOs
- Add OperationInfoGQL and EntityOperationCombinationGQL GQL types
- Extract RBAC_ACTION_REGISTRY shared constant from factory.py
- Register resolver on Query class
- Add unit tests for description generation and resolver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ations GQL query

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: octodog <mu001@lablup.com>
Copy link
Contributor

@ironAiken2 ironAiken2 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants