Skip to content

build(ci): pin the Rust toolchain and guard against pin drift - #10

Merged
hsusul merged 2 commits into
mainfrom
build/pin-rust-toolchain
Aug 22, 2026
Merged

build(ci): pin the Rust toolchain and guard against pin drift#10
hsusul merged 2 commits into
mainfrom
build/pin-rust-toolchain

Conversation

@hsusul

@hsusul hsusul commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Stacked on #9 — merge that first. This PR's diff will shrink to just the toolchain files once #9 lands.

Problem

CI runs dtolnay/rust-toolchain@stable and then cargo clippy -- -D warnings. Every new lint in a stable rustc release becomes a build failure on a commit that changed nothing. #9 exists because of exactly that.

Changes

rust-toolchain.toml — pins 1.97.1 with rustfmt/clippy and the minimal profile. rustup honors this for every cargo invocation, locally and in CI, so it is the real source of truth.

Both workflows now use dtolnay/rust-toolchain@1.97.1 instead of @stable. The action does not read rust-toolchain.toml — I checked its README — so without this the runner would pre-install one compiler while rustup built with another. @1.97.1 is a valid ref (confirmed against the action's branch list).

scripts/toolchain-pin-check.sh — the two pins above can't reference each other, so this asserts they agree, and that the active rustc matches too. It runs as the first step of the rust-core job, ahead of fmt and clippy.

I negative-tested the guard: it passes when aligned, and fails with workflow uses dtolnay/rust-toolchain@1.97.1 but rust-toolchain.toml pins 1.96.0 when I desynced them.

README gains a short note on why the pin exists.

Not the MSRV

rust-version = "1.90" in Cargo.toml still declares the minimum supported compiler. This pins the one we build and lint with. Those are different things and the toml comment says so.

Separately worth noting: the MSRV is currently never verified in CI — nothing builds against 1.90. Out of scope here, but it means that number is unproven.

Upgrading later

Bump channel in rust-toolchain.toml and the @<version> refs in both workflows. The guard fails the build if you only do one. Dependabot's github-actions ecosystem (coming in a later PR in this series) will see the pinned action ref and open bump PRs for it.

Verification

Gate Result
./scripts/toolchain-pin-check.sh pass
same, with toml desynced fails as intended
cargo fmt --all -- --check pass
cargo clippy -p lore-core -p lore-ipc --all-targets --all-features -- -D warnings pass
cargo test --locked -p lore-core -p lore-ipc --all-targets 346 pass, 4 ignored
both workflow files parse as YAML pass

hsusul added 2 commits August 22, 2026 16:42
`cargo fmt --all -- --check` and `cargo clippy -D warnings` both failed on
main under rustc 1.97.1. No source change caused this: `useless_concat` and
`unneeded_struct_pattern` are recent clippy lints, and CI pins nothing.

Three clippy fixes, all in test code and all semantics-preserving:
  - codex.rs: two single-argument `concat!(..)` calls collapsed to plain
    string literals (clippy::useless_concat).
  - ingest_file.rs: `IngestOutcome::Skipped { .. }` -> `IngestOutcome::Skipped`;
    it is a unit variant (clippy::unneeded_struct_pattern).

Then `cargo fmt --all`, which rewrapped 18 over-width assertion lines across
the two adapters, adapters/common.rs, and four integration tests. Mechanical
line-wrapping at the 100-column limit only.

No production code touched. Verified green: fmt, clippy (lore-core/lore-ipc
and lore-app), cargo test --locked --all-targets (346 pass / 4 ignored),
no_network_in_archive, no_egress, egress-check.sh, IPC bindings in sync,
npm lint/typecheck/test (148 pass).

Follow-up: pinning the toolchain so this cannot recur.
CI ran `dtolnay/rust-toolchain@stable` with `cargo clippy -- -D warnings`, so
any new lint in a stable release broke the build on a commit that changed
nothing. That is not hypothetical: it is exactly how main went red under
1.97.1 (previous commit). Pinning turns a toolchain upgrade into an explicit,
reviewable change.

  - rust-toolchain.toml pins 1.97.1 with rustfmt/clippy and the minimal
    profile. rustup honors it for every cargo invocation, locally and in CI.
  - Both workflows now reference dtolnay/rust-toolchain@1.97.1 rather than
    @stable, so the runner pre-installs the same compiler rustup would fetch
    (the action does not read rust-toolchain.toml — verified against its
    README; @1.97.1 is a valid ref).
  - scripts/toolchain-pin-check.sh fails if the toml channel, the workflow
    action refs, and the active rustc are not all the same version. Wired in
    as the first step of the rust-core job, ahead of fmt/clippy. Verified it
    passes when aligned and fails when the toml and workflows disagree.

This is not the MSRV. `rust-version = "1.90"` in Cargo.toml still declares the
minimum supported compiler; this pins the one we build and lint with.

Verified: pin check, fmt, clippy (both invocations), cargo test --locked
--all-targets (346 pass / 4 ignored), both workflow files parse as YAML.
@hsusul
hsusul force-pushed the build/pin-rust-toolchain branch from 29ce4a6 to 26e9b06 Compare August 22, 2026 21:56
@hsusul
hsusul merged commit 99ef7f9 into main Aug 22, 2026
3 checks passed
@hsusul
hsusul deleted the build/pin-rust-toolchain branch August 22, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant