feat(BA-5764): add RBAC-enforced VFolder delete and restore mutations#11164
Draft
feat(BA-5764): add RBAC-enforced VFolder delete and restore mutations#11164
Conversation
24465bc to
83a49cf
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds RBAC-enforced soft-delete (trash) for v2 vfolders via a new SingleEntityActionProcessor action, and exposes “restore from trash” across GraphQL, REST v2, SDK, and CLI, backed by the existing restore action.
Changes:
- Introduces
DeleteVFolderV2RBACAction+ processor/service plumbing and a repositorytrash_vfolder()update path using anUpdaterSpec. - Adds
/v2/vfolders/{id}/restoreREST endpoint,restoreVFolderGraphQL mutation, SDKrestore(), and CLIvfolder restore. - Adds unit/component tests for the new repository trash/restore behavior and RBAC denial paths.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/manager/repositories/vfolder/test_vfolder_repository.py | Adds unit tests for trash_vfolder() and restore_vfolders_from_trash() |
| tests/component/vfolder_v2/test_vfolder_mutation.py | New component tests exercising v2 delete/restore via SDK with RBAC |
| src/ai/backend/manager/services/vfolder/services/vfolder.py | Adds delete_v2_rbac() service method for RBAC-enforced soft-delete |
| src/ai/backend/manager/services/vfolder/processors/vfolder.py | Registers delete_v2_rbac as a SingleEntityActionProcessor with RBAC validators |
| src/ai/backend/manager/services/vfolder/actions/vfolder_in_project.py | New RBAC action/result types for v2 delete |
| src/ai/backend/manager/repositories/vfolder/updaters.py | Adds VFolderTrashUpdaterSpec to set status to DELETE_PENDING |
| src/ai/backend/manager/repositories/vfolder/repository.py | Adds trash_vfolder() repository method using execute_updater() |
| src/ai/backend/manager/api/rest/v2/vfolder/registry.py | Registers POST /{vfolder_id}/restore route |
| src/ai/backend/manager/api/rest/v2/vfolder/handler.py | Adds REST handler for restore |
| src/ai/backend/manager/api/gql/vfolder_v2/types/mutations.py | Adds GraphQL payload type for restore |
| src/ai/backend/manager/api/gql/vfolder_v2/resolver/mutation.py | Adds restoreVFolder GraphQL mutation |
| src/ai/backend/manager/api/gql/vfolder_v2/resolver/init.py | Exports restore mutation resolver |
| src/ai/backend/manager/api/gql/vfolder_v2/init.py | Re-exports restore mutation from module |
| src/ai/backend/manager/api/gql/schema.py | Wires restore mutation into the GraphQL schema |
| src/ai/backend/manager/api/adapters/vfolder.py | Routes delete() to RBAC processor; adds adapter restore() |
| src/ai/backend/client/v2/domains_v2/vfolder.py | Adds SDK restore() method for REST v2 endpoint |
| src/ai/backend/client/cli/v2/vfolder/commands.py | Adds CLI vfolder restore command |
| changes/BA-5764.feature.md | Towncrier fragment for the feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b930805 to
096820e
Compare
jopemachine
reviewed
Apr 17, 2026
Add DeleteVFolderV2RBACAction (SingleEntityActionProcessor + RBAC) with Updater/execute_updater pattern. Expose restoreVFolder GQL mutation, REST endpoint, SDK method, and CLI command backed by existing RestoreVFolderFromTrashAction. Adapter delete() routes to RBAC path; bulk_delete() stays on legacy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: octodog <mu001@lablup.com>
Rename the Strawberry `name=` override so the exposed GraphQL type is `RestoreVFolderPayload` instead of `RestoreVFolderV2Payload`, matching the preferred V2-free naming convention for new types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4449356 to
fbd8f72
Compare
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
DeleteVFolderV2RBACAction(SingleEntityActionProcessor+single_entity_rbac_validators) withUpdater/execute_updaterpattern via newVFolderTrashUpdaterSpec+trash_vfolder()repository method.restoreVFolderGQL mutation, RESTPOST /v2/vfolders/{id}/restore, SDKrestore(), and CLIrestorecommand backed by existingRestoreVFolderFromTrashActionwith RBAC.Test plan
pants fmt/fix/lint— greenpants check— green (pre-existing processors.py errors only)TestDeleteVFolderRBAC(regular user 403, superadmin bypass) +TestRestoreVFolderRBAC(regular user 403) via SDKTestVFolderRepositoryTrashAndRestore(trash sets DELETE_PENDING, not found, restore→READY, nonexistent empty)Resolves BA-5764
📚 Documentation preview 📚: https://sorna--11164.org.readthedocs.build/en/11164/
📚 Documentation preview 📚: https://sorna-ko--11164.org.readthedocs.build/ko/11164/