fix: fall back to stable deps when head_dependencies is absent#21762
Merged
MikeMcQuaid merged 5 commits intoHomebrew:mainfrom Mar 19, 2026
Merged
fix: fall back to stable deps when head_dependencies is absent#21762MikeMcQuaid merged 5 commits intoHomebrew:mainfrom
MikeMcQuaid merged 5 commits intoHomebrew:mainfrom
Conversation
3 tasks
MikeMcQuaid
approved these changes
Mar 19, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Makes sense, thanks @costajohnt!
MikeMcQuaid
reviewed
Mar 19, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
@costajohnt Looks like a legit test failure here.
Rylan12
approved these changes
Mar 19, 2026
Member
Rylan12
left a comment
There was a problem hiding this comment.
This looks good once CI is good, thanks!
One suggestion: can we add a comment here? The correctness of this change was not obvious to me (although I've verified that it is correct), so this comment will help clarify why this is needed
Member
|
Note to self: this should also fix the same issue with |
When `dependencies_hash` generates the API JSON, it omits `head_dependencies` when they equal stable deps (to save space). `FormulaStructGenerator` treated this absence as "no dependencies," breaking HEAD installs that inherit stable dependencies. Fall back to the stable dependency hash when `head_dependencies` is nil. Fixes Homebrew#21760
Include urls.stable.url in the test hash so generate_formula_struct_hash can build a valid stable_url_args tuple for Sorbet. Accept Rylan12's suggestion to add a comment explaining the head_dependencies fallback.
auto-merge was automatically disabled
March 19, 2026 15:58
Head branch was pushed to by a user without write access
161afc6 to
5273745
Compare
FormulaStruct requires desc, homepage, license, ruby_source_checksum, and stable_version (via versions.stable). Without these, from_hash raises a Sorbet ArgumentError for missing required props.
generate_formula_struct_hash calls dig("ruby_source_checksum", "sha256")
which expects the value to be a hash, not a plain string.
generate_formula_struct_hash works on a dup'd copy of the input, so the original hash is never modified. Check the returned struct's head_dependencies and stable_dependencies accessors instead.
50bc8e6 to
6e52208
Compare
MikeMcQuaid
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew lgtm(style, typechecking and tests) with your changes locally?What does this PR do?
When
Formula#dependencies_hashgenerates the API JSON, it intentionally omitshead_dependencieswhen they're identical to stable deps (to save space).FormulaStructGenerator#generate_formula_struct_hashtreated this absence as "no dependencies," passingniltoprocess_dependencies_and_requirementswhich returned empty arrays. This broke HEAD installs for any formula that inherits stable dependencies.The fix falls back to
stable_dependency_hashwhenhash["head_dependencies"]is nil, restoring the correct behavior where HEAD inherits stable deps unless explicitly overridden.Fixes #21760