ci: disable Swatinem/rust-cache cache-bin to fix macOS flake#48
Merged
Conversation
`Swatinem/rust-cache@v2` defaults to `cache-bin: true`, which caches `~/.cargo/bin/`. Its proxy-detection logic for the rustup shims is unreliable on macos-arm64 hosted runners: it can save the `rustup-init` proxy into the cache and, on a later run, restore that stale binary on top of the freshly installed `cargo`. The next `cargo test` invocation then resolves to `rustup-init` and fails with: error: unexpected argument 'test' found Usage: rustup-init[EXE] [OPTIONS] Re-runs "usually" fix it because a healthy save can overwrite a poisoned one, but a single bad save poisons every subsequent restore until the cache key changes (i.e., a Rust version bump). PR46 (switching from dtolnay/rust-toolchain to actions-rust-lang/setup-rust-toolchain) did not address this — the toolchain step succeeds and is then clobbered by the cache restore. Disable `cache-bin` on every `Swatinem/rust-cache@v2` step in `ci.yml` (test/rustfmt/clippy/docs). We have no installed bin tools worth caching in any of these jobs — `cargo-llvm-cov` is installed via `taiki-e/install-action`, which has its own caching. Leaves the mutation workflow untouched (ubuntu-only and benefits from caching `cargo-mutants`). Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to PR46. The macOS test job is still hitting the same flake (e.g. https://github.com/mcarvin8/config-disassembler/actions/runs/25860900445/job/75990262606?pr=47):
PR46 confirmed the toolchain install itself succeeds — the runner reports
rustc 1.95.0/cargo 1.95.0immediately before tests. The failure happens in the next ~4s window, which is whenSwatinem/rust-cache@v2restores its cache.Root cause
Swatinem/rust-cache@v2defaults tocache-bin: true, which caches~/.cargo/bin/. Its rustup-proxy exclusion is unreliable on macos-arm64 runners and can save the rawrustup-initbinary into the cache. On a later run, the cache restore overwrites the freshly installedcargoproxy with that stalerustup-init, so the nextcargo testresolves torustup-initand exits 1.This matches the user-observed "re-runs usually fix it" pattern: a healthy save can overwrite a poisoned one, but a single bad save then poisons every subsequent restore until the cache key changes (i.e. a Rust version bump).
Fix
Pass
cache-bin: falseto everySwatinem/rust-cache@v2step inci.yml(test/rustfmt/clippy/docs). The matrix has no installed bin tools worth caching:cargo-llvm-covviataiki-e/install-action, which has its own caching.mutation.ymlandrelease-plz.ymlare untouched — both are ubuntu-only and the mutation workflow benefits from caching the compiledcargo-mutantsbinary.Test plan
rustup-initerror