Repository navigation
ci: no workspace member can be silently absent from the test matrix - #998
Merged
Merged
Conversation
The follow-up named in the NVIDIA#971 merge note. `unit-tests.yml`'s matrix decides which crates get `cargo test`, and a member missing from it fails nothing -- the workflow is green, `just check` is green, and the tests never ran. NVIDIA#971 found four crates in exactly that state holding 107 `#[test]` functions between them, two of them uncovered for months. The workflow already carried the intent as a comment: # Crates intentionally not in this matrix: # * `cuda-bindings` - generated sys bindings covered transitively. # * `fuzzer` - differential-testing infra with no unit tests. # * `rustc-codegen-cuda` - its own [workspace] ... That list reading as complete is precisely what hid the four. This guard makes it complete: every member must be in the matrix or named in that comment, and a crate in neither fails the run. Excluding one stays a one-line reviewable act with a written reason -- the guesswork goes, the choice stays. Four assertions, each with a distinct failure this has already had: 1. **Member in neither the matrix nor the exclusion list.** The NVIDIA#971 case. 2. **Exclusion list names a non-member.** A renamed or deleted crate left behind there is a permanent hole. `rustc-codegen-cuda` is the one accepted non-member, since its own `[workspace]` keeps it out by design. 3. **Matrix names a non-member**, which would make the job run `cargo test -p` on a name cargo cannot resolve. 4. **The Justfile mirrors the matrix**, which its own comment already promises ("Mirrors .github/workflows/unit-tests.yml; keep the two in step") and nothing enforced. Parse self-tests on all three inputs, in this script's house style: the member list, the matrix entry shape, the exclusion comment, and the Justfile `-p` spelling each fail loudly rather than yielding an empty set that would pass vacuously. One thing the guard caught in its own first run, worth keeping: a naive `-p ([a-z0-9-]+)` reads `ldconfig -p 2>/dev/null` in `test-cuda` as a package named `2`. The pattern requires a leading letter, and the comment says why. Verified by mutation, each against an otherwise clean tree: drop `dialect-ptx` from the matrix -> exit 1, names it drop it and declare it excluded, Justfile untouched -> exit 1, mirror broken drop it, declare it, and drop it from the Justfile -> OK (the real flow) exclusion list names `ghost-crate` -> exit 1, names it Justfile drops a package the matrix keeps -> exit 1, both directions reword the exclusion heading -> self-test fires rename `- package:` to `- pkg:` -> self-test fires clean tree -> OK, 27 = 25 + 3 declared Wired into `status-guard.yml` as a new job and into the Justfile's `check-guards`, whose docstring lists the status-guard jobs and now names this one -- the drift that recipe exists to prevent. Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
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
The follow-up named in the #971 merge note.
unit-tests.yml's matrix decides which crates getcargo test, and a member missing from it fails nothing — the workflow is green,just checkis green, and the tests never ran. #971 found four crates in exactly that state holding 107#[test]functions between them, two of them uncovered for months.The workflow already carried the intent, as a comment:
That list reading as complete is precisely what hid the four. This guard makes it complete: every member must be in the matrix or named in that comment, and a crate in neither fails the run. Excluding one stays a one-line reviewable act with a written reason — the guesswork goes, the choice stays.
Four assertions, each with a failure this has already had
rustc-codegen-cudais the one accepted non-member, since its own[workspace]keeps it out by design.cargo test -pon a name cargo cannot resolve.Parse self-tests on all three inputs, in the house style: the member list, the matrix entry shape, the exclusion comment, and the Justfile
-pspelling each fail loudly rather than yielding an empty set that would pass vacuously.One thing the guard caught in its own first run, worth keeping: a naive
-p ([a-z0-9-]+)readsldconfig -p 2>/dev/nullintest-cudaas a package named2. The pattern requires a leading letter, and the comment says why.Testing
Local, no GPU. Each mutation against an otherwise clean tree:
dialect-ptxfrom the matrixghost-crate- package:→- pkg:status-guard.ymlas a new job and into the Justfile'scheck-guards, whose docstring lists the status-guard jobs and now names this one — the drift that recipe exists to preventcargo oxide run <example>— not applicable, CI script only