Skip to content

Migrate formula callers to explicit source APIs - #24439

Merged
MikeMcQuaid merged 1 commit into
mainfrom
migrate-formula-source-loads
Nov 3, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
migrate-formula-source-loads

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Select formula paths and bottles explicitly in builds, tests, postinstalls, audits and bottle workflows.
  • Pass the selected formula to argument parsing so source-build options no longer depend on implicit path loading.
  • Migrate the corresponding fixtures and mocks while preserving existing default lookup behaviour for the final stack change.

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

Codex with GPT 6 Astra at High effort, with local review and testing.


@MikeMcQuaid
MikeMcQuaid added this pull request to stack #24440 November 2, 2026 08:52
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bcebc3c1-415b-4e2e-ac8f-5b0458bdac1f
Commits

Reviewing files that changed from the base of the PR and between 554e6fd and 31986b7.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved formula and bottle selection during installation, builds, fetching and upgrades, including support for explicitly requested local bottles.
    • Improved handling of formulas loaded from files, taps and installed packages across Homebrew commands.
    • Fixed cases where commands could select a different formula with the same name than the one specified, including when merging bottle metadata or running post-install steps.
    • Improved formula-specific option handling when invoking commands for a selected formula.

The changes pass selected formulas through command setup and use dedicated loaders for formula paths, bottles and installed formulae. They update formula loading across build, install, audit and developer workflows. Tests cover the corresponding loading methods and formula-source selection.

Changes: Formula loading

Layer / File(s) Summary
Pass selected formulas through command entry points
Library/Homebrew/abstract_command.rb, Library/Homebrew/cli/parser.rb, Library/Homebrew/cmd/deps.rb, Library/Homebrew/cmd/upgrade.rb, Library/Homebrew/build.rb, Library/Homebrew/postinstall.rb, Library/Homebrew/test.rb, Library/Homebrew/cmd/install.rb, Library/Homebrew/cli/named_args.rb, Library/Homebrew/formula_installer.rb, Library/Homebrew/test/build_path_loading_spec.rb, Library/Homebrew/test/formula_installer_spec.rb, Library/Homebrew/test/cmd/install_spec.rb
Command setup accepts or resolves a formula and passes it to the parser or command. Build, postinstall and test entry points resolve formulas from command-line arguments. Install argument conversion uses method: :bottle, with tests covering formula options and bottle resolution.
Use dedicated formula loaders
Library/Homebrew/api/formula.rb, Library/Homebrew/bottle_transition.rb, Library/Homebrew/cmd/{--cache.rb,fetch.rb}, Library/Homebrew/formula.rb, Library/Homebrew/formula_info.rb, Library/Homebrew/keg_relocate.rb, Library/Homebrew/test/{bottle_transition_spec.rb,cmd/*,deprecate_disable_spec.rb,formula_creator_spec.rb,formula_info_spec.rb,formula_spec.rb,formulary_spec.rb,trust_spec.rb,livecheck/skip_conditions_spec.rb}
Runtime callers use dedicated loading methods for formula paths, bottles, tap paths and keg formulae in the listed cases. Formula lookup declares a name parameter. Tests use the corresponding loaders and cover name-based lookup.
Update developer formula workflows
Library/Homebrew/dev-cmd/{advisory-match.rb,audit.rb,bottle.rb,bump-formula-pr.rb,bump-python-resources-pr.rb,bump.rb,livecheck.rb,pr-upload.rb}, Library/Homebrew/formula_auditor.rb, Library/Homebrew/test/dev-cmd/*, Library/Homebrew/test/formula_auditor_spec.rb
Developer workflows load formulas from paths in the listed cases. Tests update loader calls and cover auditing, bottle merging and upload validation with recorded formula sources.
Merge Risk: Moderate · previous review 554e6

This change moves formula loading to explicit path, bottle and installed-formula APIs. Several earlier concerns are still open and no evidence shows them fixed: post-install name handling, quadratic tap file scans, audit reload of installed formulae, and name-based bottle merge and upload checks. Resolve or explicitly accept these before merging.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title 'Migrate formula callers to explicit source APIs' matches the main change. The changeset moves many call sites from Formulary.factory to explicit loaders such as Formulary.from_path, from_bo…
Description check Passed The description states the purpose of the change. It says the PR selects formula paths and bottles explicitly in builds, tests, postinstalls, audits and bottle workflows. It also says the selected for…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title 'Migrate formula callers to explicit source APIs' matches the main change. The changeset moves many call sites from Formulary.factory to explicit loaders such as Formulary.from_path, from_bottle, from_tap_path and from_keg. It also passes the selected formula into CLI parsing. The title is specific enough for a teammate to understand the primary change.

Full details: Description check

Explanation

The description states the purpose of the change. It says the PR selects formula paths and bottles explicitly in builds, tests, postinstalls, audits and bottle workflows. It also says the selected formula is passed to argument parsing and that fixtures and mocks are migrated. This matches the raw summary and the PR objectives.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 696fefe5-7f11-4d31-a767-ac3bcef98925
Commits

Reviewing files that changed from the base of the PR and between d89a64e and 554e6fd.

Files selected for processing: 5
  • Library/Homebrew/build.rb
  • Library/Homebrew/keg_relocate.rb
  • Library/Homebrew/test.rb
  • Library/Homebrew/test/dev-cmd/audit_spec.rb
  • Library/Homebrew/test/formula_creator_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment thread Library/Homebrew/dev-cmd/audit.rb Resolved
Comment thread Library/Homebrew/dev-cmd/audit.rb Resolved
Comment thread Library/Homebrew/dev-cmd/bottle.rb Resolved
Comment thread Library/Homebrew/dev-cmd/pr-upload.rb Resolved
Comment thread Library/Homebrew/postinstall.rb Resolved
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch 2 times, most recently from 0268037 to 10c45bc Compare November 2, 2026 14:56
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch from 10c45bc to 50df8ce Compare November 2, 2026 15:22
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch from 50df8ce to a7b68a7 Compare November 2, 2026 15:56
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch from a7b68a7 to b152bc2 Compare November 2, 2026 16:49
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch from b152bc2 to 1a6f4fa Compare November 2, 2026 18:55
Base automatically changed from package-loader-apis to main November 3, 2026 09:26
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch 2 times, most recently from d89a64e to 554e6fd Compare November 3, 2026 10:29
- Select source files explicitly in builds, audits and bottle workflows.
- Preserve the source recorded in bottle JSON when merging or uploading,
  including local sources sharing a core formula name.
- Parse local bottle options explicitly during installation and bypass
  cask name lookup for selected bottles.
- Pass selected formulae to argument parsing and mark API names passed
  to post-install children so declarative steps still run.
- Reuse selected audit sources, including installed recipes, without
  repeatedly scanning registered tap paths.
- Keep tap audit fixtures valid under the current zap requirements.
@MikeMcQuaid
MikeMcQuaid force-pushed the migrate-formula-source-loads branch from 554e6fd to 31986b7 Compare November 3, 2026 11:00
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 2d2c69e Nov 3, 2026
55 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the migrate-formula-source-loads branch November 3, 2026 11:48
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

⌂ 换网址