Skip to content

naming-guard never runs: the reserved-prefix check shells out to ripgrep, which ubuntu-latest does not ship #643

Closed

Description

@vyncint

Summary

The naming-guard workflow has never inspected a file. Its search step shells out to rg, which the ubuntu-latest image does not ship, and rg ... || true turns the resulting command not found into an empty result set. The guard then reports success. It has been green on every commit since it was introduced in fc0aae62 (2026-05-03) without ever reading a line of Rust.

Evidence

From the most recent main run (30748062109, 85359fe, conclusion success):

/home/runner/work/_temp/fb92a9b1-....sh: line 7: rg: command not found
OK: no hardcoded reserved-prefix literals outside reserved-oxide-symbols.

The same two lines appear in the three most recent successful runs (30748062109, 30747817002, 30746886345).

The mechanism is in .github/workflows/naming-guard.yml:

matches="$(rg --type rust -n '"cuda_oxide_(kernel|device|instantiate)_' crates ... || true)"
violations="$(echo "$matches" | grep -vE ':[0-9]+:[[:space:]]*//' || true)"
if [ -n "$violations" ]; then ... exit 1; fi

rg exits 127, || true swallows it, matches is empty, violations is empty, and the guard exits 0. set -euo pipefail does not help, because || true is exactly what suppresses the failure.

The guard is not vacuous — there is a real violation on main

Running the guard's own pattern with a search tool that exists:

$ grep -rEn --include='*.rs' '"cuda_oxide_(kernel|device|instantiate)_' crates \
    | grep -v '^crates/reserved-oxide-symbols/' | grep -vE ':[0-9]+:[[:space:]]*//'
crates/llvm-export/tests/export_test.rs:1392:        "cuda_oxide_device_246e25db_standalone_export"

That literal is LEGACY_DEVICE_PREFIX plus a base name. Line 810 of the same file already does it the sanctioned way:

let prefixed_name = reserved_oxide_symbols::device_symbol("target");

Proposed fix

  1. Search with grep, which is in the runner's base image, instead of rg. This removes the failure mode rather than papering over it, and avoids an apt-get install on every run.
  2. Fail closed. grep exits 0 with matches, 1 with none, and >= 2 on error; treat only 1 as clean so a search that cannot run fails the job.
  3. Add a self-test. Before trusting a clean result, confirm the search still matches a known violation in a temporary fixture. A guard whose whole failure mode is "silently stops matching" should be required to prove it can still match.
  4. Fix crates/llvm-export/tests/export_test.rs:1392 to build the symbol from reserved_oxide_symbols::LEGACY_DEVICE_PREFIX, preserving the exact string the test asserts on.

Separate question: the pattern covers 3 of the reserved prefixes

Not proposing to change this here, since it is a policy call rather than a bug, but noting it while the area is open. The step comment says it rejects any hardcoded cuda_oxide_* prefix and that "the single source of truth for these prefixes is crates/reserved-oxide-symbols/", while the pattern matches only kernel|device|instantiate. The crate also owns CONSTANT_PREFIX, ARTIFACT_ANCHOR_PREFIX, and PTX_MERGE_REQUIRED_PREFIX. Widening the alternation to those surfaces one more hit:

crates/cuda-core/src/embedded.rs:236:            Some("cuda_oxide_artifact_anchor_246e25db_linked_0_0_0"),

reserved_oxide_symbols::artifact_anchor_symbol("linked", "0.0.0") produces exactly that string, but cuda-core does not currently depend on reserved-oxide-symbols, so routing it through the crate means adding a dev-dependency edge. Happy to include that in the same PR or leave it out — let me know which you prefer.

Verification

CPU-only; no CUDA toolkit or GPU involved. I extracted the step's run: block straight out of the YAML and exercised it six ways:

# Scenario Expected Result
1 Reworked guard, violation fixed pass exit 0
2 Reworked guard, violation restored fail exit 1, names the file and line
3 Current guard, violation present, rg absent from PATH — exit 0 — reproduces the bug, same two log lines as CI
4 Reworked guard, search tool absent from PATH fail exit 1 via the self-test
5 Reworked guard, fresh violation in a new file fail exit 1
6 Reworked guard, prefix mentioned only in // and /// comments pass exit 0, exemption preserved

cargo test -p llvm-export --all-targets is 100 passed / 0 failed, cargo clippy -p llvm-export --all-targets -- -D warnings is clean, and cargo fmt --check is clean.

Activity

  1. added
    bug
    build-related
    on Aug 3, 2026
  2. added a commit that references this issue on Aug 3, 2026
    a77daf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuild-related

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions