Skip to content

Conversation

@MikeMcQuaid
Copy link
Member

This should reduce the need to download formula stubs in the vast majority of cases.

CC @Rylan12 feel free to adjust, tweak, test and merge as needed!

This should reduce the need to download formula stubs in the vast
majority of cases.
Copilot AI review requested due to automatic review settings November 12, 2025 18:25
Copilot finished reviewing on behalf of MikeMcQuaid November 12, 2025 18:31
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 adds dependency information to Homebrew's internal formula API to reduce the need to download full formula definitions (stubs) in most cases. The changes include logic to determine which uses_from_macos dependencies should be included based on the macOS version of the bottle tag being processed.

Key Changes:

  • Extracts macOS version from bottle tags for version-aware dependency filtering
  • Adds logic to include conditional uses_from_macos dependencies based on the :since bounds
  • Modifies the formula stub array structure to include a 5th element (dependencies)
  • Adds an empty casks key to the formula internal API JSON structure

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

end
end

[name, [pkg_version.to_s, version_scheme, rebuild, sha256, dependencies.to_a]]
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The formula stub array structure is being changed from 4 elements [pkg_version, version_scheme, rebuild, sha256] to 5 elements by adding dependencies.to_a. However, the consumer code in api/internal.rb (line 127) expects a 4-element array as indicated by the type signature T::Hash[String, [String, Integer, Integer, T.nilable(String)]], and formula_stub method (lines 43-51) only accesses indices 0-3. This will break the expected API contract. The FormulaStub class and consumer code need to be updated to handle the dependencies field, or the type signature needs to be updated to reflect the new structure.

Suggested change
[name, [pkg_version.to_s, version_scheme, rebuild, sha256, dependencies.to_a]]
[name, [pkg_version.to_s, version_scheme, rebuild, sha256]]

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

This should be fine to do in a separate PR

@Homebrew Homebrew deleted a comment from Copilot AI Nov 13, 2025
Copy link
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

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

Thanks! I made some small changes, but feel free to merge if you think things look good

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 13, 2025
Merged via the queue into main with commit dcc7ac0 Nov 13, 2025
37 checks passed
@MikeMcQuaid MikeMcQuaid deleted the internal_api_dependencies branch November 13, 2025 09:55
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