Context
PR #490 fixed the two current workflow jobs that bypassed cli/rust-toolchain.toml. Its custom guard was intentionally removed before merge because review showed it was becoming an incomplete model of shell and GitHub Actions behavior.
Problem
A future workflow edit could reintroduce a floating or alternate Rust toolchain. A useful guard must cover more than literal cargo commands: actions such as Swatinem/rust-cache invoke Cargo internally, environment overrides can exist at workflow, job, container, and step scope, and nested tracked toolchain files can override the repository pin.
Desired outcome
Design a small, maintainable enforcement mechanism that:
- covers direct Cargo steps and known Cargo-running actions;
- accounts for supported GitHub Actions environment scopes, including container.env and Windows case-insensitive keys;
- considers tracked repository toolchain files without scanning ignored worktrees;
- avoids hand-parsing arbitrary shell;
- fails clearly when a new workflow shape requires an explicit policy decision.
Acceptance
- The guard rejects a floating installer, a literal alternate version, a late installer, a known Cargo-running action before installation, RUSTUP_TOOLCHAIN overrides, and tracked nested toolchain files.
- It accepts ignored/untracked worktrees.
- Its implementation remains deliberately bounded and reviewable.
Related: #490
Context
PR #490 fixed the two current workflow jobs that bypassed cli/rust-toolchain.toml. Its custom guard was intentionally removed before merge because review showed it was becoming an incomplete model of shell and GitHub Actions behavior.
Problem
A future workflow edit could reintroduce a floating or alternate Rust toolchain. A useful guard must cover more than literal cargo commands: actions such as Swatinem/rust-cache invoke Cargo internally, environment overrides can exist at workflow, job, container, and step scope, and nested tracked toolchain files can override the repository pin.
Desired outcome
Design a small, maintainable enforcement mechanism that:
Acceptance
Related: #490