fix(ci): install a Rust toolchain in the bump-version jobs - #653
Merged
Conversation
Red evidence for the main-branch CI failure. The `bump-version` job in ci.yml runs `python scripts/bump_version.py --update-all`, which shells out to `cargo update` and `cargo check --locked --manifest-path fuzz/Cargo.toml`, but never installs a Rust toolchain — it inherits whatever rustc the runner image ships. This test scans every workflow job, resolves the Python-script indirection, and asserts a toolchain is installed before the first cargo use. It currently fails on ci.yml:bump-version and versioning.yml:bump-version. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sfkzn8nZgGEddsoYWAf3BC
`bump_version.py` shells out to Cargo — `cargo update` for the root and fuzz lockfiles, then `cargo check --locked --manifest-path fuzz/Cargo.toml` as a guard against staging a fuzz lock the `fuzz-check` gate would reject. Neither `bump-version` job installed a toolchain, so both inherited whatever rustc the runner image preinstalled. That held until CI moved to Blacksmith runners (#646), whose ubuntu-2404 image ships rustc 1.92.0 — below `rust-version = "1.94"` (raised by sqlx 0.9). The locked fuzz check failed, the bump refused to stage, and every push to main went red while all seven build/test jobs stayed green. main has been stuck at 26.7.52 with no tags pushed since. Add `dtolnay/rust-toolchain@stable` before the bump step in both jobs, as every other Cargo-running job in the repo already does. ci.yml also gets a restore-only rust-cache sharing the `fuzz-check` job's key so the locked check reuses that build instead of recompiling the workspace. The guard inside bump_version.py is left alone — it correctly refused to commit a lockfile it could not verify. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sfkzn8nZgGEddsoYWAf3BC
Contributor
📝 WalkthroughWalkthroughThe bump-version workflows now install stable Rust and restore the fuzz Cargo cache before running version updates. New Rust tests scan workflows to enforce toolchain ordering for direct and indirect Cargo usage. ChangesVersion-bump toolchain enforcement
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Dev` diary/2026-07-27-ci-bump-version-toolchain.md:
- Around line 17-23: Update both fenced output blocks in the diary entry to
specify the text language on their opening fences, changing each unannotated
fence to ```text while preserving the existing contents.
- Around line 71-94: Update the “Testing (Logbie Testing Policy)” section to
explicitly map acceptance criteria to tests and record the required validation
evidence: formatting check, warnings-denied Clippy, and full verbose Cargo test
commands with their exact results. Include explicit Red/Green commit evidence
and preserve the existing risk class, boundary validation, and residual-risk
details.
In `@tests/workflow_rust_toolchain_test.rs`:
- Around line 26-27: Replace the broad TOOLCHAIN_MARKERS substring checks with
matching for genuine Rust toolchain setup/selection commands, excluding echo
text and unrelated rustup subcommands such as target additions. Extend the
script inventory detection to recognize Cargo invocations, including subprocess
argv forms and varied whitespace. Add regression fixtures covering whitespace
and alternate argv formatting, and ensure tests exercise the scanner’s actual
command-boundary logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0f9e5ef0-5947-42e1-93a2-e13a3d429651
📒 Files selected for processing (4)
.github/workflows/ci.yml.github/workflows/versioning.ymlDev diary/2026-07-27-ci-bump-version-toolchain.mdtests/workflow_rust_toolchain_test.rs
…ry evidence - Match real toolchain setup (action refs, rustup install/default/override) instead of loose rust-toolchain/rustup substrings, so echo/target-add mentions no longer satisfy the guard. - Make the script Cargo-argv detector whitespace- and quote-tolerant via whitespace collapse, and add regression fixtures for both. - Fill in the dev diary Testing section: acceptance-criteria->tests mapping, fmt/clippy/test validation evidence, and text-annotated fenced blocks. Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
The ordering half of the guard's contract — a toolchain step must come *before* the first Cargo use — was asserted by the main scan but never exercised by a fixture, so a regression in the comparison would have gone unnoticed. Add `toolchain_after_cargo_is_out_of_order` covering both the late and early arrangements. Also record verified evidence in the dev diary: re-running the tightened scanner against a temporarily toolchain-less ci.yml still reproduces the original defect, and the validation block now carries the numbers actually observed on rustc 1.94.1 plus the CI run that covers the full workspace suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sfkzn8nZgGEddsoYWAf3BC
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.
What's broken
Every push to
mainsince 2026-07-26 has produced a red CI run — four in a row (ed704e6a#646,7937a53b#649,f903e8e0#650,48c46423#652) — while all seven build/test jobs stayed green. The only failing job each time is Bump Version:Side effect: the bump never landed, so
mainis stuck at version 26.7.52 and nov*tags were pushed for those four commits.Root cause
bump-versionrunspython scripts/bump_version.py --update-all, which shells out to Cargo three times —cargo update --package wflfor the root lock, the same forfuzz/Cargo.lock, and finallycargo check --locked --manifest-path fuzz/Cargo.tomlas a guard so a bump can never stage a fuzz lock that thefuzz-checkgate would then reject.The job never installed a toolchain. Every other Cargo-running job in this repo uses
dtolnay/rust-toolchain@stable; this one silently inherited whateverrustcthe runner image preinstalled. That worked on GitHub-hosted images and stopped working the moment CI moved to Blacksmith runners (#646), whoseubuntu-2404image ships rustc 1.92.0 — below ourrust-version = "1.94"(raised by thesqlx0.9 dependency).It was easy to miss because the Cargo dependency is invisible in the workflow file — it hides behind a Python script, so scanning
ci.ymlforcargofinds nothing in this job. #646 only changed the job'sruns-on:label.The fix
.github/workflows/ci.yml— adddtolnay/rust-toolchain@stablebefore the bump step, plus a restore-onlySwatinem/rust-cachesharingfuzz-check'sfuzz-check-cachekey so the locked fuzz check reuses that job's build instead of recompiling the workspace on every push tomain..github/workflows/versioning.yml— the manual-dispatchbump-versionjob has the identical latent defect and would fail the same way the next time anyone triggered it. Same one-line fix.Deliberately not changed: the
cargo check --lockedguard insidebump_version.py. It did exactly its job — it caught a broken environment and refused to commit a lockfile it could not verify. Relaxing it would trade a loud failure for a silently stalefuzz/Cargo.lock.Test evidence
Risk class: R1 — build/release tooling; no runtime or language behavior changes, no public contract touched.
Acceptance criteria → tests (all in
tests/workflow_rust_toolchain_test.rs):scripts/*.pyindirection — installs a toolchain before the first Cargo usecargo_jobs_install_a_rust_toolchain_firstcargo_invoking_scripts_list_is_completecargomentions are ignored; real jobs are still foundscanner_ignores_comments_and_finds_jobsecho rust-toolchainandrustup target/component adddo nottoolchain_markers_reject_incidental_mentionsscript_cargo_detection_tolerates_whitespace_and_argv_formstoolchain_after_cargo_is_out_of_orderRed evidence: commit
2ab115dis test-only and an ancestor of the fix. It fails there for the intended reason — before any workflow edit existed:It caught the
versioning.ymlinstance too, which nobody had reported. After the scanner was tightened in review, it was re-checked against the original defect: removing the toolchain step fromci.ymlagain fails the guard withno toolchain step: ["ci.yml:bump-version"], so the hardening did not cost it its bite.Unit/component:
cargo test --test workflow_rust_toolchain_test→ok. 6 passed; 0 failed(rustc 1.94.1).Lint/format:
cargo fmt --all -- --checkclean;cargo clippy --all-targets --all-features -- -D warningsclean.Full workspace suite: CI run 30240210815 on this branch —
Build, Test, Clippygreen including itsRun Testsstep, plus integration, database, fuzz-compile and WFL-program jobs on Linux and Windows. A localcargo test --allwas attempted but exhausted the authoring container's disk allowance mid-link (aBus errorfrom the ~30 GBtarget/tree documented inCLAUDE.md) — an environment limit, not a test failure; CI runners carry theFree disk spacestep the container lacks.End-to-end / real boundary:
cargo check --locked --manifest-path fuzz/Cargo.toml— the exact command that failed in CI — run locally on rustc 1.94.1: exit 0,Finished dev profile in 2m 04s.Coverage: the guard covers all 8 workflow files and every job in them; it flagged 2 of the 11 Cargo-using jobs and passes on all 11 after the fix.
Platforms: the fixed jobs run on
blacksmith-4vcpu-ubuntu-2404; the guard itself is platform-independent (static file analysis).Not applicable, with reason: no §11.3 concurrency/streaming/lifecycle tests — this change adds a CI setup step and touches no runtime code, async path, or untrusted input. No docs-example validation — no user-facing syntax, stdlib, CLI flag, or config option changed.
Rollback/recovery: revert this PR; CI returns to its current (red
Bump Version) state, no external state to unwind. After merge the bump job resumes from 26.7.52 and pushes the next version + tag normally.Residual risk: the guard is a line scanner, not a YAML parse (the repo carries no YAML dependency), so it assumes job ids are the only two-space-indented keys under
jobs:— true for all current workflows and asserted by a scanner self-test. It cannot see Cargo invoked from a shell script or a composite action; onlyscripts/*.pyindirection is resolved.Note on verification limits:
bump-versionis gated ongithub.event_name == 'push' && github.ref == 'refs/heads/main', so it cannot run on this PR (it shows asskipped). This PR's CI proves nothing regressed; the definitive proof of the fix is theBump Versionjob on the post-merge push tomain.Dev Diary:
Dev diary/2026-07-27-ci-bump-version-toolchain.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01Sfkzn8nZgGEddsoYWAf3BC