Repository navigation
hf: give each listing its own header file - #989
Conversation
Concurrent listings in one process named their curl header file by the process ID alone, so one call could read or remove another's headers and end on its first page or follow another repository's next link. Each call now names its own file, and a header file that cannot be read after curl succeeded is an error instead of a last page. Fixes midagedev#986
There was a problem hiding this comment.
Verdict: CLEAN: Concurrent listings use separate header files, and unreadable headers return a named error.
Non-blocking
⚠ Reusable diagnosis: crates/hf/src/fetch.rs:407. The PR describes a temporary curl wrapper, but the diff retains no diagnostic listing trace. Keep that trace in an existing tool, or explain why the path-bearing I/O error is sufficient for diagnosis. This avoids reconstructing the probe during another concurrency failure.
Checked
Duplicates: dryer reported 0 pairs; the diff adds a call counter, a fixture repo count and two regression tests.
Complexity: crapper flagged no changed functions.
Silent failure: unreadable headers now propagate as HfError::Io; cleanup remains best effort. Fixture accept/write failures cannot fabricate the expected pages.
Tests: the concurrent test asserts each repo's two pages; the missing-header test requires HfError::Io naming the header path. Restoring the empty-header default defeats expect_err. The PR body reports FAIL-first results for both tests.
Gates: no bands, tolerances or lint levels moved. The spawn inventory accounts for the three new test spawn sites.
Escape catalog: no patterns matched.
Performance: HTTP discovery only; no decode, prefill or kernel path changes.
Notes
Tests were not executed here because their scratch helper writes under PR_TREE.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
Hugging Face 목록 조회가 동시에 돌 때 서로의 헤더 파일을 덮어써 페이지를 놓치던 문제를 호출마다 헤더 파일을 따로 두어 고쳤습니다.
What and why
Client::listing_atnamed its curl header file by process id only, so listings running at once in one process shared a single file. One call could read or delete another call's headers, and a repo with several pages returned only its first page or followed another repo'snextlink. This change names the header file per call (.listing-<pid>-<call>.headers, with a process-wide counter) and turns an unreadable header file after a successful curl intoHfError::Ioinstead of an empty header, which had read as "last page". The header file is removed on both paths.Closes #986.
Release notes: Fixed: concurrent Hugging Face listings of multi-page repos no longer return another repo's pages or stop after the first page.
Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none. The only otherprocess::id()file name incrates/hf/srcis in test code.What I ran
Base
7f04223bc467b76b443ebb0910947072eb1007b0, head109d22f6688571a880704d241a18655feb12ae4e. The change is incrates/hf/src/fetch.rsand adds two tests:concurrent_paginated_listings_each_read_their_own_pages: a local HTTP server serves 8 repos of 2 pages each (Link: rel="next") and holds every first page until all 8 requests have arrived, so the header files overlap. Each repo must return its own two pages.a_listing_page_without_its_headers_is_an_error(unix): a fake curl prints[]and writes no header file. The listing must fail withHfError::Ioon the.headerspath.Before the fix (the tests on the base code), five runs of
cargo test -p bloomery-hf --lib concurrent_paginated_listings:All five runs failed. Another run returned
left: ["r0-1.gguf", "r3-2.gguf"], another repo's second page. With both new tests on the base code,cargo test -p bloomery-hf --lib listing:After the fix,
cargo test -p bloomery-hf, and the concurrent test ten times in a row:The real binary against the real hub, built with
cargo oxide build --arch sm_121a -- -p bloomery-gpu-gates --features glm5next,clef,mimo2,solar2,minimaxm3,flint,gemma-embedding2,hf,checkpoint --release --bin bloomery-serve, thenbloomery-serve --recommend --json. A curl wrapper onPATHlet only listing and range requests through, logged each URL and refused full downloads:The 13 catalog repos each fit on one page, so the multi-page path is covered by the local-server test above.
Hardware (if the change is for a machine)
The card run above used one DGX Spark: NVIDIA GB10, driver 595.84, CUDA 13.3.1 (build container).
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.