Skip to content

feat(BA-5299): Add SessionV2GQL to EntityNode union and resolve SESSION in RBAC entity resolvers#10320

Merged
fregataa merged 5 commits into
mainfrom
BA-5299
Mar 20, 2026
Merged

feat(BA-5299): Add SessionV2GQL to EntityNode union and resolve SESSION in RBAC entity resolvers#10320
fregataa merged 5 commits into
mainfrom
BA-5299

Conversation

@fregataa
Copy link
Copy Markdown
Member

@fregataa fregataa commented Mar 19, 2026

Summary

  • Add SessionV2GQL to the EntityNode union in entity_node.py so sessions can be resolved as full entity nodes in RBAC queries
  • Add RBACElementType.SESSION resolve case in EntityRefGQL.entity resolver (entity.py) using session_loader
  • Add RBACElementType.SESSION resolve case in PermissionGQL.scope resolver (permission.py) using session_loader

Test plan

  • Verify pants lint passes for changed files
  • Verify pants check passes for changed files
  • Verify EntityNode GraphQL union includes SessionV2 type in schema

Resolves BA-5299

fregataa and others added 3 commits March 19, 2026 16:22
Add SessionV2GQL import and include it in the EntityNode union type
alongside the existing Session federation stub. This allows session
entities to be properly resolved in RBAC queries.

- Import SessionV2GQL from ai.backend.manager.api.gql.session.types
- Add SessionV2GQL to EntityNode union type definition
- Keep Session federation stub for compatibility with other files

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add RBACElementType.SESSION case to EntityRefGQL.entity resolver:
- Import SessionId and SessionV2GQL in method scope
- Load session data via session_loader with SessionId(UUID(entity_id))
- Return SessionV2GQL.from_data(session_data) when session exists
- Remove SESSION from catch-all None-returning case

This enables proper resolution of session entities in RBAC queries,
complementing the EntityNode union change from the previous commit.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add RBACElementType.SESSION case to the scope resolver in PermissionGQL
to properly resolve session entities in RBAC permission queries.

Changes:
- Import SessionId from ai.backend.common.types
- Import SessionV2GQL from ai.backend.manager.api.gql.session.types
- Add SESSION case that loads via session_loader with SessionId(UUID(scope_id))
- Remove SESSION from catch-all None-returning case

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 19, 2026 07:32
@github-actions github-actions Bot added size:S 10~30 LoC comp:manager Related to Manager component labels Mar 19, 2026
fregataa added a commit that referenced this pull request Mar 19, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fregataa fregataa requested a review from ironAiken2 March 19, 2026 07:32
@fregataa fregataa added this to the 26.4 milestone Mar 19, 2026
fregataa added a commit that referenced this pull request Mar 19, 2026
Copy link
Copy Markdown
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

This PR extends the RBAC GraphQL layer so SESSION RBAC elements can be resolved into the newer SessionV2 GraphQL node type, enabling sessions to appear as fully-resolved entity nodes in RBAC queries.

Changes:

  • Added SessionV2GQL to the EntityNode Strawberry union so it can be returned from RBAC resolvers.
  • Implemented RBACElementType.SESSION resolution in EntityRefGQL.entity using session_loader.
  • Implemented RBACElementType.SESSION resolution in PermissionGQL.scope using session_loader.

Reviewed changes

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

File Description
src/ai/backend/manager/api/gql/rbac/types/permission.py Adds SESSION scope resolution to SessionV2GQL via session_loader.
src/ai/backend/manager/api/gql/rbac/types/entity_node.py Extends EntityNode union to include SessionV2GQL.
src/ai/backend/manager/api/gql/rbac/types/entity.py Adds SESSION entity resolution to SessionV2GQL via session_loader.

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

Comment thread src/ai/backend/manager/api/gql/rbac/types/permission.py
Co-authored-by: octodog <mu001@lablup.com>
@github-actions github-actions Bot added size:M 30~100 LoC area:docs Documentations and removed size:S 10~30 LoC labels Mar 19, 2026
Copy link
Copy Markdown
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

@fregataa fregataa merged commit 747c603 into main Mar 20, 2026
36 checks passed
@fregataa fregataa deleted the BA-5299 branch March 20, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:manager Related to Manager component size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants