Skip to content

Skip untrusted cleanup formulae#22553

Merged
MikeMcQuaid merged 1 commit into
mainfrom
trust-fixes
Jun 5, 2026
Merged

Skip untrusted cleanup formulae#22553
MikeMcQuaid merged 1 commit into
mainfrom
trust-fixes

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

Fixes #22551

  • Avoid aborting brew cleanup when cache checks cannot load an installed formula from an untrusted tap.
  • Warn that the tap formula is not trusted so users know why cleanup skipped that formula's cache eligibility check.

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


- Avoid aborting `brew cleanup` when cache checks cannot load an
  installed formula from an untrusted tap.
- Warn that the tap formula is not trusted so users know why cleanup
  skipped that formula's cache eligibility check.
Copilot AI review requested due to automatic review settings June 5, 2026 16:54
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 pull request adjusts brew cleanup cache staleness checks to avoid aborting when an installed formula can’t be loaded due to tap trust restrictions, and adds test coverage for that scenario.

Changes:

  • Rescue Homebrew::UntrustedTapError during cache staleness checks so brew cleanup can continue.
  • Emit a warning when an untrusted tap formula prevents determining cache eligibility.
  • Add an RSpec example asserting untrusted-formula cache entries are skipped and not removed.

Reviewed changes

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

File Description
Library/Homebrew/cleanup.rb Skip cache staleness evaluation when loading an installed formula raises UntrustedTapError, warning instead of aborting.
Library/Homebrew/test/cleanup_spec.rb Adds a regression test ensuring untrusted formula loading doesn’t remove the cache entry and warns to stderr.

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

Comment thread Library/Homebrew/cleanup.rb
Comment thread Library/Homebrew/cleanup.rb
@github-code-quality
Copy link
Copy Markdown

github-code-quality Bot commented Jun 5, 2026

Code Coverage Overview

Languages: Ruby

Ruby / code-coverage/simplecov

The overall coverage in the branch remains at 78%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File c6a08de 08c9669 +/-
services/system/systemctl.rb 93% 87% -6%
utils/tty.rb 92% 91% -1%
download_queue.rb 74% 73% -1%
cleanup.rb 83% 83% 0%
dev-cmd/formula-analytics.rb 17% 18% +1%
bundle/subcommand.rb 94% 96% +2%
manpages.rb 50% 54% +4%
services/system.rb 81% 85% +4%
services/cli.rb 62% 69% +7%
extend/pathname.rb 75% 82% +7%

Updated June 05, 2026 17:12 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@MikeMcQuaid MikeMcQuaid enabled auto-merge June 5, 2026 18:17
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jun 5, 2026
Merged via the queue into main with commit c11c6cd Jun 5, 2026
40 checks passed
@MikeMcQuaid MikeMcQuaid deleted the trust-fixes branch June 5, 2026 20:07
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.

Usability improvements when trusting at the formula rather than tap level

3 participants