Repository navigation
docs: sync the book's quoted toolchain pin, and guard every copy - #790
Merged
Merged
Conversation
NVIDIA#727 added `rustfmt` to `rust-toolchain.toml` and to the nested copy at `crates/rustc-codegen-cuda/rust-toolchain.toml`, but not to the two `[toolchain]` blocks the book quotes. Both still listed five components. Those blocks are presented as the repo's real file -- one is labelled "already in the repo root" -- so a reader copies them into their own project and gets a pin with no `rustfmt`. The symptom then lands somewhere else entirely: `cargo oxide fmt` fails, or `just fmt-check` does, and neither points back at the toolchain file. Nothing catches this. The pin is duplicated three ways and no build compares them: rustup resolves the backend's own `[workspace]` against the nested copy, so a mismatch there fails to load rather than warn, and the book's copies are prose as far as any gate is concerned. The nested file's header already says "Must match the parent cuda-oxide toolchain exactly!", but a comment enforces nothing -- which is how NVIDIA#727 slipped. So this adds `scripts/check-toolchain-parity.sh`, alongside the other source-only consistency guards, and a `toolchain-pin-parity` job in status-guard.yml. It compares channel and components between the two real files and every `[toolchain]` block fenced in the book. Anything else in a block is free to differ, and a block may omit either key: the check is that what a copy does state is right, not that it restates everything. The `rustup component add` command lines are deliberately not covered -- they are not exhaustive, because rustup installs whatever the pin names. The book's bump procedure named only the root file, which is the other half of why this drifted, so it now names the nested copy and the guard. Verified: the guard passes on the corrected tree, and reverting either book page reproduces the real NVIDIA#727 drift with `missing rustfmt` named. Injecting a channel or component change into the nested pin is caught too. `sphinx-build -W --keep-going`, as the book gate runs it, succeeds. Signed-off-by: Vyncint Ng <[email protected]>
This was referenced Aug 10, 2026
… every dated markdown reference The guard from the previous commit covers the nested pin and the book's two quoted [toolchain] blocks, but "every copy" was still short four: - The RUST_TOOLCHAIN_TOML scaffold in crates/cargo-oxide/src/commands.rs. `cargo oxide new` writes it into every new project as that project's rust-toolchain.toml, so it is the highest-impact copy: a stale scaffold never reddens this repo's CI, it hands each new user a pin whose backend cannot load, and the failure surfaces on their machine. It is a full toolchain file, so both keys are required and must match the root exactly, and the block carries its own parse self-test: a renamed or moved constant fails loudly instead of matching nothing. - The rust feature in .devcontainer/devcontainer.json, parsed as JSON rather than grepped. The version must be the pin's channel. The components line is a deliberate warm-cache subset (the container ships its own LLVM 21 and sets CUDA_OXIDE_LLC, so rustup's llvm-tools is left for rust-toolchain.toml to pull on first use), so it is checked as a subset: anything preinstalled must be a component the pin still names. The feature id is matched exactly with its version tag stripped, so a renamed feature trips the self-test rather than a lookalike (.../rustup) being read as the rust feature. - Every dated nightly reference in tracked markdown, which covers the remaining two named copies (.devcontainer/README.md and the rustup commands in the book's installation page) and every other dated rustup/cargo command and prose mention in one rule: any nightly-YYYY-MM-DD a tracked page spells must be the pinned one. The token itself is the check, so the guard is position-independent and survives pages being reworded, moved, or added; nothing was de-pinned because the dates in `rustup toolchain install` and `cargo +nightly-... install` lines are load-bearing (readers run them outside a checkout, where no rust-toolchain.toml can correct them). Files come from `git ls-files`, the only precise notion of tracked markdown: a bare glob would sweep up untracked trees such as a local target/ full of registry READMEs. Component lists on `rustup component add` lines stay uncovered, as before. The OK summary now counts all five kinds of copy, and the workflow comment and the book's bump procedure no longer undercount them. Verified by mutation: thirteen injected drifts (nested channel and components, scaffold channel, components, and renamed constant, devcontainer version, stale component, and renamed feature, both book blocks, and dated references in installation.md, README.md, and .devcontainer/README.md) each fail naming the drifted copy, and the restored tree is green. shellcheck 0.11.0 is clean, and `sphinx-build -W --keep-going -b html` still succeeds.
Collaborator
|
I layered one commit on top to make the title literal; the guard now also covers
13 mutation checks all fail loudly naming the right copy; sphinx builds the book warning-free. Note the OK line now counts more copies than the PR body quotes. Merging. |
nihalpasham
approved these changes
Aug 11, 2026
nihalpasham
added a commit
that referenced
this pull request
Aug 11, 2026
…793) * docs: sync the book's quoted toolchain pin, and guard every copy #727 added `rustfmt` to `rust-toolchain.toml` and to the nested copy at `crates/rustc-codegen-cuda/rust-toolchain.toml`, but not to the two `[toolchain]` blocks the book quotes. Both still listed five components. Those blocks are presented as the repo's real file -- one is labelled "already in the repo root" -- so a reader copies them into their own project and gets a pin with no `rustfmt`. The symptom then lands somewhere else entirely: `cargo oxide fmt` fails, or `just fmt-check` does, and neither points back at the toolchain file. Nothing catches this. The pin is duplicated three ways and no build compares them: rustup resolves the backend's own `[workspace]` against the nested copy, so a mismatch there fails to load rather than warn, and the book's copies are prose as far as any gate is concerned. The nested file's header already says "Must match the parent cuda-oxide toolchain exactly!", but a comment enforces nothing -- which is how #727 slipped. So this adds `scripts/check-toolchain-parity.sh`, alongside the other source-only consistency guards, and a `toolchain-pin-parity` job in status-guard.yml. It compares channel and components between the two real files and every `[toolchain]` block fenced in the book. Anything else in a block is free to differ, and a block may omit either key: the check is that what a copy does state is right, not that it restates everything. The `rustup component add` command lines are deliberately not covered -- they are not exhaustive, because rustup installs whatever the pin names. The book's bump procedure named only the root file, which is the other half of why this drifted, so it now names the nested copy and the guard. Verified: the guard passes on the corrected tree, and reverting either book page reproduces the real #727 drift with `missing rustfmt` named. Injecting a channel or component change into the nested pin is caught too. `sphinx-build -W --keep-going`, as the book gate runs it, succeeds. Signed-off-by: Vyncint Ng <[email protected]> * docs: list every workspace member in README, and guard the inventory `dialect-iket` and `iket-lower` have no row in README's Crate Overview -- 1,700 lines of compiler across two crates, invisible to anyone reading the tree's only map of itself. Both are workspace members with descriptions in their own manifests; they were simply never added. Nothing catches that. No build fails when a crate goes unlisted, and the overview is the only place the members are enumerated for a human, so the omission is silent by construction. `scripts/check-crate-inventory.sh` compares the root manifest's `members` list against the crate rows in that section, joining the other source-only guards and status-guard.yml. Direction is deliberate: every member needs a row, and extra rows are fine. `rustc-codegen-cuda` is not a workspace member -- it carries its own `[workspace]` for the rustc_private dylibs -- and is listed anyway, which is right, because a reader cares about the crate and not about which workspace resolves it. So the guard reports members with no row and never the reverse. Members come from the root Cargo.toml rather than `cargo metadata`: the question is which crates the workspace declares, which is what that list says, and reading it needs no cargo, no lockfile and no network. A glob entry would name crates the guard cannot resolve, so it refuses rather than skipping them silently. Verified: passes on the fixed tree (25 members, all listed); reverting just the README rows reports exactly `dialect-iket` and `iket-lower`; adding a member with no row is caught the same way. Stacked on #790, which adds the sibling toolchain-parity guard to the same workflow file -- review only the second commit. Signed-off-by: Vyncint Ng <[email protected]> --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
nihalpasham
pushed a commit
that referenced
this pull request
Aug 11, 2026
…803) The follow-up offered on #794. That PR added a Command reference table because the book documented 11 of the CLI's 15 subcommands; `test`, `fmt`, `update` and `emit-ltoir` appeared nowhere. Nothing stops the table falling behind again -- adding a variant to the clap enum is a one-line change and no build compares the two. `scripts/check-cli-doc-coverage.sh` compares the `Commands` enum in `crates/cargo-oxide/src/main.rs` against the rows under `### Command reference`, in both directions. A missing row is the common case; a row for a command that no longer exists is worse, because a reader trusts it and gets `unrecognized subcommand`. Subcommands come from the enum rather than from `cargo oxide --help`: the enum is the definition, reading it needs no cargo and no build, and that keeps the guard in the same source-only class as its siblings. A guard that needed a backend build to answer a documentation question would not get run. The parse is cross-checked against the built binary -- both report the same 15 commands, with no disagreement. Deliberately not required to appear: anything carrying `hide = true` (`__materializer-provenance` today) and clap's generated `help`, which is not in the enum at all. Descriptions are out of scope, because clap's short help is the doc-comment first line while the table's cells add MyST backticks around names like `cuda-gdb`; comparing them literally would fail on correct prose. While wiring it up: `check-guards` was running five of the seven guards. The crate-inventory and toolchain-parity jobs went into status-guard.yml in #793 and #790 without being added to the recipe, so `just check` could pass while status-guard failed -- exactly the drift #729 and #788 built that recipe to prevent. My omission; all three are in now, and the stale counts in its comment ("the status-guard pair", "two of the four") are fixed. Verified: passes on the clean tree (15 documented, 1 hidden excluded), and seven mutations each fail naming the cause -- new subcommand, deleted row, invented row, a row for the hidden command, a rename, and both parse self-tests. `just check-guards` is green end to end. Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham
added a commit
that referenced
this pull request
Aug 11, 2026
…805) * ci: guard the book's CLI command reference against subcommand drift The follow-up offered on #794. That PR added a Command reference table because the book documented 11 of the CLI's 15 subcommands; `test`, `fmt`, `update` and `emit-ltoir` appeared nowhere. Nothing stops the table falling behind again -- adding a variant to the clap enum is a one-line change and no build compares the two. `scripts/check-cli-doc-coverage.sh` compares the `Commands` enum in `crates/cargo-oxide/src/main.rs` against the rows under `### Command reference`, in both directions. A missing row is the common case; a row for a command that no longer exists is worse, because a reader trusts it and gets `unrecognized subcommand`. Subcommands come from the enum rather than from `cargo oxide --help`: the enum is the definition, reading it needs no cargo and no build, and that keeps the guard in the same source-only class as its siblings. A guard that needed a backend build to answer a documentation question would not get run. The parse is cross-checked against the built binary -- both report the same 15 commands, with no disagreement. Deliberately not required to appear: anything carrying `hide = true` (`__materializer-provenance` today) and clap's generated `help`, which is not in the enum at all. Descriptions are out of scope, because clap's short help is the doc-comment first line while the table's cells add MyST backticks around names like `cuda-gdb`; comparing them literally would fail on correct prose. While wiring it up: `check-guards` was running five of the seven guards. The crate-inventory and toolchain-parity jobs went into status-guard.yml in #793 and #790 without being added to the recipe, so `just check` could pass while status-guard failed -- exactly the drift #729 and #788 built that recipe to prevent. My omission; all three are in now, and the stale counts in its comment ("the status-guard pair", "two of the four") are fixed. Verified: passes on the clean tree (15 documented, 1 hidden excluded), and seven mutations each fail naming the cause -- new subcommand, deleted row, invented row, a row for the hidden command, a rename, and both parse self-tests. `just check-guards` is green end to end. Signed-off-by: Vyncint Ng <[email protected]> * ci: cover the codegen backend's own workspace in both license guards The second pass asked for in the #662 review: "a second pass over `crates/rustc-codegen-cuda` (its own workspace, invisible to both cargo-deny and this guard today)". Still true, and it had already cost a row. That crate carries its own `[workspace]` for the rustc-private dylibs, so it is a third resolution alongside the root and the examples, and neither existing guard reached it. The inventory guard read the root workspace through `cargo metadata`, which stops at that boundary; the policy side ran `cargo deny check` on the root and a script over the examples. **Inventory, and a live omission.** `rustc_codegen_cuda` had no row in dependency-licenses.csv at all -- the largest first-party crate in the tree, missing from the inventory, while every other member carried a `1st Party (workspace)` row. Nothing could have caught it. The guard now unions the declared crates of both first-party workspaces, which takes it from 41 to 55, and the missing row is added. **Policy.** `cargo deny` now runs over that workspace too, in the same job as the root run so the install is shared. This is narrower than it looks and worth stating precisely: all 82 of its third-party crate *names* also appear in the root graph, so nothing is unlicensed today. What differs is versions -- 17 (name, version) pairs resolve there and nowhere else, including `anyhow 1.0.100`, `libc 0.2.187` and `linkme 0.3.35` -- and advisory and license verdicts are per version, so an advisory against one of those 17 is invisible to the root run. Verified: * the inventory guard passes with the row (55 crates) and, with the row removed again, fails naming exactly `rustc_codegen_cuda`; * banning `anyhow =1.0.100`, a backend-only version, leaves the root run at `bans ok` and makes the backend run fail with `error[banned]` -- the new leg covers crates the root one cannot see; * `cargo deny --manifest-path crates/rustc-codegen-cuda/Cargo.toml --locked check` is clean on the current tree, so the policy half is prevention rather than a fix; * `just check-guards` green end to end, and both workflow files parse. No `--config` on the new run: cargo-deny walks up from the manifest directory to the repository-root deny.toml, the same resolution the example-policy script already relies on. Stacked on #803, which adds the CLI-reference guard to the same `check-guards` recipe -- review only the second commit. Signed-off-by: Vyncint Ng <[email protected]> --------- Signed-off-by: Vyncint Ng <[email protected]> Co-authored-by: nihalpasham <[email protected]>
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.
The defect
#727 added
rustfmttorust-toolchain.tomland to the nested copy atcrates/rustc-codegen-cuda/rust-toolchain.toml. The two[toolchain]blocksthe book quotes were left at five components:
Both are presented as the repo's actual file — that one says so outright — so a
reader copies the block into their own project and gets a pin with no
rustfmt.The symptom then surfaces somewhere unrelated:
cargo oxide fmtfails, orjust fmt-checkdoes, and neither points back at the toolchain file.cuda-oxide-book/compiler/rustc-public.mdcarried the same stale list.Why nothing caught it
The pin is duplicated three ways and no build compares them:
[workspace]against the nested copy,so a
rustc_privatebuild against a different nightly fails to load — abuild break, not a warning. That file's header already says "Must match the
parent cuda-oxide toolchain exactly!", but a comment enforces nothing, which
is precisely how build: pin rustfmt in rust-toolchain.toml like clippy #727 slipped past it.
The book's own bump procedure named only the root file — the other half of why
this drifted — so it now names the nested copy and the guard.
The guard
scripts/check-toolchain-parity.sh, alongside the other source-onlyconsistency guards, wired in as a
toolchain-pin-parityjob instatus-guard.yml(no rustup, cargo, or toolkit — it reads files).It compares channel and components between the two real files and every
[toolchain]block fenced in the book. Deliberate non-goals, so it stays quieton things that are legitimately free to vary:
right, not that it restates everything.
[toolchain]block (targets,profile) may differ.rustup component addcommand lines are not covered. They are notexhaustive by design, because rustup installs whatever the pin names.
It carries the same parse self-tests as its siblings, since a guard whose
failure mode is "silently matched nothing" has to prove it still reads its
inputs before a clean result means anything.
Verification
Passes on the corrected tree:
Reverting my fix reproduces the real #727 drift, naming the cause — this is the
guard failing on the bug it was written for, not a synthetic case:
The nested-pin half is exercised too, since nothing in the tree currently
violates it — injecting a channel change gives
pins channel 'nightly-2026-05-01', rust-toolchain.toml pins 'nightly-2026-04-03', anddropping
llvm-toolsfrom it is caught the same way.sphinx-build -W --keep-going -b html, exactly as the book gate runs it:build succeeded, exit 0.Note
This is a fifth guard script. #788 (open) adds a
check-guardsrecipe that runsthe existing four from
just check; whichever of the two lands second shouldadd this one to that list. I have left the Justfile alone here to avoid a
conflict between them.