Skip to content

Avoid nil cask versions during installation - #23499

Merged
MikeMcQuaid merged 1 commit into
mainfrom
fix-cask-latest-nil
Aug 11, 2026
Merged

Avoid nil cask versions during installation#23499
MikeMcQuaid merged 1 commit into
mainfrom
fix-cask-latest-nil

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Platform-specific casks can have no version when evaluated on an unsupported operating system.
  • Let upgrade detection skip latest? in that case so installation reaches normal platform validation instead of raising NoMethodError.
  • Cover a macOS-only cask evaluated on Linux.

Fixes #23498


  • 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 Hyperfine benchmarks.
  • 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.

OpenAI Codex 5.6 Sol xhigh with local review and testing.


- Platform-specific casks can have no `version` when evaluated on an
  unsupported operating system.
- Let upgrade detection skip `latest?` in that case so installation
  reaches normal platform validation instead of raising `NoMethodError`.
- Cover a macOS-only cask evaluated on Linux.

Fixes #23498
Copilot AI lite review requested due to automatic review settings August 11, 2026 18:37
@MikeMcQuaid
MikeMcQuaid enabled auto-merge August 11, 2026 18:37

Copilot AI 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.

Pull request overview

This pull request fixes a crash in Homebrew鈥檚 cask upgrade-detection path during brew install --cask when a cask evaluates to having no version on the current OS (e.g., a macOS-only cask evaluated on Linux). It ensures installation proceeds to normal platform validation instead of raising a NoMethodError.

Changes:

  • Guarded latest? checks in Cask::Upgrade.outdated_casks when cask.version can be nil.
  • Added an RSpec regression test covering a macOS-only version stanza evaluated under Linux simulation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/cask/upgrade.rb Avoids calling latest? on a nil version during outdated-cask selection.
Library/Homebrew/test/cask/upgrade_spec.rb Adds coverage for the nil-version-on-unsupported-OS scenario.

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/cask/upgrade.rb
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit b94d9e9 Aug 11, 2026
68 of 69 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the fix-cask-latest-nil branch August 11, 2026 20:07
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.

undefined method 'latest?' for nil

3 participants