api/formula/formula_struct_generator: defer placeholder replacement - #23780
Merged
Conversation
This method runs `FormulaStruct.from_hash` at the end which will call `::Formula.deep_remove_placeholders`. The latter detects if generating JSON so that placeholders are preserved until loaded by user.
MikeMcQuaid
enabled auto-merge
September 4, 2026 16:49
Contributor
There was a problem hiding this comment.
馃煝 Approval recommended
The delegated behavior matches FormulaStruct.from_hash semantics and is adequately tested.
Pull request overview
Defers placeholder replacement to FormulaStruct.from_hash, preserving placeholders during API JSON generation.
Changes:
- Removes eager caveat placeholder replacement.
- Adds coverage for recursive replacement and JSON-generation preservation.
- Consolidates generator tests around shared setup.
File summaries
| File | Description |
|---|---|
Library/Homebrew/api/formula/formula_struct_generator.rb |
Delegates placeholder handling to FormulaStruct. |
Library/Homebrew/test/api/formula/formula_struct_generator_spec.rb |
Tests placeholder behavior and refactors setup. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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.
This method runs
FormulaStruct.from_hashat the end which will call::Formula.deep_remove_placeholders. The latter detects if generating JSON so that placeholders are preserved until loaded by user.brew/Library/Homebrew/api/formula_struct.rb
Lines 12 to 13 in 8d49bd0
brew/Library/Homebrew/api_hashable.rb
Lines 29 to 30 in 8d49bd0
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?