Skip to content

Fix stale cask upgrade metadata#22986

Merged
MikeMcQuaid merged 1 commit into
mainfrom
fix-cask-upgrade-installed-version
Jul 6, 2026
Merged

Fix stale cask upgrade metadata#22986
MikeMcQuaid merged 1 commit into
mainfrom
fix-cask-upgrade-installed-version

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Prefer the installed metadata path version over a stale tab when loading saved JSON cask metadata.
  • This lets upgrades recover from receipts left behind by earlier successful cask upgrades.
  • Add a regression covering two consecutive local-caffeine upgrades.

Closes #22983 with a different/simpler approach.


  • 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?

  • AI was used to generate or assist with generating this PR.

OpenAI Codex 5.5 xhigh with local review and testing.


- Prefer the installed metadata path version over a stale tab when
  loading saved JSON cask metadata.
- This lets upgrades recover from receipts left behind by earlier
  successful cask upgrades.
- Add a regression covering two consecutive `local-caffeine` upgrades.

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 PR fixes an edge case in cask upgrades where the “installed version” can be incorrectly inferred from a stale INSTALL_RECEIPT.json (tab), causing subsequent upgrades to reference the wrong on-disk version directory and fail. The change makes installed-caskfile loading prefer the version encoded in the installed metadata path, and adds a regression test covering two consecutive upgrades.

Changes:

  • Prefer the installed metadata path version (.../.metadata/<version>/...) over the tab’s stored version when loading from an installed caskfile JSON.
  • Add a regression spec that installs an outdated cask, upgrades it, then upgrades it again to ensure installed version tracking stays correct.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/cask/cask_loader.rb Adjusts version resolution precedence when loading from an installed caskfile JSON to avoid stale tab versions.
Library/Homebrew/test/cask/upgrade_spec.rb Adds a regression test validating two consecutive upgrades use the correct installed metadata version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid enabled auto-merge July 6, 2026 16:20
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jul 6, 2026
Merged via the queue into main with commit 42ee8b5 Jul 6, 2026
43 checks passed
@MikeMcQuaid MikeMcQuaid deleted the fix-cask-upgrade-installed-version branch July 6, 2026 16:57
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