Combine dependency role tags from API metadata #24302

Merged
p-linnane opened 6:33am on October 20, 2026 wanted to merge 77 Δ into homebrew/brew main from
api-dependency-tag-union

Pull Request Overview

  • Opened on October 20, 2026
  • Status Merged
  • Commit count 1 with first commit October 18, 2026

Total Delta

77 Total Diff Delta

Open Days

Open 16 weekdays

Test Delta

22 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.8 days Authoring 1 commit before pull request opened for review
 
0.2 days Awaiting first review
Set up deploy tracking to begin tracking full PR start-to-deploy times

Total time for pull request 1.0 business day from first commit authored to merge
Deploy tracking has not been set up

Author avatar

Combine dependency role tags from API metadata

Formulae loaded from the API split a dependency with more than one role, such as depends_on "foo" => [:build, :test], into separate :build and :test dependencies, while loading the formula's Ruby source keeps one Dependency with both tags. FormulaStructGenerator.process_dependencies now unions each name's role tags in a fixed order (:build, :test, :recommended, :optional, then :no_linkage) so API-loaded formulae get the same dependencies as source-loaded ones; separate :build and :test declarations of one name also load as one combined dependency. Runtime entries stay separate, so a formula that depends on gettext and also declares it :build keeps it in both dependencies and build_dependencies from Formula#to_hash. The round-trip examples now cover a runtime dependency with combined tags, compare the Formula#to_hash dependency lists and stub the API metadata Formula#to_hash reads so they run offline. Brew versions before 7.0.10 (#24262) reject array-valued tags in the internal API when HOMEBREW_SORBET_RUNTIME is set.



  • [x] Have you followed our Contributing guidelines?

  • [x] Have you checked for other open Pull Requests for the same change?

  • [x] Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.

  • [x] 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?

  • [x] Have you written new tests (excluding integration tests)? Here's an example.

  • [x] Have you successfully run brew lgtm (style, typechecking and tests) locally?



  • [x] 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 (GPT-6 Astra) wrote the change and tests, compared source and API-loaded dependencies across homebrew/core for all 16 OS/arch tags, checked the new examples fail before the change on host and --generic and ran brew lgtm --online. Claude Code (Opus 5.5) reviewed it, found that an earlier version dropped runtime dependencies from the Formula#to_hash role lists, reran the comparison on the final version for the formulae whose output could change, checked the new examples fail on the previous code offline on host and --generic, rebased onto current main and ran brew lgtm --online on this commit.


Summary by CodeRabbit



  • Bug Fixes


    • Improved dependency metadata handling to remove duplicate entries and preserve all applicable dependency types.

    • Dependencies can now retain multiple tags, including build, test, recommended, optional, runtime and no-linkage classifications.

    • Dependency metadata round-trips now more reliably preserve these classifications and their ordering.



Comments Threads Pending Resolution

MikeMcQuaid reviewed and approved this work on October 20, 2026
MikeMcQuaid left a comment

Thanks!

Resolved Comment Threads

No resolved comments have been left on this PR.