Repository navigation
[HfFileSystem] Fix glob crash when the parent listing is outdated - #5237
Merged
Merged
Conversation
|
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. |
Collaborator
Author
|
cc @lhoestq for vis |
hanouticelina
marked this pull request as ready for review
October 22, 2026 13:09
hanouticelina
commented
Oct 22, 2026
hanouticelina
left a comment
Collaborator
Author
There was a problem hiding this comment.
Looks good to me ✅
hanouticelina
added a commit
that referenced
this pull request
Oct 22, 2026
Member
|
thx ! |
Contributor
|
This PR has been shipped as part of the v2.3.0 release. |
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.
Since #5097 (v2.2.0),
Dataset.push_to_hub("buckets/...")into a new bucket fails withFileNotFoundError: buckets/<id>/data. datasets' bucket integration tests have been failing on this since 2.2.0, unnoticed because those jobs usecontinue-on-error.Summary
globlistsdata/from the Hub, theninfo()looksdataup in the cached listing of the bucket root, taken before the files were uploaded throughHfApi. [HfFileSystem] fixls()on new empty bucket #5097 started caching empty bucket roots, so the first push to a new bucket always fails. A bucket with files but nodata/folder already failed this way before [HfFileSystem] fixls()on new empty bucket #5097.datasets'
tests/test_upstream_hub.py -m integration -k bucketon hub-ci: 5 failed with 2.3.0rc0, 7 passed with this branch.Decision: fixed in the
HfFileSystemcache rather than only in datasets (which could callinvalidate_cache()after uploading), since an outdated cache shouldn't makeglobfail on a folder it just listed.Note
Medium Risk
Touches core listing/cache logic used by ls, glob, and info; behavior change is narrow (drop parent cache only when inconsistent) but affects all repo and bucket tree listings.
Overview
Fixes
glob/info()failures whenHfFileSystem.dircachestill holds a stale parent directory listing (e.g. an empty bucket root from before uploads).After a successful Hub listing in
_ls_tree, the code now calls_drop_outdated_parent_listing: if the parent’s cached children don’t include the path that was just listed, that parent entry is removed so the nextinfo()re-lists instead of raisingFileNotFoundError. Empty-directory caching (dircache[path] = []) is unchanged when the listing is truly empty.Reviewed by Cursor Bugbot for commit d7a905c. Bugbot is set up for automated code reviews on this repo. Configure here.