Skip to content

Conversation

@Rylan12
Copy link
Member

@Rylan12 Rylan12 commented Oct 27, 2025

This PR contains a handful of improvements to installations with HOMEBREW_USE_INTERNAL_API to help reduce unnecessary downloads of formula JSON files.

A note: I started working on this before #20940, and there were some conflicts, so I'm not sure they play nicely together yet.

@Rylan12 Rylan12 force-pushed the use-internal-api-improvements branch 2 times, most recently from b190a96 to f428d23 Compare October 29, 2025 14:18
@Rylan12
Copy link
Member Author

Rylan12 commented Oct 29, 2025

I named the helper Formulary.factory_stub, but I'm happy to go with stubbary if you'd like!

@Rylan12 Rylan12 marked this pull request as ready for review October 29, 2025 14:24
Copilot AI review requested due to automatic review settings October 29, 2025 14:24
Copy link
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 refactors formula loading calls by introducing and using a new Formulary.factory_stub method as a cleaner API for requesting stubbed formula instances. The change replaces scattered calls to Formulary.factory(..., prefer_stub: true) with the more explicit Formulary.factory_stub(...) method.

Key changes:

  • Added Formulary.factory_stub method as a shortcut for calling factory with prefer_stub: true
  • Updated all call sites to use the new method instead of passing the prefer_stub parameter
  • Replaced some Formula[name] calls with Formulary.factory_stub(name) where only stub data is needed

Reviewed Changes

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

Show a summary per file
File Description
Library/Homebrew/formulary.rb Added new factory_stub method with documentation and updated resolve to use it
Library/Homebrew/style.rb Updated shellcheck, shfmt, and actionlint methods to use factory_stub
Library/Homebrew/extend/pathname.rb Updated which_install_info to use factory_stub for texinfo formula
Library/Homebrew/extend/os/mac/pkgconf.rb Updated macos_sdk_mismatch to use factory_stub for pkgconf formula
Library/Homebrew/extend/kernel.rb Updated ensure_executable! to use factory_stub
Library/Homebrew/cli/parser.rb Updated formulae method to use factory_stub
Library/Homebrew/cli/named_args.rb Updated load_formula_or_cask to use factory_stub
Library/Homebrew/attestation.rb Updated sort_formulae_for_install to check formula names instead of using Formula["gh"]

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

@Rylan12 Rylan12 force-pushed the use-internal-api-improvements branch from f428d23 to f3a83f7 Compare October 29, 2025 17:16
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MikeMcQuaid MikeMcQuaid enabled auto-merge October 30, 2025 10:21
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Oct 30, 2025
Merged via the queue into main with commit 515a526 Oct 30, 2025
38 checks passed
@MikeMcQuaid MikeMcQuaid deleted the use-internal-api-improvements branch October 30, 2025 14:15
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