uninstall: make resilient to individual failures#21617
Merged
MikeMcQuaid merged 2 commits intoHomebrew:mainfrom Feb 24, 2026
Merged
uninstall: make resilient to individual failures#21617MikeMcQuaid merged 2 commits intoHomebrew:mainfrom
MikeMcQuaid merged 2 commits intoHomebrew:mainfrom
Conversation
When running `brew uninstall A B C` where one item is unavailable, the entire command halted before uninstalling anything. Now errors for unavailable items are collected and reported at the end while valid items are still uninstalled. - Use `to_formulae_and_casks_and_unavailable` for name resolution so unavailable items are captured as values instead of raising - Add `NoSuchKegError` to the rescue clause in `to_formulae_and_casks_and_unavailable` - Collect per-cask exceptions in `Cask::Uninstall.uninstall_casks` following the pattern from `Cask::Upgrade.upgrade_casks!` - Apply same per-cask error collection to the zap loop - Report unavailable errors via `ofail` after all uninstall work completes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
I have similar changes to |
MikeMcQuaid
approved these changes
Feb 24, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Looks great, thanks again @koddsson!
Member
One more combined PR sounds good! |
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 #21615 which made cask error handling more resilient across commands. This PR extends that work specifically for
brew uninstallto handle the case where one or more named arguments are unavailable:brew uninstall A B Cwhere one item (e.g. B) doesn't exist, the command previously halted before uninstalling anything. Now valid items are still uninstalled and errors are reported at the end.to_formulae_and_casks_and_unavailablefor name resolution so unavailable items are captured as values instead of raisingNoSuchKegErrorto the rescue clause into_formulae_and_casks_and_unavailableCask::Uninstall.uninstall_casksfollowing the pattern fromCask::Upgrade.upgrade_casks!so one failing cask doesn't prevent uninstalling the rest--zaploop--forcecontinues to silently ignore unavailable items (existing behavior)Test plan
brew typecheckpassesbrew style --fix --changedpassesbrew tests --only=cmd/uninstallpassesbrew tests --only=cask/uninstallpasses🤖 Generated with Claude Code