Skip to content

Pin the Rust toolchain in rust-toolchain.toml - #646

Merged
yansfil merged 2 commits into
mainfrom
ci/pin-rust-toolchain
Oct 6, 2026
Merged

yansfil merged 2 commits into
mainfrom
ci/pin-rust-toolchain

Conversation

@yansfil

@yansfil yansfil commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: #624 (where the failure was first seen)

Summary

The repository named no Rust version, so CI built with whatever stable the runner image carried.
Since 2026-10-06 16:47 UTC the ubuntu image carries 1.99, and code already on main fails -D warnings there: AtomicUsize::fetch_update is deprecated (renamed try_update) at herdr-core/src/remote.rs:3454 and herdr-core/src/labels/tests.rs:95, and Clippy's needless_borrows_for_generic_args fires at herdr-core/src/changes.rs:258 (run 37498297429, rust workspace).
Every pull request that touches Rust, and main itself, fails the same way.
rust-toolchain.toml now pins 1.98.0 with rustfmt and Clippy (minimal profile); rustup reads it on the first rustc or cargo call on every runner and workstation, so no workflow step changes.
Moving to 1.99 with those three fixes is the next pull request.

  • The version is written only in that file: scripts/tests/test_rust_toolchain_pin.py (policy lane) fails when a workflow, script, document or crate manifest restates it, or when a script reaches a toolchain around rustup.
  • scripts/check-typed-live-remote.sh put ~/.rustup/toolchains/stable-*/bin first on PATH, which bypasses the pin; that line is gone (toolchain-env.sh, which it already sourced, does the resolution).
  • docs/BUILD.md gains "One toolchain version"; the pr.yml rust-lane comment and the nightly.yml header no longer describe the image's toolchain as the one used.

Review

  • 판단해 주세요: 1.98.0, not 1.98.1. The last green main run (37482154440) used the image's 1.98.1; 1.98.0 is already installed with rustfmt and Clippy on the workstation that runs most local verification, so no session downloads a second toolchain. This pull request's full CI run is what proves 1.98.0 on main's code.
  • 판단해 주세요: who proposes the next version. Proposal, as its own small pull request after this one merges: a rust-toolchain entry in dependabot.yml (Dependabot updates channel = "1.xx.yy" in this file, changelog), weekly with the 7-day cooldown cargo uses; its pull request's CI lists what the new compiler and Clippy ask, and the fixes land on that pull request.
  • 조심해서 볼 파일: rust-toolchain.toml - every Rust job on Linux, macOS and Windows now installs this version through rustup on its first call, including the plan job's cargo metadata; no job has an install step to fail visibly instead.
  • 비용 검토: each job that runs Rust now downloads the pinned toolchain once (the image has another version, and rust-cache does not keep ~/.rustup): about 8 s, the plan step's 10 s here against 2 s on Count an agent as installed only when its program is found #624; the cache steps took no longer than on main.

Evidence

  • 확인한 것: verify run 37502329000, full plan, all passed, Clippy -D warnings over the whole workspace included. In each of the nine jobs that built Rust (Linux, Windows MSVC, macOS), rust-cache lists 1.98.0 installed beside the image's own 1.98.1 or 1.99.0; nothing but this file installs 1.98.0, and rustup installs a toolchain only when a call resolves to it. That list names what is installed, not what ran; no job prints its active toolchain.
  • 확인한 것: policy suite locally, 165 tests pass, with the five structural checks and the Herdr pin check.
  • 확인한 것: the new test fails on both defects it names when they are planted (main's line 4 of check-typed-live-remote.sh; a line "Built with Rust 1.98.0 on CI." in docs/BUILD.md) and passes once they are removed.
  • 확인한 것: under an empty HOME with toolchain-env.sh sourced, rustup show active-toolchain answers 1.98.0 overridden by this file, cargo --version answers 1.98.0, and the HOME stays 0 bytes: nothing was downloaded.
  • 확인하지 못한 것: no local cargo build, Clippy or test run on 1.98.0 (workstation disk); the CI run above is the proof. package.yml, release.yml and herdr-update.yml did not run on this pull request; they build in the repository root on macOS like desktop e2e, so they read the same file.

CI built with whatever stable the runner image carried, so a new image
failed code already on main in every pull request at once. The version
is now written only in rust-toolchain.toml, which rustup reads on every
runner and workstation. A test fails when anything restates it or a
script reaches a toolchain around rustup; check-typed-live-remote.sh
did, and no longer does.
@yansfil
yansfil merged commit 49298d7 into main Oct 6, 2026
19 checks passed
@yansfil
yansfil deleted the ci/pin-rust-toolchain branch October 6, 2026 17:57
yansfil added a commit that referenced this pull request Oct 6, 2026
Related: #646 (the pin this keeps moving)

## Summary

Since #646 the Rust version is whatever `rust-toolchain.toml` names, so
a new release reaches this repository only when someone moves the file.
`.github/dependabot.yml` gains a `rust-toolchain` entry: every Monday
Dependabot checks for a newer stable release and opens a pull request
that changes `channel` ([Dependabot
changelog](https://github.blog/changelog/2025-08-19-dependabot-now-supports-rust-toolchain-updates/)).
That pull request's CI lists what the new compiler and Clippy ask of the
code, and the fixes are pushed to it; `docs/BUILD.md`, "One toolchain
version", says so.

## Review

- **판단해 주세요**: no cooldown. Cargo and Actions wait seven days;
Dependabot's [options
reference](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference)
lists no cooldown for `rust-toolchain`, so a release is proposed the
Monday after it ships and a point release that follows is proposed
again. The alternative is no automation and a person watching releases.

## Evidence

- **확인한 것**: the file parses as YAML with three update entries (cargo,
github-actions, rust-toolchain); the policy suite passes locally, 165
tests.
- **확인하지 못한 것**: that Dependabot accepts the entry; GitHub validates
`dependabot.yml` only after it reaches the default branch, where a
rejected entry shows in the repository's Dependabot settings.
yansfil added a commit that referenced this pull request Oct 6, 2026
Related: #646 (the pin whose use this makes visible)

## Summary

#646's evidence that every CI job built with the pinned Rust was
indirect: `rust-cache` prints the toolchains a runner has installed, and
the pinned one appearing there next to the image's own does not say
which one ran.
`scripts/verify-cargo.sh`, the only Rust entrypoint every workflow
calls, now prints `rustc --version` and `cargo --version` once it has
accepted its arguments and before it runs cargo, so each job's log names
the toolchain that built.

- On stderr: `verify-cargo.sh metadata` hands its stdout to
`scripts/ci-plan.py` as JSON.
- After argument validation: a refused call still never reaches cargo,
as `test_invalid_cargo_mode_or_artifact_redirection_never_calls_cargo`
requires.
- `docs/BUILD.md`, "One toolchain version", says where to read it.

## Review

- **조심해서 볼 파일**: `scripts/verify-cargo.sh` - every Rust job and the PRD
harness's sealed `test` and `lint` commands go through it; the added
calls write only to stderr and change no argument cargo receives.
- **비용 검토**: two short process starts per call (a Rust lane makes a few
calls), and on a runner the first of them is where rustup installs the
pinned toolchain, which the next cargo call did before.

## Evidence

- **확인한 것**: new
`test_the_toolchain_is_named_on_stderr_before_cargo_runs` (fake `rustc`
and `cargo`): the calls are `rustc --version`, `cargo --version`, then
`cargo metadata`, the two version lines open stderr, stdout has neither.
Against `main`'s script it fails with `[['cargo', 'metadata', ...]] !=
[['rustc', '--version'], ...]`.
- **확인한 것**: policy suite locally, 166 tests pass; the existing
entrypoint tests read the work calls only.
- **확인한 것**: a real `verify-cargo.sh metadata --format-version 1
--no-deps` in this checkout: stdout parses as JSON (11 packages), stderr
opens with `rustc 1.98.0` and `cargo 1.98.0`.
- **확인한 것**: [verify run
37508081360](https://github.com/modakbul-gongbang/hide/actions/runs/37508081360),
full plan: every `verify-cargo.sh` call in the nine jobs that build Rust
printed `rustc 1.98.0` and `cargo 1.98.0` (`windows check` 14 calls, `os
contract` 3 on each of Linux, Windows and macOS, `rust workspace` and
`remote mailbox` 2, `desktop e2e`, `build hided linux` and `windows e2e`
1), and `plan` still read the crate graph from `metadata`.
- **확인하지 못한 것**: `package.yml`, `release.yml` and `herdr-update.yml` did
not run here; they call the same script.
yansfil added a commit that referenced this pull request Oct 6, 2026
Related: #646 (the pin this moves), #650 (prints the toolchain each job
runs)

## Summary

`rust-toolchain.toml` moves from 1.98.0 to 1.99.0, the stable the runner
images carry since 2026-10-06, with the changes 1.99 asks of the code.
These are the findings that failed `-D warnings` on every Rust pull
request before the toolchain was pinned ([run
37498297429](https://github.com/modakbul-gongbang/hide/actions/runs/37498297429)):

- `AtomicUsize::fetch_update` is deprecated in 1.99, renamed
`try_update` with the same arguments and result:
`herdr-core/src/remote.rs` (the forward-connection cap) and
`herdr-core/src/labels/tests.rs` (the fake provider's timeout budget).
- Clippy's `needless_borrows_for_generic_args`:
`herdr-core/src/changes.rs` passed `&relative` to `Option::and_then`;
the closure borrows only `request`, so it is `Copy`, and passing it by
value leaves the later call working.

No finding is silenced with `allow`.

## Review

- **조심해서 볼 파일**: `herdr-core/src/remote.rs` - the cap on concurrent
forwarded connections; `try_update` is the same compare-and-swap loop
under a new name.

## Evidence

- **확인한 것**: [verify run
37507575187](https://github.com/modakbul-gongbang/hide/actions/runs/37507575187),
full plan, 17 jobs pass, Clippy `-D warnings` over the whole workspace
included. Every job that built Rust (Linux, Windows MSVC, macOS) had
1.99.0 installed beside the image's 1.98.1; only this file installs
1.99.0, and rustup installs a toolchain only when a call resolves to it.
This run does not print the toolchain that ran; with #650 merged, a
rerun's log names it on every `verify-cargo.sh` call.
- **확인한 것**: `test_rust_toolchain_pin.py` writes its whole-token probe
inside its own temporary folder; 4 tests pass locally with this pin.
- **확인한 것**: rustfmt (1.98.0) accepts the three changed files.
- **확인하지 못한 것**: nothing was built, linted or tested locally on 1.99.0:
it is not installed on the workstation, and installing it would add a
second toolchain copy for every session there. Clippy and the tests on
1.99.0 in this pull request's CI are the proof.
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