Skip to content

cask: gate auto-updates behind opt-in#21985

Merged
MikeMcQuaid merged 1 commit intomainfrom
fix_more_cask_auto_update_problems
Apr 11, 2026
Merged

cask: gate auto-updates behind opt-in#21985
MikeMcQuaid merged 1 commit intomainfrom
fix_more_cask_auto_update_problems

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

  • switch auto_updates true upgrades to HOMEBREW_UPGRADE_AUTO_UPDATES_CASKS so users keep the current behavior until Homebrew 5.2.0
  • keep hidden HOMEBREW_NO_UPGRADE_AUTO_UPDATES_CASKS support for developer overrides and reject conflicting env settings early in brew upgrade
  • ignore bad bundle versions such as 0.0 so broken Info.plist metadata does not trigger false upgrades

Fixes #21981


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Used OpenAI Codex with local editing, testing and review.


Copilot AI review requested due to automatic review settings April 10, 2026 15:25
@MikeMcQuaid MikeMcQuaid enabled auto-merge April 10, 2026 15:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 changes Homebrew Cask’s upgrade behavior so auto_updates true casks are only auto-upgraded when users explicitly opt in (or when running as a developer), while also hardening version-detection to avoid false upgrade prompts from broken app bundle metadata.

Changes:

  • Introduces HOMEBREW_UPGRADE_AUTO_UPDATES_CASKS (opt-in) and keeps HOMEBREW_NO_UPGRADE_AUTO_UPDATES_CASKS as a hidden override, with early conflict validation.
  • Updates cask outdated detection to ignore known-bad bundle versions (e.g., 0.0) when evaluating auto-updating apps.
  • Updates manpage/docs and adds/adjusts unit tests around the new env behavior and bundle-version edge case.

Reviewed changes

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

Show a summary per file
File Description
manpages/brew.1 Documents the new opt-in env var and removes the old env var from the public manpage.
Library/Homebrew/test/env_config_spec.rb Adds tests for the new upgrade_auto_updates_casks? env logic and conflict handling.
Library/Homebrew/test/cask/upgrade_spec.rb Stubs new env gate in tests; adds a regression test for conflicting env vars raising in brew upgrade.
Library/Homebrew/test/cask/cask_spec.rb Adds regression coverage for ignoring a bad bundle version (0.0) when short version is missing.
Library/Homebrew/manpages.rb Hides env vars marked hidden: from generated env var docs.
Library/Homebrew/env_config.rb Adds the new env var, hides the old one, and implements upgrade_auto_updates_casks?.
Library/Homebrew/cask/upgrade.rb Forces early evaluation of env var conflict to error consistently before cask selection.
Library/Homebrew/cask/cask.rb Gates auto-updates upgrades behind the new opt-in and ignores bad bundle versions in bundle metadata comparisons.
docs/Manpage.md Reflects public env var docs changes (new opt-in var; old hidden var removed).
docs/FAQ.md Updates FAQ guidance to mention the new opt-in env var and planned default change in 5.2.0.

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

@MikeMcQuaid MikeMcQuaid force-pushed the fix_more_cask_auto_update_problems branch from 852c8be to 69330ae Compare April 10, 2026 19:38
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Apr 10, 2026
@MikeMcQuaid MikeMcQuaid force-pushed the fix_more_cask_auto_update_problems branch from 69330ae to 1b15b29 Compare April 11, 2026 06:47
@MikeMcQuaid MikeMcQuaid enabled auto-merge April 11, 2026 07:02
- switch `auto_updates true` upgrades to
  `HOMEBREW_UPGRADE_AUTO_UPDATES_CASKS` so users keep the
  current behavior until Homebrew 5.2.0
- keep hidden `HOMEBREW_NO_UPGRADE_AUTO_UPDATES_CASKS`
  support for developer overrides, reject conflicting env
  settings early in `brew upgrade`, and keep
  `HOMEBREW_DEVELOPER` boolean parsing consistent
- ignore bad bundle versions such as `0.0` so broken
  `Info.plist` metadata does not trigger false upgrades
- skip hidden env vars cleanly when generating manpages so
  undocumented entries cannot affect formatting
@MikeMcQuaid MikeMcQuaid force-pushed the fix_more_cask_auto_update_problems branch from 1b15b29 to 8f059a0 Compare April 11, 2026 07:09
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 11, 2026
HASH_KEYS_TO_SKIP = T.let(%w[outdated installed versions].freeze, T::Array[String])
private_constant :HASH_KEYS_TO_SKIP

AUTO_UPDATES_BAD_BUNDLE_VERSIONS = %w[0.0].freeze
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.

I think we should expand this to knock out versions from installed_short_version, but I'm happy to take a look at this in a follow up PR with some other additional logic (probably on Monday).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@bevanjkay Aye sounds good. Less pressing now it's not applying to everyone any more.

Merged via the queue into main with commit e847d58 Apr 11, 2026
39 checks passed
@MikeMcQuaid MikeMcQuaid deleted the fix_more_cask_auto_update_problems branch April 11, 2026 07:43
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.

new auto-updates cask behavior: android-studio and osu version not recognized

4 participants