Skip to content

Improve cleanup ask output#22416

Open
MikeMcQuaid wants to merge 1 commit into
mainfrom
cleanup-ask-dry-run-output
Open

Improve cleanup ask output#22416
MikeMcQuaid wants to merge 1 commit into
mainfrom
cleanup-ask-dry-run-output

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented May 25, 2026

  • Avoid noisy command previews during brew upgrade --ask.
  • Share one dry-run cleanup heading across formulae.
  • Get upgrade cleanup output from one named dry run.
  • Reuse bundle cleanup output formatting for consistency.
  • Avoid shelling out for bundle cleanup dry runs.
  • Reuse Cleanup#cleanup_formula so dry runs show removals.
  • Skip empty cleanup headings when there is no work.

  • 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? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • 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.

OpenAI Codex 5.5 xhigh with local review and testing.


Copilot AI review requested due to automatic review settings May 25, 2026 20:07
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 refines how cleanup “dry-run” output is produced and displayed during upgrade planning (brew upgrade --ask) and brew bundle cleanup, aiming to reduce noisy/duplicated headings and make formatting consistent by reusing cleanup logic in-process.

Changes:

  • Adjust Homebrew::Upgrade.upgrade_formulae to avoid per-formula install-cleanup previews during dry runs and instead print a single aggregated dry-run cleanup section.
  • Add Homebrew::Cleanup.dry_run_output and printed_dry_run_output? helpers to capture and print dry-run cleanup output consistently.
  • Update brew bundle cleanup to reuse Cleanup dry-run output formatting (and avoid shelling out for dry-run cleanup), with corresponding spec updates.

Reviewed changes

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

Show a summary per file
File Description
Library/Homebrew/upgrade.rb Prints one aggregated dry-run cleanup section after a dry-run upgrade pass.
Library/Homebrew/cleanup.rb Adds helpers to capture cleanup dry-run output and print standardized headings.
Library/Homebrew/bundle/subcommand/cleanup.rb Uses Cleanup helpers for dry-run cleanup output instead of shelling out.
Library/Homebrew/test/cmd/upgrade_spec.rb Adds coverage ensuring dry-run cleanup output is sourced from a single named run.
Library/Homebrew/test/cmd/bundle/cleanup_subcommand_spec.rb Updates expectations to reflect in-process cleanup dry-run output formatting.

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

Comment thread Library/Homebrew/upgrade.rb
Comment thread Library/Homebrew/bundle/subcommand/cleanup.rb
- Avoid noisy command previews during `brew upgrade --ask`.
- Share one dry-run cleanup heading across formulae.
- Get upgrade cleanup output from one formula-only dry run.
- Reuse bundle cleanup output formatting for consistency.
- Avoid shelling out for bundle cleanup dry runs.
- Reuse `Cleanup#cleanup_formula` so dry runs show removals.
- Skip empty cleanup headings when there is no work.
@MikeMcQuaid MikeMcQuaid force-pushed the cleanup-ask-dry-run-output branch from 258e1dc to 5f2fa12 Compare May 26, 2026 07:54
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