Skip to content

upgrade: print the fetch heading before prefetching - #23640

Merged
p-linnane merged 1 commit into
mainfrom
cask-upgrade-early-heading
Aug 25, 2026
Merged

upgrade: print the fetch heading before prefetching#23640
p-linnane merged 1 commit into
mainfrom
cask-upgrade-early-heading

Conversation

@bevanjkay

Copy link
Copy Markdown
Member

Alternative to #23638.

  • Print the ==> Fetching downloads for: heading immediately after the upgrade prompt, using the names the ask preview has already worked out, so confirming with y prints something straight away rather than after the prefetch that currently supplies them.
  • Extract the print_heading logic to a method so we can call it from the other site.
  • Skip the heading in fetch when it has already been printed, leaving the non-ask path and its Fetching dependency downloads fallback unchanged.
  • Two drawbacks with this implentation: the heading now names what the preview planned, so a package filtered out during prefetch can be named in a heading it isn't fetched under, and ==> Downloading bottle manifests now outputs under the heading rather than preceding it.

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

I used claude-code with Opus 5, to implement the change.

Copilot AI lite review requested due to automatic review settings August 24, 2026 14:42

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

Thanks, much nicer!

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 adjusts brew upgrade’s interactive (ask) flow to print the “Fetching downloads for:” heading immediately after the user confirms the prompt, rather than waiting until after prefetch has determined download names. It does this by extracting heading printing into Homebrew::DownloadQueue and reusing it earlier in the upgrade command.

Changes:

  • Add Homebrew::DownloadQueue#print_heading and reuse it from DownloadQueue#fetch.
  • In brew upgrade, print the combined fetch heading before prefetching when running the shared download queue path.
  • Update/extend upgrade command specs to account for the new print_heading call and assert ordering.

Reviewed changes

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

File Description
Library/Homebrew/cmd/upgrade.rb Prints the combined “Fetching downloads for:” heading earlier in the interactive upgrade path and avoids re-printing it later.
Library/Homebrew/download_queue.rb Extracts heading emission into print_heading and reuses it in fetch.
Library/Homebrew/test/cmd/upgrade_spec.rb Updates DownloadQueue doubles for the new API and adds a spec asserting heading-before-prefetch behavior.

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

Comment thread Library/Homebrew/cmd/upgrade.rb
@p-linnane
p-linnane added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit b56087c Aug 25, 2026
48 checks passed
@p-linnane
p-linnane deleted the cask-upgrade-early-heading branch August 25, 2026 00: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.

5 participants