Fix set_space_volume / delete_space_volume return types#4061
Merged
Conversation
PUT/DELETE /spaces/.../volumes may return JSON without a top-level stage. HfApi.set_space_volumes and delete_space_volumes now fall back to get_space_runtime when the body is empty or not a full runtime payload. Made-with: Cursor
…allback Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Member
Member
Author
|
yup @davanstrien exactly, thanks for that PR! |
Wauplin
approved these changes
Apr 8, 2026
Contributor
Wauplin
left a comment
There was a problem hiding this comment.
✔️
(cc @hanouticelina if you can approve since I've written the PR)
Contributor
|
Hey @abidlabs thanks for reporting and very sorry we've not tested this before shipping (my bad on this one 🙈 ). Simplest solution here is to return None and let the user make an additional call to |
Wauplin
added a commit
that referenced
this pull request
Apr 8, 2026
* fix: parse Space volumes mutation response or fetch runtime PUT/DELETE /spaces/.../volumes may return JSON without a top-level stage. HfApi.set_space_volumes and delete_space_volumes now fall back to get_space_runtime when the body is empty or not a full runtime payload. Made-with: Cursor * refactor: parse SpaceRuntime from mutation response with try/except fallback Made-with: Cursor * test: collapse Space volumes mutation tests into one case Made-with: Cursor * test: keep single Space volumes regression (non-runtime JSON payload) Made-with: Cursor * just return None --------- Co-authored-by: Lucain Pouget <[email protected]>
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.
🚨 This PR removes the returned value of both
set_space_volumesanddelete_space_volumes. This is a breaking change but in practice it never worked so it's more of a fix ^^Not sure if this is a problem with Hub server or library, but basically I've noticed that
PUT/DELETE/api/spaces/{repo_id}/volumescan return a JSON body that is not a full Space runtime document (e.g. only volume-related fields, no top-levelstage). The client always didreturn SpaceRuntime(r.json()), which raises whenstageis missing:Now working correctly with
Noticed while testing the latest version of
huggingface_hub(1.9.1) withtrackioNote
Medium Risk
This is a behavior/signature change for two public client methods and may break callers relying on the returned
SpaceRuntime, though the logic change itself is small and localized.Overview
Adjusts Space volume mutation APIs to no longer parse and return
SpaceRuntimefromPUT/DELETE /api/spaces/{repo_id}/volumesresponses.HfApi.set_space_volumesandHfApi.delete_space_volumesnow returnNoneand drop the documented return value, preventingSpaceRuntime(r.json())failures when the server returns a partial body.Reviewed by Cursor Bugbot for commit 029bedd. Bugbot is set up for automated code reviews on this repo. Configure here.