Repository navigation
ci: the device-only guard re-resolves the lock file it is judging - #962
Merged
Merged
Conversation
`check-device-only-build.sh` is the only guard in scripts/ that resolves a
Cargo graph without `--locked`. Its sibling states the rule it is missing:
# `--locked` so the guard reads the committed resolution rather than
# silently updating Cargo.lock to satisfy itself: a check that can
# rewrite its own input is not a check.
-- scripts/check-dependency-licenses.sh
check-example-license-policy.sh passes `--locked` too, and NVIDIA#806 added it to
all three executable `cargo deny` invocations for the same reason.
It matters more here than in either of those, because this guard's whole
assertion is about the *resolved* graph -- "cuda-host, cuda-core and
cuda-bindings are absent from it". A resolution free to move is not the one
the repository committed, and `crates/cuda-macros/tests/device-only/Cargo.lock`
is tracked.
Reproduced on a clean tree by deleting the `cuda-device` package block from
that committed lock:
before: OK: device-only graph is host-free (8 packages).
OK: ... type-checks with the CUDA environment unset.
exit=0 # and `git diff` on the lock came back empty --
# cargo had quietly resolved it back
after: error: cargo metadata failed for .../device-only/Cargo.toml
exit=1 # lock left exactly as the mutation made it
So the guard both passed on a corrupt input and repaired that input on its
way past, which is the failure mode that leaves nobody with a reason to
look. `cargo check` gets the flag as well, for the same reason and so the
two invocations cannot disagree about which resolution is under test.
The error path now names the lock file, since "commit the updated lock"
is the fix and re-resolving is what we just stopped doing silently.
Verified: clean tree passes unchanged; the mutation above now fails and
leaves the lock alone; restoring the lock passes again.
Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
The premise checks out:
Merging. |
nihalpasham
approved these changes
Aug 17, 2026
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.
Summary
scripts/check-device-only-build.shis the only guard inscripts/that resolves a Cargo graph without--locked. Its sibling states the rule it is missing:check-example-license-policy.shpasses it too, and #806 added it to all three executablecargo denyinvocations for the same reason.It matters more here than in either of those. This guard's whole assertion is about the resolved graph — "cuda-host, cuda-core and cuda-bindings are absent from it" — and
crates/cuda-macros/tests/device-only/Cargo.lockis tracked. A resolution free to move is not the one the repository committed.Reproduction
On a clean tree, delete the
cuda-devicepackage block from that committed lock, then run the guard exactly ascargo-deny.ymldoes:Before
…and
git diffon the lock came back empty — cargo had quietly resolved it back to the committed content on the way past. The guard passed on a corrupt input and repaired that input, which is the failure mode that leaves nobody a reason to look.After
…and the lock is left exactly as the mutation made it (
1 file changed, 7 deletions(-)).For reference,
cargo metadata --lockedon the mutated lock reports:Changes
--lockedoncargo metadataand oncargo check, so the two invocations cannot disagree about which resolution is under test.cargo metadataerror path now names the lock file, since "commit the updated lock" is the fix and re-resolving is what we just stopped doing silently.Testing
Local, no GPU and no CUDA toolkit — the guard unsets the CUDA environment itself.
8 packages, fixture type-checks)cargo oxide run <example>— not applicable, CI script only