Skip to content

ci: lint every pull request against the clippy ratchet - #685

Merged
midagedev merged 3 commits into
mainfrom
ci-lint
Oct 23, 2026
Merged

midagedev merged 3 commits into
mainfrom
ci-lint

Conversation

@midagedev

Copy link
Copy Markdown
Owner

A pull request ran no clippy. t0 installs rustfmt only, and the crates that link crates/gpu need the CUDA 13.3 headers for bindgen.

This adds a lint job beside t0. It fetches the headers from one pinned list (tools/nightly/cuda-debs.tsv, sha256-checked by tools/nightly/fetch-cuda-headers.sh, which the nightly installer now calls too), caches them, and runs tools/mac-check.sh lint natively on x86_64 Linux: the lint recipe's own command, the same ^warning: count and the same ratchet (3) the Mac and the box use.

Evidence: the mac-check self-test covers the native lane (red before it, green after); tools/check-recipes.sh green; the Mac cross lint unchanged (^warning: 0, ratchet 3); the fetch script ran (three sha256 ok, a tampered sha refused with 69). The first CI run of this PR is the first native run.

Written with AI help (Claude Code, GLM-5.3 round).

🤖 Generated with Claude Code

https://claude.ai/code/session_01TG5hgJqn38MRwLefZHyHCJ

@github-actions github-actions Bot added documentation Improvements or additions to documentation tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Oct 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: Header fetching can delete unrelated files, and installation fails from a private checkout.

Must fix

1. Preserve files outside the header directory

tools/nightly/fetch-cuda-headers.sh:122 An existing toolkit missing curand.h passes the destination guard. After a successful fetch, rm -rf "$DEST" deletes its bin/ and libraries. /opt/ also bypasses the protected-path check.
Cost: Fix this before a fetch deletes an operator's tools.
Replace lines 122–124 with:

mkdir -p "$DEST/targets/x86_64-linux/include"
cp -a "$stage/targets/x86_64-linux/include/." "$DEST/targets/x86_64-linux/include/"

2. Stage the fetcher before dropping privileges

tools/nightly/install.sh:69 A checkout beneath a root-owned parent with mode 0700 is readable by the operator but inaccessible to bnightly. The new as_b bash "$SRC/..." fails before installing just or the service. Previously, root read the checkout.
Cost: Preserve the installer's supported checkout locations during this extraction.
Replace line 69 with the following block and delete the old temporary-directory setup at lines 73–75:

T=$(mktemp -d)
trap 'rm -rf "$T"' EXIT
install -m 0644 "$SRC/tools/nightly/fetch-cuda-headers.sh" "$SRC/tools/nightly/cuda-debs.tsv" "$T/"
chown bnightly: "$T"
as_b bash "$T/fetch-cuda-headers.sh" "$H/opt/cuda-13.3"

3. Reuse the existing seed counter

tools/mac-check.sh:855 duplicates tools/mac-check.sh:793 exactly (R14). Both count the same seed file under $sc.
Cost: Reusing the existing owner removes one function before the lanes diverge.
Move this existing definition before both platform branches, delete native_seed_lines, and rename its calls to seed_lines:

seed_lines() { if [ -f "$sc/seed.tsv" ]; then wc -l < "$sc/seed.tsv" | tr -d ' '; else echo 0; fi; }

4. Use one flag for the native lane

tools/mac-check.sh:93 introduces CROSS, which is always the inverse of NATIVE. Only derive reads it. The two flags store one host-selection fact.
Cost: Removing the redundant flag now changes only one consumer.
Delete the CROSS assignments, its self-test local, and references in comments. Replace the case in derive with:

case $mode in check | lint) if [ "${NATIVE:-0}" = 0 ]; then printf '%s\n' --target "$TARGET"; fi ;; esac

Checked

Duplicates/elements: Both seed counters read the same file; CROSS duplicates NATIVE's host-selection state. The fixes remove one function and one flag.
Complexity: No Rust functions changed. Shell growth adds native host selection and prerequisite checks.
Silent failure: Hash mismatches abort before destination replacement; the CUDA_VERSION fallback changes only log text.
Tests: Adding --target trips the native-lane assertion. Inline lines are additions; all proposed fixes pass bash -n when applied in memory. Self-tests were not run by the validator.
Gates: The lint ratchet remains 3; CUDA package pins are unchanged.
Escape catalog: No C1–C4 matches in the cited additions. Pipelines retain pipefail; the new heredoc is quoted.

Notes

dryer and crapper did not run because no Rust file changed. The PR body defers native clippy output to CI.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

Comment thread tools/nightly/fetch-cuda-headers.sh Outdated
Comment on lines +122 to +124
rm -rf "$DEST"
mkdir -p "$(dirname "$DEST")"
mv "$stage" "$DEST"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserve existing toolkit files when a sentinel header is missing; deleting DEST also removes its binaries and libraries.

Suggested change
rm -rf "$DEST"
mkdir -p "$(dirname "$DEST")"
mv "$stage" "$DEST"
mkdir -p "$DEST/targets/x86_64-linux/include"
cp -a "$stage/targets/x86_64-linux/include/." "$DEST/targets/x86_64-linux/include/"

@github-actions github-actions Bot added the host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset label Oct 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:

Verdict: MUST_FIX: The destination deletion, private-checkout failure, duplicate counter and redundant flag remain.

Must fix

1. Preserve files outside the header directory

tools/nightly/fetch-cuda-headers.sh:122 An existing toolkit missing curand.h reaches this deletion after a successful fetch. Its binaries and libraries are deleted too. A destination such as /opt/ also passes the literal-path guard.
Cost: Fix this before a fetch deletes an operator's tools.
Replace lines 122–124 with:

mkdir -p "$DEST/targets/x86_64-linux/include"
cp -a "$stage/targets/x86_64-linux/include/." "$DEST/targets/x86_64-linux/include/"

2. Stage the fetcher before dropping privileges

tools/nightly/install.sh:69 A checkout beneath a root-owned directory with mode 0700 is readable by the operator but inaccessible to bnightly. This call fails before installing just or the service; the previous installer read the checkout as root.
Cost: Preserve supported checkout locations before the installer is deployed.
Replace line 69 with this block and remove the old temporary-directory setup at lines 73–75:

T=$(mktemp -d)
trap 'rm -rf "$T"' EXIT
install -m 0644 "$SRC/tools/nightly/fetch-cuda-headers.sh" "$SRC/tools/nightly/cuda-debs.tsv" "$T/"
chown bnightly: "$T"
as_b bash "$T/fetch-cuda-headers.sh" "$H/opt/cuda-13.3"

3. Reuse the existing seed counter

tools/mac-check.sh:855 duplicates tools/mac-check.sh:793 exactly (R14). Both functions count the same seed file under $sc.
Cost: Reuse the owner before the two implementations diverge.
Move the existing definition before both platform branches in self_test, delete native_seed_lines, and rename its calls to seed_lines:

seed_lines() { if [ -f "$sc/seed.tsv" ]; then wc -l < "$sc/seed.tsv" | tr -d ' '; else echo 0; fi; }

4. Use one flag for the native lane

tools/mac-check.sh:93 adds CROSS, always the inverse of NATIVE. Only derive consumes it; two flags store one host-selection fact.
Cost: Remove the redundant state while it has one consumer.
Delete the CROSS assignments, its self-test local, and references in comments. Replace the case in derive with:

case $mode in check | lint) if [ "${NATIVE:-0}" = 0 ]; then printf '%s\n' --target "$TARGET"; fi ;; esac

Checked

Duplicates: 0 new items in the interdiff; dryer reports 0 pairs. Earlier duplicate and redundant-state findings remain.
Complexity: crapper flags no changed function. The new Rust edits replace expressions only.
Silent failure: 0 new suppression sites. The changed call retains both error-propagating ? operators.
Tests: The assertion at crates/refset/src/arch/qwen4exp/mtp.rs:117 still compares every path and the length. Mutant: return an empty vector at line 45; the assertion fails. Checked by inspection; tests were not run.
Gates: No pins or thresholds moved.
Escape catalog: No new C1–C4 matches.
Fixes: All proposed shell edits pass bash -n when applied in memory.

Notes

The PR body defers native Clippy output to CI.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

midagedev and others added 2 commits October 23, 2026 08:15
A pull request ran no clippy: t0 installs rustfmt only, and the crates that link crates/gpu bindgen against the CUDA
13.3 headers a runner does not have. The new `lint` job beside t0 fetches those headers from one pinned list
(tools/nightly/cuda-debs.tsv, read by tools/nightly/fetch-cuda-headers.sh, which the nightly installer now calls too),
caches them on the list's hash, and runs `tools/mac-check.sh lint`, which now runs natively on x86_64 Linux: the lint
recipe's own command, the same `^warning:` count and the same ratchet the Mac and the box use. A missing header,
clippy or libclang is a named 69. The mac-check self-test covers the native lane (red before it existed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TG5hgJqn38MRwLefZHyHCJ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:

Verdict: MUST_FIX: The four earlier findings remain open; the host-fixture edit adds no finding.

Must fix

1. Preserve files outside the header directory

tools/nightly/fetch-cuda-headers.sh:122 An existing toolkit missing curand.h reaches this deletion after fetching. Its binaries and libraries are deleted too. A destination such as /opt/ also passes the literal-path guard.
Cost: Fix this before a fetch deletes an operator's tools.
Replace lines 122–124 with:

mkdir -p "$DEST/targets/x86_64-linux/include"
cp -a "$stage/targets/x86_64-linux/include/." "$DEST/targets/x86_64-linux/include/"

2. Stage the fetcher before dropping privileges

tools/nightly/install.sh:69 A checkout beneath a root-owned directory with mode 0700 is inaccessible to bnightly. This call stops installation before just and the service; the previous installer read the checkout as root.
Cost: Preserve supported checkout locations before deployment.
Replace line 69 with this block and remove the old temporary-directory setup at lines 73–75:

T=$(mktemp -d)
trap 'rm -rf "$T"' EXIT
install -m 0644 "$SRC/tools/nightly/fetch-cuda-headers.sh" "$SRC/tools/nightly/cuda-debs.tsv" "$T/"
chown bnightly: "$T"
as_b bash "$T/fetch-cuda-headers.sh" "$H/opt/cuda-13.3"

3. Reuse the existing seed counter

tools/mac-check.sh:857 duplicates tools/mac-check.sh:795 exactly (R14). Both count the same seed file under $sc.
Cost: Reuse the owner before the copies diverge.
Move the existing definition above both platform branches in self_test, delete native_seed_lines, and rename its calls to seed_lines:

seed_lines() { if [ -f "$sc/seed.tsv" ]; then wc -l < "$sc/seed.tsv" | tr -d ' '; else echo 0; fi; }

4. Use one flag for the native lane

tools/mac-check.sh:93 adds CROSS, always the inverse of NATIVE. Only derive consumes it; two flags store one host-selection fact.
Cost: Remove the redundant state while it has one consumer.
Delete both CROSS assignments, its self-test local, and its comment references. Replace line 218 with:

case $mode in check | lint) if [ "${NATIVE:-0}" = 0 ]; then printf '%s\n' --target "$TARGET"; fi ;; esac

Checked

Duplicates: 0 new items in the interdiff; dryer reports 0 pairs. The earlier duplicate and redundant-state findings remain.
Complexity: crapper flags no changed function. The interdiff adds one shell fixture-selection branch.
Silent failure: 1 changed status path followed. Darwin host errors remain named; other hosts select an explicit Mac test fixture.
Tests: Host selection passes Linux x86_64/aarch64 and Darwin arm64/x86_64 cases. Mutant: restore Linux's host at line 608; the Darwin overlap run then misses its toolchain and fails the rc assertion at line 936 (by inspection). Full self-test not run.
Gates: No pins or thresholds moved.
Escape catalog: No new C1–C4 matches.
Fixes: Current scripts and all proposed shell edits pass bash -n; edits checked in memory.

Notes

The PR body defers native Clippy output to CI.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

…the installer stages it

- fetch-cuda-headers.sh copies the headers into <dir>/targets/x86_64-linux/include and removes
  nothing else (an existing toolkit's bin/ survives), and refuses a <dir>/include that is a
  directory of its own; on the box: a toolkit with bin/nvcc and a stale cuda.h kept nvcc and got
  CUDA_VERSION 13030, a second run fetched nothing, an include directory was refused with 64.
- install.sh stages the fetcher and its pins in a bnightly-readable temporary directory, so a
  checkout under a root-only directory still installs.
- mac-check.sh: one seed counter for both platforms' lint cases, and NATIVE alone selects the
  native lane (CROSS is gone). Self-test ok on the Mac and on the box.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TG5hgJqn38MRwLefZHyHCJ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:

Verdict: CLEAN: All four earlier findings are fixed, and the new commits add no finding.

Checked

Duplicates: 0 new items; Grep confirms one seed counter and no remaining CROSS flag. Dryer reports 0 pairs.
Complexity: crapper flags no changed function. The shell changes add one destination-type guard.
Silent failure: 3 changed error paths followed: destination refusal, header copying, and staging. Each returns a nonzero status on failure.
Tests: All three scripts pass bash syntax checks. Five isolated derive cases pass; a flipped native comparison fails the expected-arguments assertion. Changed seed-count assertions reject recording a failed lint (inspection). Full self-test not run.
Gates: No pins, thresholds or test cases moved or removed.
Escape catalog: No new C1–C4 matches.

Notes

The PR body defers native Clippy output to CI. Native Clippy was not run here.

Not approved: this pull request changes .github/workflows/pr.yml, CONTRIBUTING.md, which changes the bot, CI or the toolchain and needs a person's approval.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@midagedev
midagedev merged commit 4de5188 into main Oct 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant