Skip to content

ci: cargo-deny reaches two of the three non-example workspace roots - #1043

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:ci/cargo-deny-device-only-fixture
Aug 19, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
vyncint:ci/cargo-deny-device-only-fixture

Conversation

@vyncint

@vyncint vyncint commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

cargo deny check stops at a [workspace] boundary, which is why this workflow already runs it twice: once at the root and once for crates/rustc-codegen-cuda. There is a third such root under version control that resolves third-party crates, and nothing judges it.

crates/cuda-macros/tests/device-only declares its own [workspace] on purpose — the fixture exists to prove a graph that does not contain cuda-host (#701/#702), so it must resolve independently rather than share the root lock. That same boundary puts it outside all three existing runs:

  • the root cargo deny check stops at it,
  • the backend run names a different manifest,
  • check-example-license-policy.sh walks crates/rustc-codegen-cuda/examples only.

The gap is not theoretical

Its lock against both governed locks:

crate fixture root backend governed?
proc-macro2 1.0.107 1.0.106 1.0.106 no
quote 1.0.47 1.0.45 1.0.44 no
syn 2.0.119 2.0.117, 3.0.3 2.0.114, 3.0.3 no
unicode-ident 1.0.24 1.0.24 1.0.22 yes

Three of its four third-party (name, version) pairs appear in neither governed lock, so no advisory, license, ban or source policy has ever been applied to them. (name, version, source) is this repo's own unit of policy — it is the grouping key check-example-license-policy.sh uses to argue its runs-for-workspaces equivalence — so a version present nowhere else is a distinct policy question, not a duplicate.

What this does

Adds the third run with --locked, like the other two. A check that can rewrite its own input is not a check, and verified here: deleting a package block from that lock makes the run stop with cannot update the lock file rather than silently re-resolving.

crates/fuzzer/rustlantis is the one remaining [workspace] root and is deliberately left out: it is a vendored upstream project rather than first-party code, so bringing its graph under deny.toml is a policy call for a maintainer, not a gap to close silently. The header comment now records which roots are in scope and why.

Two present-tense counts in this file had also drifted and are corrected against the current tree:

  • the backend workspace resolves 88 third-party crates, not 82 (cargo metadata --manifest-path crates/rustc-codegen-cuda/Cargo.toml, packages with a non-null source);
  • the example-policy script is 31 runs over 217 lock files, not 26 over 187 — 31 is the number the script itself announces.

Verification

  • The new invocation reports advisories ok, bans ok, licenses ok, sources ok and exits 0 on today's tree, so main stays green.
  • Every workflow still parses.
  • just check-guards carries the same third run, so the local mirror keeps predicting CI.
  • All four counts re-measured against f1e62fe2.

`cargo deny check` stops at a `[workspace]` boundary, which is why this
workflow already runs it twice: once at the root and once for
crates/rustc-codegen-cuda. There is a third such root under version control
that resolves third-party crates, and nothing judges it.

`crates/cuda-macros/tests/device-only` declares its own `[workspace]` on
purpose -- the fixture exists to prove a graph that does *not* contain
cuda-host (NVIDIA#701/NVIDIA#702), so it must resolve independently rather than share the
root lock. That same boundary puts it outside all three existing runs: the
root `cargo deny check` stops at it, the backend run names a different
manifest, and `check-example-license-policy.sh` walks
`crates/rustc-codegen-cuda/examples` only.

The gap is not theoretical. Comparing its lock against both governed locks:

    proc-macro2   fixture 1.0.107   root 1.0.106   backend 1.0.106
    quote         fixture 1.0.47    root 1.0.45    backend 1.0.44
    syn           fixture 2.0.119   root 2.0.117   backend 2.0.114
    unicode-ident fixture 1.0.24    root 1.0.24    backend 1.0.22

Three of its four third-party `(name, version)` pairs appear in neither
governed lock, so no advisory, license, ban or source policy has ever been
applied to them. `(name, version, source)` is this repo's own unit of policy
-- it is the grouping key `check-example-license-policy.sh` uses to argue its
26-runs-for-187-workspaces equivalence -- so a version present nowhere else
is a distinct policy question, not a duplicate.

Add the third run, with `--locked` like the other two: a check that can
rewrite its own input is not a check, and verified here, deleting a package
block from that lock makes the run stop with "cannot update the lock file"
rather than silently re-resolving.

`crates/fuzzer/rustlantis` is the one remaining `[workspace]` root and is
deliberately left out: it is a vendored upstream project rather than
first-party code, so bringing its graph under deny.toml is a policy call for
a maintainer, not a gap to close silently.

Two present-tense counts in this file had also drifted and are corrected
against the current tree: the backend workspace resolves 88 third-party
crates, not 82 (`cargo metadata --manifest-path
crates/rustc-codegen-cuda/Cargo.toml`, packages with a non-null source), and
the example-policy script is 31 runs over 217 lock files, not 26 over 187.

Verified: the new invocation reports `advisories ok, bans ok, licenses ok,
sources ok` and exits 0 on today's tree, so main stays green; every workflow
still parses; and `just check-guards` carries the same third run so the local
mirror keeps predicting CI.

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added bug Something isn't working build-related Build scripts, toolchain discovery, or compilation setup supply-chain Dependency policy: licenses, sources, security advisories, lock files labels Aug 19, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator
  • Confirmed the gap was real: three of the fixture's four external deps are locked at versions that appear in no other checked lockfile, so no advisory or license rule had ever run on those exact versions.
  • Reproduced the new CI command locally: cargo deny --manifest-path crates/cuda-macros/tests/device-only/Cargo.toml --locked check passes (advisories, bans, licenses, sources all ok), and just check-guards runs the same third scope end to end, 34 verdicts total.
  • Leaving the vendored fuzzing project out on purpose, with the comment saying why, is the right call.

@nihalpasham
nihalpasham merged commit 93cbf03 into NVIDIA:main Aug 19, 2026
49 checks passed
nihalpasham added a commit that referenced this pull request Aug 20, 2026
…ed in a day (#1055)

* ci: four tooling comments keep tree sizes by hand, and all four drifted in a day

#1032 added one example, `redux_f32`, and eight catalog entries. That single
merge falsified numbers in four places:

| site | said | now |
|---|--:|--:|
| `check-example-license-policy.sh` (x3) | 217 locks | 218 |
| `check-example-license-policy.sh` (x2) | 215 examples | 216 |
| `check-example-license-policy.sh` | 13871 packages, floor 2170 | 13934, 2180 |
| `cargo-deny.yml` | 31 runs instead of 217 | ... of 218 |
| `Justfile` | 986 catalog entries | 1010 |
| `examples-compile.yml` | 210 example crates | 216 |

Six of those transcriptions are mine, from #1043 and #1044, written the day
before. Refreshing them buys one day. The counts are not load-bearing in any
of the four -- each is there to make a structural point -- so state the
structure and let the code report the numbers:

- The license-policy guard already announced its representative count. It now
  announces the lock count beside it, so the grouping ratio is observable
  output rather than a comment to keep in step:

      Checking deny.toml over 31 representative example workspaces,
      grouped from 218 example lock files.

- Its scope comment and its enumeration cross-check now say "one lock per
  example directory, plus one per nested sub-workspace" instead of naming
  today's totals.

- The parsed-package floor is computed as ten per lock, so the comment says
  that rather than quoting the current product.

- `cargo-deny.yml` says one run per distinct dependency set instead of one per
  lock file, and points at the script's own output.

- The `Justfile` comment's point was that the generated path dominates, which
  35 generated op modules against 7 hand-written makes without an entry count.
  Module counts are structural and have not moved through any of these merges.

- `examples-compile.yml`'s number only justified a timeout, so "every example
  crate" does the same job.

One number is kept and re-labelled rather than removed: the `[a-m]*` glob
illustration in the cross-check comment now reads "measured once ... 137 of
the 217 locks then present", matching the timestamped-measurement idiom the
same file already uses two paragraphs above. The argument needs a concrete
ratio; making it explicitly historical stops it being a live claim.

Verified: the guard passes unchanged -- 31 representatives grouped from 218
lock files, `deny.toml holds over every example workspace outside
POLICY_EXEMPT_EXAMPLES`, exit 0. `bash -n` clean, `just --list` parses, all
eleven workflows parse, and dialect-nvvm really does hold 35 generated and 7
hand-written op modules.

Signed-off-by: Vyncint Ng <[email protected]>

* ci: correct the floor-margin claim and tighten the rewritten tooling comments

---------

Signed-off-by: Vyncint Ng <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
nihalpasham pushed a commit that referenced this pull request Aug 21, 2026
… roots (#1114)

`check-dependency-licenses.sh` builds its required set from two manifests:

    required="$(
        {
            declared_crates Cargo.toml
            declared_crates crates/rustc-codegen-cuda/Cargo.toml
        } | LC_ALL=C sort -u
    )"

and the comment above it says "Both first-party workspaces, not just the root
one". There are three. `cargo metadata` stops at a `[workspace]` boundary, so
one pass per root is the only way to reach them all, and
`crates/cuda-macros/tests/device-only` declares its own `[workspace]` on
purpose: the fixture exists to prove a graph that does *not* contain
`cuda-host` (#701/#702), so it must resolve independently rather than share the
root lock. That boundary puts it outside both passes.

The gap is live, not theoretical. Its member `device-only-kernels` has no row
in `dependency-licenses.csv`, and adding the third pass says so immediately:

    error: dependency-licenses.csv is missing a row for:
      device-only-kernels

`publish = false` is not what excluded it -- `cuda-intrinsics-gen` and
`reserved-oxide-symbols` are both unpublished root members and both have rows.
The only reason it was absent is that no pass ever looked at that workspace.

This is #1043's gap in the sibling guard. That fix taught `cargo deny check`
the third root, which governs the license *policy* over the resolved graph.
This guard covers the other half, stated in its own header: "that the
human-readable inventory does not silently fall behind what the workspace
declares." Both halves need all three roots, and until now only one had them.

What it protects going forward: the fixture currently declares nothing but two
first-party path dependencies, so the one missing row is the whole of today's
drift. But a third-party dependency added there would have been recorded
nowhere -- cargo-deny would judge its policy and the inventory would stay
silent, which is exactly the asymmetry this pair of guards exists to prevent.

Changes:

* the third `declared_crates` pass, plus a rewritten comment that enumerates
  all three roots and says why each is separate, so the next reader does not
  have to rediscover that `cargo metadata` stops at the boundary;
* the `device-only-kernels` row, matching the column layout of the other
  first-party rows and inserted in sort position.

Verified, both directions:

* drop the CSV row, keep the third pass -> fails naming `device-only-kernels`;
* keep the row, drop the third pass -> reports "OK: ... all 58 declared
  crates" while blind to that workspace, which is the state being fixed;
* restored -> "OK: dependency-licenses.csv records all 59 declared crates" and
  the example half unchanged.

`scripts/check-example-license-policy.sh`, the other consumer of the CSV, still
reports "OK: deny.toml holds over every example workspace". `bash -n` clean.

Signed-off-by: Vyncint Ng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working build-related Build scripts, toolchain discovery, or compilation setup supply-chain Dependency policy: licenses, sources, security advisories, lock files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants