Skip to content

Add explicit package source loading APIs - #24438

Merged
MikeMcQuaid merged 1 commit into
mainfrom
package-loader-apis
Nov 3, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
package-loader-apis

Conversation

@MikeMcQuaid

@MikeMcQuaid MikeMcQuaid commented Nov 2, 2026 •

Copy link
Copy Markdown
Member
  • Add private path, tap-path, bottle and content entry points so Homebrew/brew callers can choose their source explicitly.
  • Keep explicit bottle loading independent of the implicit path policy.
  • Share source resolution without changing the existing default loader selection or path policy.
  • Share package-name matching across loaders, bundle, services and compiler shims, rejecting commas and preserving capture groups.
  • Reuse shared tap and package patterns for bundle normalisation.
  • Sort cached tap file lists once before binary-searching them and avoid reading unrelated tap lists for symlinked checkouts.
  • Cover registered tap paths, symlinked CI checkouts and explicit source loading before migrating callers.

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

No actionable comments were generated in the recent review.

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: 46fd19c8-0baf-4e88-9bbd-4b0e759bc985
Commits

Reviewing files that changed from the base of the PR and between a2c7e05 and 0726d8c.

Files selected for processing: 6
  • Library/Homebrew/bundle/dsl.rb
  • Library/Homebrew/tap.rb
  • Library/Homebrew/tap_constants.rb
  • Library/Homebrew/test/bundle/dsl_spec.rb
  • Library/Homebrew/test/package_loader_api_spec.rb
  • Library/Homebrew/utils/path.rb

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

Summary

Summary by CodeRabbit

  • New Features
    • Formulae and casks can be loaded from selected local files or supplied content. Local bottles and registered tap files can also be selected directly.
  • Bug Fixes
    • Invalid package names and unregistered tap paths are rejected, including names with unsupported characters or invalid path components.
    • Formula loading preserves relevant installed-version details when resolving a selected source.
    • URL handling no longer attempts to read a caller path that is not a file.
    • Service and package-path matching now applies consistent package-name validation.
  • Tests
    • Added coverage for selected files and content, registered tap paths, bottles, invalid paths and package names.

Formula and cask loaders now support explicit source paths, registered tap paths, and selected inputs. Formula resolution applies installed-spec state to formulas loaded by path or name. Cask content loading validates its evaluated result. Shared package-name rules govern package references and matching across several Homebrew components.

Changes: Package loading and name validation

Layer / File(s) Summary
Shared package-name rules
Library/Homebrew/package_constants.rb, Library/Homebrew/tap_constants.rb, Library/Homebrew/utils/path.rb, Library/Homebrew/bundle/dsl.rb, Library/Homebrew/linkage_checker.rb, Library/Homebrew/requirement.rb, Library/Homebrew/services/*, Library/Homebrew/shims/super/cc, related specs
A shared package-name pattern and package-reference validation are added. Package matching in tap constants, Bundle, linkage, requirements, services, and the compiler shim uses the shared pattern. Tests cover invalid package names and service labels.
Registered tap path resolution
Library/Homebrew/utils/path.rb, Library/Homebrew/tap.rb, Library/Homebrew/test/package_loader_api_spec.rb
Tap path lookup identifies registered formula or cask source files, including paths within symlinked checkouts. Formula and cask file lists are sorted. Specs cover unregistered paths, registered audit files, and symlinked checkouts.
Formula source and bottle loading
Library/Homebrew/formulary.rb, Library/Homebrew/test/package_loader_api_spec.rb
Formulary adds selected-path, tap-path, and bottle loading. Resolution applies installed-spec state to formulas loaded by path or name. Specs cover explicit formula paths and bottle loading.
Cask source and content loading
Library/Homebrew/cask/cask_loader.rb, Library/Homebrew/cask/url.rb, Library/Homebrew/test/package_loader_api_spec.rb
CaskLoader adds selected-path, tap-path, content, and name-based loading. Content evaluation checks for a Cask result. URL handling checks that the caller path is a file before reading it.
Merge Risk: Minimal · up to 0726d

The identified loading regressions are resolved, and no actionable merge-blocking risk remains.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding explicit package source loading APIs.
Description check Passed The description explains the new source entry points, intended behaviour, test coverage, and validation performed. It is directly related to the changeset.
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.

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

@MikeMcQuaid
MikeMcQuaid force-pushed the package-loader-apis branch 2 times, most recently from 8adf5dd to 6e6aa11 Compare November 2, 2026 15:22
Comment thread Library/Homebrew/formulary.rb Resolved
@MikeMcQuaid
MikeMcQuaid force-pushed the package-loader-apis branch 2 times, most recently from 7ed4b44 to a2c7e05 Compare November 2, 2026 16:49
Comment thread Library/Homebrew/utils/path.rb Resolved
- Add private path, tap-path, bottle and content entry points so
  Homebrew/brew callers can choose their source explicitly.
- Keep explicit bottle loading independent of the implicit path policy.
- Share source resolution without changing the existing default
  loader selection or path policy.
- Share package-name matching across loaders, bundle, services and
  compiler shims, rejecting commas and preserving capture groups.
- Reuse shared tap and package patterns for bundle normalisation.
- Sort cached tap file lists once before binary-searching them and
  avoid reading unrelated tap lists for symlinked checkouts.
- Cover registered tap paths, symlinked CI checkouts and explicit
  source loading before migrating callers.
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 0e2c9bf Nov 3, 2026
53 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the package-loader-apis branch November 3, 2026 09:26
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

⌂ 换网址