Skip to content

ci: restore Homebrew stub removal on macOS (fixes broken main)#55

Merged
mattfogel merged 4 commits into
mainfrom
ci/restore-homebrew-stub-removal
May 13, 2026
Merged

ci: restore Homebrew stub removal on macOS (fixes broken main)#55
mattfogel merged 4 commits into
mainfrom
ci/restore-homebrew-stub-removal

Conversation

@mattfogel

Copy link
Copy Markdown
Owner

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

  • All three checks pass on this branch (`test (ubuntu-latest)`, `test (macos-14)`, `lint`).
  • Once merged, main-push CI is green again.
  • Re-run `test (macos-14)` once to spot-check determinism.

Refs: actions/runner-images#13985, Homebrew/homebrew-core#178311. Apologies for the churn.

mattfogel added 4 commits May 13, 2026 15:52
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.
@mattfogel
mattfogel merged commit 28a7bf7 into main May 13, 2026
6 checks passed
@mattfogel
mattfogel deleted the ci/restore-homebrew-stub-removal branch May 13, 2026 20:10
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.
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.

1 participant