feat(BA-5299): Add SessionV2GQL to EntityNode union and resolve SESSION in RBAC entity resolvers#10320
Conversation
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>
fregataa
added a commit
that referenced
this pull request
Mar 19, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fregataa
added a commit
that referenced
this pull request
Mar 19, 2026
Contributor
There was a problem hiding this comment.
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
SessionV2GQLto theEntityNodeStrawberry union so it can be returned from RBAC resolvers. - Implemented
RBACElementType.SESSIONresolution inEntityRefGQL.entityusingsession_loader. - Implemented
RBACElementType.SESSIONresolution inPermissionGQL.scopeusingsession_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.
Co-authored-by: octodog <mu001@lablup.com>
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.
Summary
SessionV2GQLto theEntityNodeunion inentity_node.pyso sessions can be resolved as full entity nodes in RBAC queriesRBACElementType.SESSIONresolve case inEntityRefGQL.entityresolver (entity.py) usingsession_loaderRBACElementType.SESSIONresolve case inPermissionGQL.scoperesolver (permission.py) usingsession_loaderTest plan
pants lintpasses for changed filespants checkpasses for changed filesResolves BA-5299