Skip to content

install, reinstall, upgrade: show the same plan details - #24661

Merged
HaraldNordgren merged 6 commits into
mainfrom
install-dry-run-source-builds
Nov 18, 2026
Merged

HaraldNordgren merged 6 commits into
mainfrom
install-dry-run-source-builds

Conversation

@HaraldNordgren

@HaraldNordgren HaraldNordgren commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

brew install, brew reinstall and brew upgrade each print a plan before they ask to go ahead and with --dry-run, but they built it in separate code and showed different details. Only brew upgrade listed bottle download sizes and the formulae that would build from source.

This moves the bottle size and source build helpers from the upgrade command into Install and uses them for every plan, so all three commands show the same details, both with --dry-run and before the prompt. The source build list now covers dependencies in every plan, using the same install_bottle_for? check as dependency expansion. It also drops the unused compute_total_sizes and collect_dependencies helpers.

brew upgrade now records its plan and decides whether to prompt after dependencies are computed, so a formula with unsatisfied requirements fails on its own instead of aborting the whole plan.

$ brew install --dry-run wireshark iso-codes
==> Would install 2 formulae:
wireshark  4.6.9
iso-codes  4.20.1  (8.3MB)
==> Would install 6 dependencies for wireshark:
c-ares        1.34.9
libgpg-error  1.61
libgcrypt     1.12.4
libmaxminddb  1.14.1
libsmi        0.5.0
speexdsp      1.2.1
==> 6 homebrew/core formulae that would build from source
wireshark
c-ares
libgpg-error
libgcrypt
libmaxminddb
libsmi

$ brew upgrade --dry-run git pycparser
==> Would upgrade 2 requested outdated packages
git        2.56.0_2 -> 2.56.1
pycparser  3.1_1    -> 3.12    (78.8KB)
==> 1 homebrew/core formula that would build from source
git

  • 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; every commit has a human author or co-author and I will answer maintainer questions and review comments myself without AI/LLM.

Claude Code (Fable 5.2) made the code and test changes from my instructions. It also ran the checks on my machine: brew lgtm, then brew style, brew typecheck and the install, reinstall and upgrade specs after a later fix, plus read-only --dry-run runs against my installed formulae. I reviewed the diff and tried the plans with my own brew.


@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Summary

Summary by CodeRabbit

  • New Features
    • Dry-run installation and upgrade plans show the count and names of formulae expected to build from source, including eligible dependencies.
    • Plans distinguish bottled formulae from source builds and show download sizes for formulae that will be installed from bottles.
    • Upgrade summaries provide clearer details about bottle downloads and source builds.
  • Bug Fixes
    • Dry-run upgrade summaries remain available when dependency checks encounter an error, which is also reported in the output.

Install and upgrade dry-run plans report bottle sizes where available and identify eligible formulae that will build from source. Upgrade summaries are recorded after upgrade calls, including when dependency computation reports an UnsatisfiedRequirements error.

Changes: Formula install and upgrade plans

Layer / File(s) Summary
Install plan reporting
Library/Homebrew/install.rb, Library/Homebrew/test/cmd/install_spec.rb, Library/Homebrew/test/install_spec.rb
Install dry runs use installer data to report bottle sizes and list eligible homebrew/core formulae that will build from source. Tests cover bottled and source-built formulae and dependencies.
Upgrade summary reporting
Library/Homebrew/upgrade.rb, Library/Homebrew/cmd/upgrade.rb, Library/Homebrew/test/cmd/upgrade_spec.rb
Upgrade version changes accept an optional size. Upgrade summaries use shared bottle-size and source-build helpers and are recorded after upgrade calls. Tests cover dry-run plans and dependency-computation errors.
Merge Risk: Low · up to c093b

The change makes install, reinstall and upgrade plans show the same details. The main residual concern is whether an upgrade preview with an unsatisfied formula could still abort the whole plan. The change appears to address it, but it deserves a quick confirmation before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the three commands it changes (install, reinstall, upgrade) and the change they share (showing the same plan details). The changeset moves bottle-size and source-build reporting into I…
Description check Passed The description explains the motivation, the moved helpers, the new source-build list covering dependencies, the removed unused helpers, and the upgrade prompt-timing change. It also includes example …
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.
Full details: Title check

Explanation

The title names the three commands it changes (install, reinstall, upgrade) and the change they share (showing the same plan details). The changeset moves bottle-size and source-build reporting into Install and uses it for all three plans, so the title covers the main change.

Full details: Description check

Explanation

The description explains the motivation, the moved helpers, the new source-build list covering dependencies, the removed unused helpers, and the upgrade prompt-timing change. It also includes example output and testing notes, all of which match the changeset.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Major · Run the prompt requirement check after the isolated upgrade pass. · install.rb:653

Library/Homebrew/install.rb:653
Major · Stability & Availability · Quick win

Run the prompt requirement check after the isolated upgrade pass.

With brew upgrade --dry-run foo bar, the prompt requirement check calls compute_dependencies on foo before Upgrade.upgrade_formulae isolates any failure. If foo has an unsatisfied fatal requirement, compute_dependencies raises UnsatisfiedRequirements. No rescue in cmd/upgrade.rb covers this call, so the command stops before bar is processed and before the dry-run summary is recorded.

The PR goal is that an unsatisfied formula fails on its own without aborting the plan. Move the prompt requirement check after Upgrade.upgrade_formulae, and base it on the installers that upgrade successfully. Keep dependency-based prompting for formulae that succeed.

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: 90b5c09a-a382-48ae-9976-f7ec4da937d4
Commits

Reviewing files that changed from the base of the PR and between b43c73f and bf45204.

Files selected for processing: 6

  • Library/Homebrew/cmd/upgrade.rb
  • Library/Homebrew/install.rb
  • Library/Homebrew/test/cmd/install_spec.rb
  • Library/Homebrew/test/cmd/upgrade_spec.rb
  • Library/Homebrew/test/install_spec.rb
  • Library/Homebrew/upgrade.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.

@HaraldNordgren HaraldNordgren changed the title install: show bottle sizes and source builds install, reinstall, upgrade: show the same plan details Nov 17, 2026

@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.

Great idea, seems like a big net improvement. Dropped a few comments, please address before merging but can self-merge after.

Comment thread Library/Homebrew/install.rb Resolved
Comment thread Library/Homebrew/install.rb Resolved
- `brew install` and `brew reinstall` ask before a plan that only lists
  names and versions, so nothing says which formulae pour a bottle and
  which build from source. `brew upgrade` already shows both.
- Move the bottle size and source build helpers from the `upgrade`
  command into `Install` so all three plans print the same details.
- List dependencies in the source build section too, as they make up
  most of an install plan.
- Record the `upgrade` dry-run summary after its dependencies are
  computed, so a formula with unsatisfied requirements still only
  fails on its own.
- Drop the unused `compute_total_sizes` and `collect_dependencies`
  helpers to keep `Install` within the module length limit.
- A named `brew upgrade --dry-run` decided whether to prompt by
  computing dependencies before the per-formula error handling, so a
  formula with an unsatisfied requirement aborted the whole plan.
- Decide after the dry-run pass, from the formulae that got through,
  so that formula fails on its own like it does without names.
- `fi` is opaque, so spell it out in the dry-run plan and
  `source_build_formulae`.
- `--only-dependencies` and `--ignore-dependencies` conflict, so pick
  the formulae to check in one conditional.
@HaraldNordgren
HaraldNordgren force-pushed the install-dry-run-source-builds branch from dd336ce to 10b949a Compare November 18, 2026 09:21

@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: 3

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: 3fd87f54-fbe9-42bf-98a9-832dadddea9d
Commits

Reviewing files that changed from the base of the PR and between dd336ce and 10b949a.

Files selected for processing: 1

  • Library/Homebrew/install.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/install.rb Resolved
Comment thread Library/Homebrew/install.rb Resolved
Comment thread Library/Homebrew/install.rb Resolved
- `brew install` and `brew reinstall` plans now look up bottle sizes,
  so a manifest download that fails, e.g. offline, stopped the whole
  plan. The installer itself already ignores these failures when it
  reads the manifest.
- Show the plan without the size instead. This also covers the
  existing `brew upgrade` size lookup.
- Installing a local bottle file downloads nothing, but the plan
  showed the size of the hosted bottle and fetched its manifest to
  get it. The installer already skips the manifest for local bottles.

@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.

Nitpick comments: 1

Library/Homebrew/test/install_spec.rb: 1

628-631: Trivial · Maintainability & Code Quality · Quick win

Assert that a local bottle skips the hosted bottle lookup.

The test checks that bottle_download_size returns nil. It would also pass if the helper fetched the hosted manifest and then discarded the size. Keep the nil assertion and replace the bottle stub with expect(formula).not_to receive(:bottle).

Based on learnings, “Formula classes created in specs may be frozen, so stub instances rather than class methods.”

Source: Learnings

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: 9cc00ba6-3df8-40fa-a63e-3b95ef900cc4
Commits

Reviewing files that changed from the base of the PR and between 10b949a and c093b0a.

Files selected for processing: 2

  • Library/Homebrew/install.rb
  • Library/Homebrew/test/install_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.

@HaraldNordgren
HaraldNordgren added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
@HaraldNordgren
HaraldNordgren added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 2595f4b Nov 18, 2026
55 checks passed
@HaraldNordgren
HaraldNordgren deleted the install-dry-run-source-builds branch November 18, 2026 11:47
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.

2 participants