Skip to content

cask/upgrade: fail on named casks that cannot be upgraded - #24512

Merged
carlocab merged 2 commits into
mainfrom
cask-upgrade-fail-named-broken
Nov 6, 2026
Merged

carlocab merged 2 commits into
mainfrom
cask-upgrade-fail-named-broken

Conversation

@carlocab

@carlocab carlocab commented Nov 6, 2026 •

Copy link
Copy Markdown
Member
  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Opus 5.5 prepared all the changes. I reviewed and tested the change locally.


brew upgrade --cask <name> skips a named cask whose installed metadata can't be loaded, warns, and exits 0, so scripts that upgrade specific casks can't tell nothing was upgraded. Unattended upgrades are also now harder to monitor.

This makes that skip an ofail when the cask was named, matching named pinned casks. #21962 changed it from odie to opoo so one broken cask no longer aborts a plain brew upgrade; that is unchanged, and the remaining casks are still upgraded.

Explicitly named casks that cannot be upgraded as-is are skipped with a
warning and exit 0, so callers cannot tell the upgrade didn't happen.
Fail instead, as for named pinned casks; unnamed upgrades still warn.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • During cask upgrades, an unupgradable cask explicitly named in the request now reports the reinstall instruction as an error and marks the upgrade as failed. For casks included in the upgrade without being explicitly named, the instruction remains a warning and does not mark the upgrade as failed. Skipped casks remain skipped.

When an installed cask cannot be loaded, the upgrade path reports a failure if the cask was explicitly supplied. Otherwise, it reports a warning. Tests verify both outcomes and check that skipping an unreadable cask file does not mark Homebrew as failed.

Changes: Cask upgrade reporting

Layer / File(s) Summary
Unavailable cask reporting and tests
Library/Homebrew/cask/upgrade.rb, Library/Homebrew/test/cask/upgrade_spec.rb
The unavailable-cask message uses ofail for explicitly supplied casks and opoo otherwise. Tests check failure status for explicitly supplied casks, warning behaviour for unnamed casks, and failure status after skipping an unreadable cask file.
Merge Risk: Minimal · up to 4f63b

Named failures are reported through the command’s failure status, while unnamed prefetched casks remain warnings. No merge-blocking issue is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes the change to fail when a named cask cannot be upgraded.
Description check Passed The description explains the failure for named casks and the preserved warning for unnamed casks.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2032dd94-7595-49ad-a43c-dd50cc305e2e
Commits

Reviewing files that changed from the base of the PR and between 2b0e877 and 4f63b22.

Files selected for processing: 2

  • Library/Homebrew/cask/upgrade.rb
  • Library/Homebrew/test/cask/upgrade_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c6dc28ec-ecbb-4772-858f-083c532e7e22
Commits

Reviewing files that changed from the base of the PR and between f101d88 and 2b0e877.

Files selected for processing: 2

  • Library/Homebrew/cask/upgrade.rb
  • Library/Homebrew/test/cask/upgrade_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread Library/Homebrew/cask/upgrade.rb Resolved
`brew upgrade` passes its prefetched outdated casks to
`upgrade_casks!` without naming them, so a non-empty list doesn't mean
the user asked for those casks.
@carlocab
carlocab added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 6677b10 Nov 6, 2026
55 checks passed
@carlocab
carlocab deleted the cask-upgrade-fail-named-broken branch November 6, 2026 18:08

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

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.

3 participants

⌂ 换网址