Repository navigation
ci(naming-guard): make the reserved-prefix guard actually run - #644
Merged
Merged
Conversation
The guard shelled out to `rg`, which the ubuntu-latest image does not ship. `rg ... || true` turned the resulting "command not found" into an empty result set, so the step printed OK and exited 0 on every commit since it was added without ever reading a file. Search with `grep`, which is in the runner's base image, and treat only grep's exit status 1 (no matches) as clean, so a search that cannot run fails the job instead of passing it. Add a self-test that requires the search to match a known violation in a temporary fixture before a clean result is believed: this guard's failure mode is silently matching nothing, so it has to prove it can still match. Fix the one violation that exposes. An llvm-export test hardcoded the legacy device prefix rather than building it from `reserved_oxide_symbols::LEGACY_DEVICE_PREFIX`; the symbol it constructs is byte-identical, and the test still asserts the prefix is stripped to `standalone_export`. Fixes NVIDIA#643 Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
Verified this end to end:
|
nihalpasham
approved these changes
Aug 3, 2026
This was referenced Aug 3, 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.
Fixes #643.
What was wrong
The
naming-guardstep searches withrg, which theubuntu-latestimage does not ship.rg ... || trueturned the resultingcommand not foundinto an empty result set, so the guard printedOKand exited 0 on every commit sincefc0aae62(2026-05-03) without ever reading a file.From the latest
mainrun (30748062109, conclusionsuccess):The step also finishes in ~6s, which is about what a search that reads nothing costs.
What this changes
Search with
grep. It is in the runner's base image, so the tool cannot go missing. This is also why the diff does not justapt-get install ripgrep: that keeps the dependency and adds ~15s per run, and the|| truewould still hide a future failure.Fail closed.
grepexits 0 with matches, 1 with none, and >= 2 on error. Only 1 is treated as clean, so a search that cannot run fails the job rather than being mistaken for an empty result.Self-test. This guard's failure mode is silently matching nothing, so before a clean result is believed it must match a known violation in a throwaway fixture. That is the part that would have caught the original bug on the day it was introduced.
One real violation, now fixed. With a working search, the guard's own pattern finds:
That is
LEGACY_DEVICE_PREFIXplus a base name, built by hand. Line 810 of the same file already does it the sanctioned way, so this now usesreserved_oxide_symbols::LEGACY_DEVICE_PREFIX. The constructed symbol is byte-identical and the test still asserts the prefix is stripped tostandalone_export.Verification
CPU-only; no CUDA toolkit or GPU. I extracted the step's
run:block from the YAML and exercised it six ways:rgabsent//and///commentscargo test -p llvm-export --all-targets: 100 passed, 0 failed.cargo clippy -p llvm-export --all-targets -- -D warnings: clean.cargo fmt --check: clean.The
reserved-oxide-symbols literal guardcheck on this PR is the real signal: it should now take longer than 6s and still pass.One open question, deliberately not bundled here
The step comment says it rejects any hardcoded
cuda_oxide_*prefix, but the pattern matches onlykernel|device|instantiate. The crate also ownsCONSTANT_PREFIX,ARTIFACT_ANCHOR_PREFIX, andPTX_MERGE_REQUIRED_PREFIX. Widening the alternation surfaces one more hit:artifact_anchor_symbol("linked", "0.0.0")produces exactly that string, butcuda-coredoes not currently depend onreserved-oxide-symbols, so fixing it adds a dev-dependency edge. That is a policy call rather than a bug, so I left it out. Happy to add it here or in a follow-up, whichever you prefer.