Skip to content

fix(ci): unbreak macOS by disabling rust-cache bin caching#165

Merged
pratyush618 merged 1 commit into
masterfrom
fix/ci-cargo-bin-cache
May 14, 2026
Merged

fix(ci): unbreak macOS by disabling rust-cache bin caching#165
pratyush618 merged 1 commit into
masterfrom
fix/ci-cargo-bin-cache

Conversation

@pratyush618
Copy link
Copy Markdown
Collaborator

Summary

The Python Tests (macos-latest / Python 3.13) job has been failing on every master push since the Swatinem rust-cache action's saved ~/.cargo/bin/ got poisoned (master run 25851399868, master run 25845951470). uv sync --extra dev runs maturin → cargo metadata, and macOS responds with:

error: error: unexpected argument 'metadata' found
Usage: rustup-init[EXE] [OPTIONS]

i.e. the cached cargo proxy is dispatching as rustup-init.

Root cause

Two upstream behaviours compose into the failure:

  1. rustup 1.28 turned the toolchain installer into a multicall binary — cargo, rustc, rustup, rustup-init are hardlinks/symlinks to the same executable, dispatching by argv[0].
  2. Swatinem/rust-cache@v2 caches ~/.cargo/bin/ by default and runs a "cache clean" pass that mutates the directory. Under the rustup 1.28 layout, restoring the cached bin dir overwrites the freshly-installed multicall binary with a stale rustup-init, breaking the cargo proxy.

The action's README documents this exact failure mode under "Known Issues" and recommends cache-bin: false as the fix. References:

Fix

Two inputs added to every Swatinem/rust-cache@v2 invocation in .github/workflows/ci.yml (5 jobs: lint, rust-test, rust-test-postgres, rust-test-redis, test):

  • cache-bin: false — stop caching ~/.cargo/bin/. dtolnay/rust-toolchain@stable reinstalls the proxies in <5 s on every run; there is no meaningful cache-hit benefit from including the bin dir, and the failure class is eliminated.
  • prefix-key: v1-rust-bin-fix — bumps the cache key so the existing v0-* caches (which contain the poisoned macOS bin dir) are evicted. Without this the very next run would still restore the broken cache before the new cache-bin: false directive applies on save.

Applied to all five call sites (not only the macOS-affected test job) for consistency and to immunize the Linux/Windows runners against the same regression when their runner images rotate to rustup 1.28.

The valuable caches (target/, ~/.cargo/registry/, ~/.cargo/git/db/) are unaffected.

Test plan

  • PR CI must pass on macOS: Python Tests (macos-latest / Python 3.13) and Python Tests (macos-latest / Python 3.10) complete uv sync --extra dev, the maturin build, and pytest tests/ -v.
  • Linux + Windows matrix entries still pass, no regression in timings.
  • After merge, the next master push CI run is fully green.
  • gh cache list --ref refs/heads/master shows new entries starting with v1-rust-bin-fix-… after the post-merge run.

Swatinem/rust-cache's default cache-clean step poisons ~/.cargo/bin
under rustup 1.28's multicall binary layout — `cargo` ends up restored
as `rustup-init`, breaking `maturin`'s `cargo metadata` call on
macos-latest. Set cache-bin: false and bump prefix-key to evict the
existing poisoned caches.
See: Swatinem/rust-cache#16
@github-actions github-actions Bot added the ci label May 14, 2026
@pratyush618 pratyush618 merged commit 39d7080 into master May 14, 2026
20 checks passed
@pratyush618 pratyush618 deleted the fix/ci-cargo-bin-cache branch May 14, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant