Skip to content

Make brew bundle honour the trusted: option - #22594

Merged
MikeMcQuaid merged 3 commits into
mainfrom
bundle-tap-trust
Jun 9, 2026
Merged

Make brew bundle honour the trusted: option#22594
MikeMcQuaid merged 3 commits into
mainfrom
bundle-tap-trust

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • trusted: true was parsed but ignored on install, so a formula or cask from an untrusted tap still failed to load mid-install
  • persist trust before the formula/cask is loaded so the in-process conflict check and the brew install subprocess both see it trusted
  • this completes the round-trip with brew bundle dump, which already emits trusted: true for trusted entries

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

Claude Code Opus 4.8 high with local review and testing.


Copilot AI review requested due to automatic review settings June 8, 2026 18:22
@MikeMcQuaid
MikeMcQuaid marked this pull request as draft June 8, 2026 18:25

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 makes brew bundle actually honor the trusted: true option for formulae and casks by persisting trust before any in-process operations (like conflict checks) or brew install subprocesses run, completing the intended dumpinstall round-trip.

Changes:

  • Persist formula trust earlier in Homebrew::Bundle::Brew installs when trusted: true is set.
  • Persist cask trust earlier in Homebrew::Bundle::Cask installs when trusted: true is set.
  • Add/extend specs to assert that trust is persisted before installation actions.

Reviewed changes

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

File Description
Library/Homebrew/bundle/brew.rb Adds trusted option handling for formula installs by calling Homebrew::Trust.trust! early.
Library/Homebrew/bundle/cask.rb Adds trusted option handling for cask installs by calling Homebrew::Trust.trust! early.
Library/Homebrew/test/bundle/brew_spec.rb Adds a spec asserting formulas are trusted before install flow proceeds.
Library/Homebrew/test/bundle/cask_spec.rb Adds a spec asserting casks are trusted before install flow proceeds.

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

Comment thread Library/Homebrew/bundle/brew.rb Outdated
Comment thread Library/Homebrew/bundle/cask.rb Outdated
Comment thread Library/Homebrew/test/bundle/brew_spec.rb
@MikeMcQuaid
MikeMcQuaid changed the base branch from main to tap-tweaks June 8, 2026 18:30
@github-code-quality

github-code-quality Bot commented Jun 8, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Ruby

Ruby / code-coverage/simplecov

The overall coverage in the bundle-tap-trust branch is 75%. The coverage in the main branch is 78%.

Show a code coverage summary of the most impacted files.
File main c6a08de bundle-tap-trust 9b3681b +/-
cask/info.rb 96% 0% -96%
cask/installer.rb 91% 28% -63%
cask/artifact/a...ct_uninstall.rb 89% 32% -57%
cask/audit.rb 63% 25% -38%
bundle/extensions/flatpak.rb 37% 94% +57%
extend/os/linux/diagnostic.rb 0% 68% +68%
extend/os/linux...cy_collector.rb 0% 79% +79%
os/linux/elf.rb 0% 86% +86%
extend/os/linux/sandbox.rb 0% 95% +95%
extend/os/linux...ystem_config.rb 0% 99% +99%

Updated June 08, 2026 20:18 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Base automatically changed from tap-tweaks to main June 8, 2026 19:43
- `trusted: true` was parsed but ignored on install, so a formula or
  cask from an untrusted tap still failed to load mid-install
- persist trust for the formula or cask before it is loaded so the
  in-process conflict check and the `brew install` subprocess see it
  trusted
- crucially, trust the formula before `tap.ensure_installed!`: tapping
  loads the formula and triggers the trust check, so trusting only
  afterwards left the very first `brew bundle` run failing
- this completes the round-trip with `brew bundle dump`, which already
  emits `trusted: true` for trusted entries
- the fully-qualified name check `count("/") == 2` was duplicated
  across `trust.rb`, `tap.rb` and `brew bundle`
- extract it next to `name_from_full_name`/`tap_from_full_name` and
  reuse it so the intent reads clearly at each call site
- the `brew bundle` integration test fetches real packages and
  `google-chrome` repeatedly flakes on Google's download server
- `firefox` is an equivalent browser cask served from a more
  reliable host
@MikeMcQuaid
MikeMcQuaid marked this pull request as ready for review June 9, 2026 07:34
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit da3c109 Jun 9, 2026
41 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the bundle-tap-trust branch June 9, 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.

3 participants