Skip to content

feat(BA-5737): add RBAC-enforced VFolder create mutations#11139

Draft
fregataa wants to merge 2 commits intomainfrom
feature/BA-5737-project-vfolder-mutations
Draft

feat(BA-5737): add RBAC-enforced VFolder create mutations#11139
fregataa wants to merge 2 commits intomainfrom
feature/BA-5737-project-vfolder-mutations

Conversation

@fregataa
Copy link
Copy Markdown
Member

@fregataa fregataa commented Apr 16, 2026

Summary

  • Add createProjectVfolderV2 GraphQL mutations so project admin flows have a consistent project-scoped mutation surface alongside the existing projectVfolders query.

Test plan

  • pants fmt :: && pants fix :: && pants lint --changed-since=origin/main — green
  • Manual verification with live server after CI green

Resolves BA-5737


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


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

Copilot AI review requested due to automatic review settings April 16, 2026 05:39
@github-actions github-actions bot added size:XL 500~ LoC comp:manager Related to Manager component labels Apr 16, 2026
fregataa added a commit that referenced this pull request Apr 16, 2026
@github-actions github-actions bot added the area:docs Documentations label Apr 16, 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

Adds a project-scoped mutation surface for vfolder v2 so project admin flows can create/delete vfolders via PROJECT-scoped RBAC (consistent with the existing projectVfolders query).

Changes:

  • Introduce PROJECT-scoped vfolder actions (Create/Delete/BulkDelete*InProject) and wire them through ScopeActionProcessor using scope RBAC validators.
  • Expose new GraphQL mutations (createProjectVfolderV2, deleteProjectVfolderV2, bulkDeleteProjectVfoldersV2) backed by the new adapter methods.
  • Add unit/component test coverage for delete/bulk-delete project-scoped paths and service routing.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/manager/services/vfolder/test_vfolder_in_project_service.py Unit tests for service delegation and project membership checks.
tests/component/vfolder_v2/test_vfolder_project_mutations.py Component tests exercising RBAC + service behavior for project-scoped deletes.
src/ai/backend/manager/services/vfolder/services/vfolder.py Adds create_in_project, delete_in_project, bulk_delete_in_project service methods.
src/ai/backend/manager/services/vfolder/processors/vfolder.py Registers new PROJECT-scoped action processors and supported action specs.
src/ai/backend/manager/services/vfolder/actions/vfolder_in_project.py New PROJECT-scoped action/result dataclasses for create/delete/bulk-delete.
src/ai/backend/manager/api/gql/vfolder_v2/resolver/mutation.py Adds new GraphQL mutations for project-scoped create/delete/bulk-delete.
src/ai/backend/manager/api/gql/vfolder_v2/resolver/init.py Exports the new mutation resolvers.
src/ai/backend/manager/api/gql/vfolder_v2/init.py Re-exports new vfolder v2 mutations for schema wiring.
src/ai/backend/manager/api/gql/schema.py Adds new mutation fields to the GraphQL Mutation type.
src/ai/backend/manager/api/adapters/vfolder.py Adds adapter entrypoints that dispatch project-scoped actions to processors.

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

Comment thread src/ai/backend/manager/api/gql/vfolder_v2/resolver/mutation.py
Comment thread src/ai/backend/manager/services/vfolder/services/vfolder.py Outdated
Comment thread src/ai/backend/manager/services/vfolder/services/vfolder.py Outdated
Comment thread src/ai/backend/manager/services/vfolder/services/vfolder.py Outdated
fregataa added a commit that referenced this pull request Apr 16, 2026
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch from c8a7a42 to 14fd0ed Compare April 16, 2026 06:19
Comment thread docs/manager/graphql-reference/supergraph.graphql Outdated
@jopemachine
Copy link
Copy Markdown
Member

I remembered there was a discussion about not using VFolderV2 in GraphQL because it would interfere with the agentic workflow.

Comment thread tests/unit/manager/services/vfolder/test_vfolder_in_project_service.py Outdated
@fregataa fregataa marked this pull request as draft April 16, 2026 07:48
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch from e2e94f0 to 6021bea Compare April 16, 2026 08:32
@github-actions github-actions bot added comp:client Related to Client component comp:cli Related to CLI component labels Apr 16, 2026
fregataa added a commit that referenced this pull request Apr 16, 2026
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch from 6021bea to 82bb6c1 Compare April 16, 2026 08:35
@fregataa fregataa requested a review from yomybaby April 16, 2026 08:37
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch 2 times, most recently from cb815be to eb22e8e Compare April 16, 2026 09:23
fregataa added a commit that referenced this pull request Apr 16, 2026
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch from 638554d to 3de71a7 Compare April 16, 2026 11:15
fregataa added a commit that referenced this pull request Apr 16, 2026
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch 2 times, most recently from a95a4d9 to 9e1e8e9 Compare April 16, 2026 12:31
Comment on lines +1637 to +1639
self, action: CreateVFolderInProjectAction
) -> CreateVFolderInProjectActionResult:
"""Create a vfolder owned by a project.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This function works same as create_v2() except permission check

@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch 2 times, most recently from 5f76a19 to 2e5bb7c Compare April 16, 2026 12:59
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch from 69e108d to e3e1065 Compare April 16, 2026 13:17
fregataa added a commit that referenced this pull request Apr 16, 2026
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch 2 times, most recently from 6968641 to bb99e05 Compare April 16, 2026 14:33
@github-actions github-actions bot added size:L 100~500 LoC and removed size:XL 500~ LoC labels Apr 16, 2026
@fregataa fregataa marked this pull request as ready for review April 16, 2026 15:16
@fregataa fregataa requested review from a team and jopemachine April 16, 2026 15:16
@jopemachine
Copy link
Copy Markdown
Member

PR title seems outdated

"""
Added in UNRELEASED. Create a virtual folder owned by the specified project. Requires project-scoped CREATE permission.
"""
createProjectVFolder(projectId: UUID!, input: CreateVFolderV2Input!): CreateVFolderV2Payload! @join__field(graph: STRAWBERRY)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

VFolderV2 is still included

Copy link
Copy Markdown
Member Author

@fregataa fregataa Apr 19, 2026

Choose a reason for hiding this comment

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

CreateVFolderV2Input is an existing type, not a new one

@fregataa fregataa changed the title feat(BA-5737): add project-scoped VFolder create/delete GraphQL mutations feat(BA-5737): add RBAC-enforced VFolder create mutations Apr 17, 2026
fregataa and others added 2 commits April 19, 2026 18:40
Add createProjectVFolder GraphQL mutation, REST POST endpoint, SDK
method, and CLI command for creating vfolders within a project scope.
Uses ScopeActionProcessor + scope_rbac_validators. Independent
create_in_project() service — no legacy UserRole gate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: octodog <mu001@lablup.com>
@fregataa fregataa force-pushed the feature/BA-5737-project-vfolder-mutations branch from 499eb4c to 305e551 Compare April 19, 2026 09:41
@fregataa fregataa requested a review from jopemachine April 19, 2026 09:57
Comment on lines +6791 to +6794
"""
Added in UNRELEASED. Create a virtual folder owned by the specified project. Requires project-scoped CREATE permission.
"""
createProjectVFolder(projectId: UUID!, input: CreateVFolderV2Input!): CreateVFolderV2Payload!
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It seems there’s already a mutation that uses CreateVFolderV2Input; please check that. Since the projectId value is already included, it feels like we’re setting a duplicate field.

@fregataa fregataa marked this pull request as draft April 20, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:cli Related to CLI component comp:client Related to Client 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.

4 participants