fix(BA-4879): Update vfolder client to match new REST API response format#9663
Open
fix(BA-4879): Update vfolder client to match new REST API response format#9663
Conversation
…rmat
Server responses are now wrapped in {"item": {...}} instead of returning
data at the top level. Also fixes field renames (numFiles -> num_files,
inviter_user_email -> inviter) and the _get_id_by_name() endpoint which
now accepts the folder name as a query param instead of a JSON body.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the legacy vfolder client SDK and CLI output handling to align with the manager REST API’s updated response/field formats (notably the new single-item {"item": ...} envelope).
Changes:
- Unwrap
{"item": ...}for vfoldercreate(),info(),clone(), and ID lookup (_get_id_by_name()readsdata["item"]["id"]). - Change vfolder ID lookup to pass the folder name via query param (
vfolder_name=) instead of a JSON body. - Update CLI output field names (
numFiles→num_files,inviter_user_email→inviter).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/ai/backend/client/func/vfolder.py |
Unwraps the new item envelope for several endpoints and updates ID lookup request/response parsing. |
src/ai/backend/client/cli/vfolder.py |
Adjusts displayed field names in vfolder info and vfolder invitations to match the new API contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…sponse format
- Add explicit type annotation for `result["item"]` to fix mypy no-any-return errors
- Update test mock payloads to wrap responses in `{"item": ...}` wrapper
- Update test mock URLs for `_get_id_by_name` to use query params instead of JSON body
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.
resolves #9662 (BA-4879)
Update the vfolder client SDK (
client/func/vfolder.py) and CLI (client/cli/vfolder.py) to match the updated server REST API response format, and fix the resulting mypy type errors and unit test mocks.The server now wraps single-item responses in
{"item": {...}}. This PR unwraps that envelope increate(),info(), andclone()so callers receive the inner dict directly. Each unwrap site uses an explicit intermediate variable (item: dict[str, Any] = result["item"]) to satisfy mypy'sno-any-returncheck. Additionally,_get_id_by_name()now sends the folder name as a query parameter (vfolder_name=) instead of a JSON body and reads the id fromdata["item"]["id"].Field renames in CLI output are also applied to match the new API contract:
numFiles->num_filesinvfolder infoinviter_user_email->inviterinvfolder invitationsUnit tests in
tests/unit/client/test_vfolder.pyandtests/unit/client/test_vfolder_tus.pyare updated to reflect these changes: mock payloads are wrapped in{"item": ...}, and_get_id_by_namemocks use query-parameter URLs. Thebuild_urlhelper in the TUS test module gains an optionalparamsargument to support URL-encoded query parameters.Checklist: (if applicable)
ai.backend.testdocsdirectory