Repository navigation
hf: refuse listed names that end in a cache sidecar's suffix - #1048
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: Two removed test cases lack the required dated reason.
Must fix
1. Document why the two acceptance cases were removed
crates/hf/src/fetch.rs:1366 removes x.bin.part.ranges.part and x.bin.verified.part from the acceptance test without a dated reason. Their suffix is now forbidden. The review contract requires a dated reason for removed test cases; the missing comment is a mechanical kind B fix.
Record this changed expectation now so later edits do not restore obsolete acceptance cases. Replace the array line with:
// PIN(2026-10-31): The two .part-ending cases are now rejected by the reserved-sidecar tests.
let names = ["x.bin.part.ranges", "x.bin"];Checked
Duplicates: 2 new definitions and 1 renamed test checked; no duplicate owner. Dryer reported no pairs.
Complexity: crapper flagged verified_entries, 16 → 17; the added suffix condition uses the shared owner. No split needed.
Silent failure: 1 new skip followed through offline discovery to exact lookup; a requested excluded name produces NoFile.
Tests: static mutation checks only. Removing the rejection at L1023 fails the refusal assertions; removing the skip at L916 makes the discovery test fail.
Gates: two acceptance cases removed without a dated reason, covered by item 1. No tolerance or lint changes.
Escape catalog: no patterns matched. This change touches cache loading, outside the inference hot paths.
Notes
Tests were not rerun: their scratch helper writes under the read-only PR tree. The PR reports a FAIL-first run and passing CPU tests. It supplies no GPU gate evidence.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
| "x.bin.verified.part", | ||
| "x.bin", | ||
| ]; | ||
| let names = ["x.bin.part.ranges", "x.bin"]; |
There was a problem hiding this comment.
The review contract requires a dated reason for removing the two acceptance cases.
| let names = ["x.bin.part.ranges", "x.bin"]; | |
| // PIN(2026-10-31): The two .part-ending cases are now rejected by the reserved-sidecar tests. | |
| let names = ["x.bin.part.ranges", "x.bin"]; |
A listed file named x.bin.verified or x.bin.part was another listed file's marker or part: fetching x.bin overwrote the first with its digest or took its bytes as its own, and resolve_exact returned a path that no longer held its listed file. The destination check that refuses .lock now refuses .part and .verified as well, in any case, and the cache's offline discovery skips such names an earlier version left marked instead of failing the repo. Fixes midagedev#1038
2ea88ee to
271c12f
Compare
There was a problem hiding this comment.
Since the last review: must-fix 1 is fixed at crates/hf/src/fetch.rs:1366. The dated reason explains why the two acceptance cases were removed.
Verdict: CLEAN: The prior finding is resolved, and the interdiff adds only the requested comment.
Checked
Duplicates: 0 new items in the interdiff. Dryer reported no pairs; the shared suffix owner is unchanged.
Complexity: crapper flagged verified_entries, 16 → 17 across the full PR, from the suffix guard. The interdiff changes no executable code.
Silent failure: 0 new sites; rechecked the discovery skip. An offline request for an excluded name returns Offline wrapping NoFile.
Tests: no assertions changed. Static mutation checks: dropping the rejection at L1023 fails refusal assertions; dropping the suffix skip at L916 fails the discovery assertion. Tests were not rerun for this comment-only edit.
Gates: the required dated PIN is present; no additional gate changes.
Escape catalog: no patterns matched. Mixed-case reserved names fail before sidecar access; empty paths fail cache-path validation.
🔨 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. |
허브 파일 목록에 다른 파일의
.part나.verified이름이 있으면 그 파일을 덮어쓰던 문제를 막습니다.Fixes #1038. Fixes #1038
What and why
A destination
x.binkeeps its lock, partial download and verified marker atx.bin.lock,x.bin.partandx.bin.verified. The shared destination check refused only the.locksuffix, so a listing that held bothx.binandx.bin.verified(orx.bin.part) let the fetch ofx.binoverwrite the other listed file with a digest marker (or a part file that was then renamed away).lock_filenow refuses a listed name that ends in.lock,.partor.verified, in any case, with the errorthe <suffix> suffix is reserved for cache sidecars. The refusal happens when that file's own fetch starts, so files listed before it are already fetched. Offline discovery (verified_entries) skips such names, so a cache an older build left does not fail the whole repository.I kept the
<file>.verifiedmarker name instead of moving markers to another namespace: existing caches and the tools that write a marker by that name keep working, and no cache needs rehashing.Release notes: Fixed: A listed Hugging Face file named like another file's
.partor.verifiedsidecar is now refused instead of overwriting that file.Code shape
sidecar_suffixowns the suffix list;lock_fileandverified_entriesboth call it.InvalidInputerror.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.What I ran
Base
be3e6d336, headc591a640a; one file changed,crates/hf/src/fetch.rs. The change is host-side name checking, so no GPU gate is reached. Tests ran on a macOS CPU node.The new test
listed_files_named_like_another_files_part_or_marker_are_refusedresolvesx.bintogether withx.bin.part,x.bin.verifiedandx.bin.VERIFIEDin both orders, expects the reserved-suffix error, and checks that discovery over a cache holding such markers returns onlyx.bin.fetch_refuses_reserved_sidecar_destinations_before_touching_sidecars(the former.locktest) gains.partand.Verified.Before the fix (test-only commit on the base):
rc=101
After the fix, on the head:
Whole crate:
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.