Skip to content

fix(build): pin Rust via rust-toolchain.toml to keep Docker and CI in lockstep - #189

Merged
BtXin merged 3 commits into
mainfrom
fix/docker-rust-toolchain-lockstep
Aug 4, 2026
Merged

fix(build): pin Rust via rust-toolchain.toml to keep Docker and CI in lockstep#189
BtXin merged 3 commits into
mainfrom
fix/docker-rust-toolchain-lockstep

Conversation

@BtXin

@BtXin BtXin commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The release Docker build failed with:

aws-smithy-observability@0.3.0 requires rustc 1.94.1
aws-smithy-runtime@1.12.0 requires rustc 1.94.1
...

The aws-smithy-* versions locked in Cargo.lock (pulled in by the S3/object-store support, #171) require rustc 1.94.1, while the Dockerfile builder was pinned to rust:1.94.0-slim — one patch too old. CI never caught it because every workflow installs the floating stable toolchain, so only the release image build was exposed to the drift.

Fix

Make the Rust version a single source of truth so Docker, CI, and local dev move together:

  • Add rust-toolchain.toml pinning 1.96.1 (current stable, matches local dev). rustup resolves it for any cargo invocation in the repo — including inside the Docker build, since COPY . . brings the file in. The image therefore compiles with the pinned version even if the base-image tag drifts; the original failure mode can't recur.
  • Bump the Dockerfile builder to rust:1.96.1-slim, with a comment noting the tag match only avoids a toolchain download — correctness comes from the toolchain file.
  • Switch all workflows (ci, docs, release, draft-release, promote-release) from dtolnay/rust-toolchain@stable / rustup toolchain install stable to a bare rustup toolchain install, which installs the file-pinned version (rustup ≥ 1.28, standard on GitHub runners).

Behavior change

CI no longer floats on latest stable. A future dependency MSRV bump will fail loudly in every job until rust-toolchain.toml is raised (a one-line change), instead of surfacing only at release time.

Verification

  • Full builder-stage docker build with --build-arg FEATURES=rag (the exact failing release step) completed successfully with the new image.
  • rustup show active-toolchain in the repo resolves to 1.96.1 (overridden by rust-toolchain.toml).
  • All workflow YAML validated; no stable installs or dtolnay/rust-toolchain references remain.

🤖 Generated with Claude Code

BtXin and others added 3 commits August 4, 2026 15:32
… lockstep

The release Docker build failed because the aws-smithy crates locked in
Cargo.lock (pulled in by the S3/object-store support, #171) require
rustc 1.94.1, while the Dockerfile builder image was pinned to
rust:1.94.0-slim. CI never caught it because workflows installed the
floating `stable` toolchain.

Make the Rust version a single source of truth:

- Add rust-toolchain.toml pinning 1.96.1. rustup resolves it for any
  cargo invocation in the repo, including inside the Docker build
  (COPY . . brings it in), so the image compiles with the pinned
  version even if the base-image tag drifts.
- Bump the Dockerfile builder to rust:1.96.1-slim so the preinstalled
  toolchain matches the pin (tag match only avoids a download).
- Replace dtolnay/rust-toolchain@stable and `rustup toolchain install
  stable` across all workflows with a bare `rustup toolchain install`,
  which installs the file-pinned version (rustup >= 1.28).

CI now fails loudly on future dependency MSRV bumps until the pin is
raised, instead of the drift surfacing only at release time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The old `rustup toolchain install stable` was a no-op because runners
preinstall stable with rustfmt included. The pinned 1.96.1 toolchain is
a fresh install under the runner's minimal rustup profile, which has no
rustfmt, so `cargo fmt --check` failed. Add it alongside
llvm-tools-preview in the test job's install step.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A bare `rustup toolchain install` (no toolchain argument) installs
exactly what rust-toolchain.toml specifies and silently ignores CLI
--component flags, so rustfmt was still missing and `cargo fmt --check`
failed again. Add rustfmt and llvm-tools-preview in a separate
`rustup component add` step, which targets the active file-pinned
toolchain and cannot be skipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@BtXin
BtXin merged commit 8b35075 into main Aug 4, 2026
3 checks passed
@BtXin
BtXin deleted the fix/docker-rust-toolchain-lockstep branch August 4, 2026 08:24
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.

2 participants