Repository navigation
hf: refuse unsupported checkpoint sources before fetching files - #738
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: Unsupported checkpoint sources are rejected at the shared owner before shard fetching, and no must-fix defect was found.
Checked
Duplicates: 3 new definitions and the error variant checked; no duplicated owner found. Dryer reported 0 pairs; gpu-gates was searched manually. The two new tests cover library admission and caller capability selection.
Complexity: crapper flagged no functions. Production growth passes the capability to the existing checkpoint helper and adds one rejection branch.
Silent failure: 2 admission-error paths followed. Online returns CheckpointUnsupported; cached resolution wraps it in Offline. Neither returns a model path or sets the process model.
Tests: mutation analysis of checkpoint's capability comparison makes the new hf test fail its error assertion; moving the fetch loop before admission makes the caller test fail its request-count assertion. Changing the side seat to accept checkpoints fails its child assertion. Taking checkpoint fallback despite an available GGUF set fails the changed draft-selection test. Signature-only test edits retain their assertions. These are static checks, not reviewer-executed mutations.
Gates: no pins, tolerances, assertions or cases removed or relaxed. The body supplies FAIL-first and caller-test mutant output.
Adversarial checks: offline admission, quant rejection, feature-off selection, and mixed GGUF/checkpoint listings are guarded. This is load-time code; no per-token work changes.
Escape catalog: no C1–C4 pattern matched. The curl stub preserves the real command's exit status with exec.
Notes
Tests were not executed during this static review. The card-run evidence omits the tested base/head hashes; gpu.json therefore records incomplete evidence.
The reported contrib-check --tier t0 run includes the bloomery-hf tests, including the new online/cache test.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/model_file.rs, crates/gpu-gates/src/model_file/fetch.rs, crates/gpu-gates/src/side_seat/flags.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 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. |
--hf로 safetensors checkpoint만 있는 저장소를 지정하면, 이를 열 수 없는 호출자도 shard를 전부 내려받은 뒤에야 거부하던 문제를 고칩니다.Part of #565. Tracked in #699.
What and why
A
--hfrepository that holds a safetensors checkpoint and no GGUF set resolves to the checkpoint's folder. Only a caller that can open a checkpoint folder can use that result.Client::resolve,Client::resolve_draftsandmodel_file::resolvedid not know which caller they served. A build without thecheckpointfeature, and callers that only read GGUF files (the embedding side seat andsentence_prompts), therefore downloaded and verified every shard first and refused afterwards. The user waited for the whole checkpoint and then got an error.The checkpoint fallback and its fetch loop came in with
2a22225053118b7dd0c90d4e310db6f9a334f215, merged in #635.The resolvers now take a
Sourcesvalue (GguforGgufOrCheckpoint) that names what the caller can open. The existingcheckpointhelper checks it right after it sees the repo has no GGUF set, before any file event or fetch, and returns a newHfError::CheckpointUnsupportedthat names the repo. The offline cache path goes through the same helper, so a cached checkpoint folder is refused the same way.model_file::namehands overGgufOrCheckpointonly when thecheckpointfeature is on. The embedding side seat hands overGguf, becauseSplit::openis its only consumer. The existing refusal of:<quant>on a checkpoint repo, the GGUF-first choice and the per-draft lookup behave as before.The regression test lives in
model_file::fetch's test module. The existinggate-gpu-gates-librecipe already runs it with thehffeature.gate-ds41-bindgains one step that runs it withdeepseek41,checkpoint, which also reaches the real side seat caller.Release notes: Fixed:
--hfrefuses a safetensors-only repository before downloading any shard when the running binary or the calling seat cannot open a checkpoint.Code shape
checkpointhelper stays the one place that decides. Online resolve, offline fallback and both public resolvers hand the same value to it.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up. The format check is part ofjust contrib-check --tier t0below; I did not runcargo clippyseparately.Duplication found or removed (
path:line): none.What I ran
The test
checkpoint_support_is_checked_before_downloadserves a checkpoint-only repo with two shards from afile://hub, reaches it through a stubcurlthat logs each hub path it is asked for, and counts the requests each caller makes. It coversmodel_file::name,model_file::resolvewithGguf, a:Q4_K_Mquant, a caller that supports checkpoints, and, with thedeepseek41feature, the real side seat. Each case runs in a child process becausemodel_file::namesets process-wide state.Against the code before the fix, the first form of this test (a separate integration test with a loopback hub) showed the defect. The two unsupported callers fetched four shards in total:
On the final test, a mutant that moves the checkpoint file fetch ahead of the admission check in
resolve_draftsfails thenamecase in thehfbuild. A mutant that makesside_seat::Flags::readaccept checkpoints fails thesidecase in thedeepseek41,checkpointbuild. Both runs exit with rc 101, and the tree was restored afterwards:With the fix, on the PR head, on a Linux x86-64 host:
On an RTX 5090 machine the test ran in the
hfbuild and withdeepseek41,checkpoint,just gate-ds41-bind, which now includes thedeepseek41,checkpointstep that reaches the real side seat. The run exited with rc 0:Those runs load no model and run no GPU computation. They build the device-linked crate and run the side seat's own resolver call. The RTX 5090 runs were on a head whose only difference from the PR head is the order of clauses inside the
gate-ds41-bindline; the test and production code are unchanged.Not run here:
cargo check --workspace --all-targetsacross feature combinations (the public signatures ofresolve,resolve_draftsandmodel_file::resolvechange),cargo clippyon its own, and the otherjust gate-*recipes. No kernel, copy, launch or inference output changes, so no PTX comparison or timing run applies.Reproduction
What I ran into
This does not block this PR.
qwen38_folderstill refuses a checkpoint folder given directly with-mwhen the feature is off; that is a separate entry point and stays as it was.Hardware
The Linux host runs used:
The side seat runs used an RTX 5090 machine, as shown above.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.