From 2e0f1b1068cbefd7dea7d3768d9cecf552d4368a Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 29 Jul 2026 07:41:20 +0000 Subject: [PATCH] Correct the dangling-ref docstring to name snapshot_download for PR #7375 --- studio/backend/hub/utils/inventory_scan.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/studio/backend/hub/utils/inventory_scan.py b/studio/backend/hub/utils/inventory_scan.py index df58c116ce..7c23352f83 100644 --- a/studio/backend/hub/utils/inventory_scan.py +++ b/studio/backend/hub/utils/inventory_scan.py @@ -214,11 +214,14 @@ def _recover_repo_hidden_by_dangling_refs(repo_dir: Path) -> Optional[_Recovered ``_scan_cached_repo`` assembles every revision successfully and only then raises ``CorruptedCacheException`` because a ``refs/`` file names a commit with no ``snapshots//`` dir, so ``scan_cache_dir`` omits an - entirely intact repo from ``.repos``. Studio creates that state itself: a - metadata probe that 404s writes ``refs/main`` at the live upstream HEAD - without materialising that snapshot, so any repo re-uploaded since it was - downloaded goes invisible to every inventory endpoint while the model - picker's plain directory walk still lists it. + entirely intact repo from ``.repos``. Studio creates that state itself: + ``snapshot_download`` writes ``refs/main`` at the live upstream sha *before* + fetching the first file and never creates ``snapshots//`` itself, and no + Studio caller pins ``revision``. So any repo re-uploaded since it was + downloaded goes invisible to every inventory endpoint the moment a refresh + starts, while the model picker's plain directory walk still lists it. No race + is needed: when the allow/ignore patterns match nothing the download returns + normally having written only the ref. This reads the same directories huggingface_hub reads and writes nothing: the ref file that upstream's assertion trips over is left exactly as it is.