Skip to content

ci: pin the prek job's Rust toolchain to rust-toolchain.toml#454

Merged
andrius-puksta-sensmetry merged 1 commit into
sensmetry:mainfrom
consideRatio:ci/pin-rust-for-prek
Jul 20, 2026
Merged

ci: pin the prek job's Rust toolchain to rust-toolchain.toml#454
andrius-puksta-sensmetry merged 1 commit into
sensmetry:mainfrom
consideRatio:ci/pin-rust-for-prek

Conversation

@consideRatio

@consideRatio consideRatio commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

The prek job's language: rust hooks do not use the toolchain pinned by rust-toolchain.toml: prek picks a toolchain itself from what is installed, preferring the runner image's latest stable. When a newer stable clippy adds an auto-fixable lint, the cargo clippy --fix hook rewrites files and fails the gate with "files were modified". This hit #453 after the runner image moved to 1.97, forcing it to carry four unrelated lint fixes.

Two changes, verified locally by reproducing the failure and confirming the fix against prek's trace output:

  • language_version: "1.96" on the rust hooks in .pre-commit-config.yaml: prek's own selector, the part that actually pins.
  • A rustup toolchain install step in the workflow so the pinned toolchain (with the rustfmt/clippy components) exists for prek to find. Without it, prek downloads a profile-minimal toolchain lacking those components and cargo silently falls through to another toolchain's binaries.

The pin now lives in two places; rust-toolchain.toml and the hook config cross-reference each other so they get bumped together.


🤖 Generated with Claude Code

https://claude.ai/code/session_01EfyrkJkeo3mRngVoppJjUN

@andrius-puksta-sensmetry

Copy link
Copy Markdown
Collaborator

(commit has to be signed)

prek's language: rust hooks do not use the toolchain pinned by
rust-toolchain.toml: prek picks a toolchain itself from what is
installed, preferring the runner's latest stable. A newer stable clippy
then rewrites files via the --fix hook and fails the gate with 'files
were modified' (seen when the runner image moved to 1.97).

Pin in two parts, verified against prek's trace output:

- language_version on the rust hooks in .pre-commit-config.yaml, prek's
  own selector and the part that actually pins.
- A rustup toolchain install step in the workflow so the pinned
  toolchain (with the rustfmt/clippy components) exists for prek to
  find. prek's own mid-hook download is profile-minimal without those
  components, and cargo then silently falls through to another
  toolchain's binaries.

rust-toolchain.toml and the hook config cross-reference each other so
the two pins get bumped together.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EfyrkJkeo3mRngVoppJjUN
Signed-off-by: Erik Sundell <erik.sundell+2025@sensmetry.com>
@consideRatio
consideRatio force-pushed the ci/pin-rust-for-prek branch from 58b7acd to 3dbc6ce Compare July 20, 2026 06:56
@andrius-puksta-sensmetry
andrius-puksta-sensmetry merged commit 9371592 into sensmetry:main Jul 20, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants