Repository navigation
ci: the example-policy guard's parse self-test cannot detect the rot it guards - #1044
Merged
nihalpasham merged 1 commit intoAug 19, 2026
Merged
Conversation
…it guards
`check-example-license-policy.sh` collapses every example lock file into
groups keyed by their third-party `(name, version, source)` triples and runs
cargo-deny once per distinct group. The comment above its second self-test
states the hazard exactly:
# Mirrors the inventory guard: if the lock-file regexes silently rotted,
# the groups would quietly collapse and a single run would vouch for
# everything.
That test cannot see it. `seen` incremented once per `[[package]]` string
split, before any regex ran, so it counts blocks rather than parses.
Simulating a rot of `^name` over the real tree:
healthy locks=217 seen=13871 groups=31
regexes rotted locks=217 seen=13871 groups=1 <- both floors pass
Every triple fails to match, every lock parses as having zero third-party
crates, all 217 collapse into the single empty group, and the guard runs
cargo-deny once, over one example, and exits 0 -- vouching for everything,
which is the outcome the comment says it prevents. Verified for `^name`,
`^version` and `^source` independently; each rots to the same outcome.
Three changes:
- `seen` becomes `parsed`, counted only after `name` and `version` match.
Every locked package carries both, so the tally now goes to zero on a rot
instead of staying at 13871. Its floor is scaled to the locks found rather
than fixed, so it cannot go stale as the tree grows.
- A per-lock assertion is the actual detector: every example reaches
crates.io through cuda-core/cuda-device/cuda-host, so a lock resolving no
third-party crate at all means the parse failed. Measured range across the
tree is 46 to 142 per lock, so the margin is wide, and a rot takes every
lock to zero.
- The `len(locks) < 20` floor is replaced by a cross-check against an
independent enumeration. A count cannot tell a narrowed glob from a smaller
tree -- `[a-m]*` still finds 137 of 217 locks and clears any floor loose
enough to survive ordinary growth -- whereas every example directory with a
Cargo.toml has a Cargo.lock beside it (215 of each today), so comparing the
two sets names exactly what the glob stopped reaching.
Four mutations, each failing with a specific message where the old code
passed silently: rotting `^name`, `^version` or `^source` each reports
`no third-party crates in .../abi_hmm/Cargo.lock`, and narrowing the glob to
`[a-m]*` reports `found no Cargo.lock for 78 example(s)` and names five.
The scope sentence is also corrected: it described 187 lock files (186
examples plus one nested sub-workspace) collapsing to 26 runs. Today's tree
is 217 locks -- 215 examples plus two nested sub-workspaces,
cutile_inter_kernel/simt and interop_cubin_identity/device -- collapsing to
the 31 runs the script itself announces. The "measured when this guard was
written" line above it is a timestamped measurement and is left as written.
Verified: the guard passes unchanged on today's tree, 31 representatives, all
reporting `advisories ok, bans ok, licenses ok, sources ok`.
Signed-off-by: Vyncint Ng <[email protected]>
Collaborator
|
nihalpasham
approved these changes
Aug 19, 2026
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]>
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.
check-example-license-policy.shcollapses every example lock file into groups keyed by their third-party(name, version, source)triples and runs cargo-deny once per distinct group. The comment above its second self-test states the hazard exactly:That test cannot see it.
seenincremented once per[[package]]string split, before any regex ran, so it counted blocks rather than parses. Simulating a rot of^nameover the real tree:Every triple fails to match, every lock parses as having zero third-party crates, all 217 collapse into the single empty group, and the guard runs cargo-deny once, over one example, and exits 0 — vouching for everything, which is the outcome the comment says it prevents. Verified for
^name,^versionand^sourceindependently; each rots to the same result.Three changes
seenbecomesparsed, counted only afternameandversionmatch. Every locked package carries both, so the tally now goes to zero on a rot instead of staying at 13871. Its floor is scaled to the locks found rather than fixed, so it cannot go stale as the tree grows.A per-lock assertion is the actual detector. Every example reaches crates.io through cuda-core/cuda-device/cuda-host, so a lock resolving no third-party crate means the parse failed. Measured range across the tree is 46 to 142 per lock, so the margin is wide — and a rot takes every lock to zero.
The
len(locks) < 20floor is replaced by a cross-check against an independent enumeration. A count cannot tell a narrowed glob from a smaller tree —[a-m]*still finds 137 of 217 locks and clears any floor loose enough to survive ordinary growth — whereas every example directory with aCargo.tomlhas aCargo.lockbeside it (215 of each today), so comparing the two sets names exactly what the glob stopped reaching.Mutations
Each fails with a specific message where the old code passed silently:
^nameparse self-test failed: no third-party crates in .../abi_hmm/Cargo.lock^version^source[a-m]*found no Cargo.lock for 78 example(s), so deny.toml cannot be enforced over them: ne_bytes_transmute, nested_index_assignment, …Scope note
The scope sentence is also corrected: it described 187 lock files (186 examples plus one nested sub-workspace) collapsing to 26 runs. Today's tree is 217 locks — 215 examples plus two nested sub-workspaces,
cutile_inter_kernel/simtandinterop_cubin_identity/device— collapsing to the 31 runs the script itself announces.The
# Measured when this guard was written:line above it is a timestamped measurement and is left exactly as written.Verification
The guard passes unchanged on today's tree: 31 representatives, every one reporting
advisories ok, bans ok, licenses ok, sources ok, exit 0. All counts re-measured againstf1e62fe2.