formula: imply link_overwrite for related formulae#21689
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores expected version-switching behavior when linking versioned or -full formulae by treating Homebrew-owned conflicts from related formula families as implied link_overwrite candidates (e.g., cleaning up leftover npm files when switching node → node@22). It also adds tests around the new/adjusted conflict handling and updates agent contribution guidance.
Changes:
- Extend
Formula#link_overwrite?to allow implied overwrites for conflicts owned by Homebrew when they are related to the current formula family. - Add unit/spec coverage for the new implied-overwrite behavior and for formula-aware unlinking during
brew link. - Update
AGENTS.mdwith additional testing and spec-authoring guidance.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
Library/Homebrew/formula.rb |
Implements implied overwrite logic for related formula families during linking. |
Library/Homebrew/test/formula_spec.rb |
Adds a unit spec covering implied overwrite when a conflict path isn’t in any keg. |
Library/Homebrew/test/cmd/link_spec.rb |
Adds a unit spec ensuring brew link uses formula-aware unlink handling. |
AGENTS.md |
Adds guidance on red/green test cycles and stubbing patterns in specs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d33de6b to
126feee
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
126feee to
9afb55e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9afb55e to
bfdf474
Compare
Treat Homebrew-owned conflicts from related formula families as implied `link_overwrite` paths when linking versioned or -full formulae. This restores the version-switching behavior that regressed for cases like installing `node@22` after uninstalling `node` left `npm` files behind in the prefix. While we're here, add some `AGENTS.md` changes based on feedback. References Homebrew/homebrew-core#271139
bfdf474 to
19a79a7
Compare
Treat Homebrew-owned conflicts from related formula families as implied
link_overwritepaths when linking versioned or -full formulae.This restores the version-switching behavior that regressed for cases like installing
node@22after uninstallingnodeleftnpmfiles behind in the prefix.While we're here, add some
AGENTS.mdchanges based on feedback.Follow-up from #21684
References Homebrew/homebrew-core#271139
brew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex with ~4-5 manual review passes and editing.