ci: restore Homebrew stub removal on macOS (fixes broken main)#55
Merged
Conversation
PR #54 pinned to macos-14 and dropped the PATH workaround on the (incorrect) assumption that macos-14 didn't ship the broken Homebrew `cargo` wrapper. It does — same failure as macos-15, the very next main-push run after PR #54 broke. Re-runs reproduce deterministically. Restore the stub-removal approach from the closed PR #53, this time on top of the macos-14 pin so we get both: the marginally healthier runner image and an active defense that doesn't rely on PATH ordering. This is the version that should have shipped originally.
The earlier stub-removal step ran successfully but cargo build still failed with the same rustup-init error — there's a third location of the broken cargo wrapper we never found. Stop hunting for it. Invoke cargo via \$HOME/.cargo/bin/cargo directly. dtolnay/rust-toolchain installs the rustup-managed proxies there on every OS, so the same absolute path works for both Ubuntu and macOS — no matrix-conditional logic needed. When GitHub fixes the runner image upstream, this is a trivial one-line revert.
Root cause finally found via debug output: the Swatinem cache contains a poisoned ~/.cargo/bin/rustup symlink that points at /opt/homebrew/bin/rustup-init (Homebrew's broken wrapper). dtolnay installs a working ~/.cargo/bin/rustup as a real 11MB Mach-O binary; Swatinem then restores the symlink over it, and every subsequent `cargo build` resolves through the broken Homebrew binary and fails with "unexpected argument 'build'". Fix in one diff: - `cache-bin: "false"` — stop caching ~/.cargo/bin entirely. We don't need it cached; dtolnay installs fresh every run in seconds. - `prefix-key: "v1-rust"` — bump the cache-key namespace so the existing poisoned cache entries are abandoned and a clean cache is built from scratch. Both options applied uniformly to the test and lint jobs.
3 tasks
mattfogel
added a commit
that referenced
this pull request
May 13, 2026
The original PR #54 pin to macos-14 was based on (incorrect) research claiming macos-14 was a clean escape hatch for the broken Homebrew rustup wrapper on macos-15. The actual root cause turned out to be a poisoned Swatinem cache, fixed in PR #55 with `cache-bin: false` and a prefix-key bump. With the real fix in place, macos-latest should work too. Trying it to keep the workflow aligned with GHA defaults. If this flakes, revert to macos-14 — that's the known-good fallback.
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
Main is currently red. PR #54's premise — that pinning to `macos-14` would dodge the broken Homebrew `cargo` wrapper — was wrong. The same wrapper ships on macos-14; the post-merge main-push run failed deterministically (and so did the rebased Dependabot PR #51). Two re-runs reproduce.
This PR restores the stub-removal approach from the (incorrectly closed) PR #53, on top of the macos-14 pin. The cleanup step deletes `/opt/homebrew/bin/cargo` (and the rest of the Rust toolchain wrappers) before Swatinem runs, so the only Rust binaries on the runner after dtolnay finishes are the ones under `~/.cargo/bin`. No PATH races, no flakes.
`runner.os == 'macOS'` guard keeps it from running on the Ubuntu matrix entry.
Test plan
Refs: actions/runner-images#13985, Homebrew/homebrew-core#178311. Apologies for the churn.