Conversation
There was a problem hiding this comment.
Pull request overview
Enables loading/installing casks from the internal API when HOMEBREW_REALLY_USE_INTERNAL_API is set, mirroring the existing formula internal-API path and tracking whether a package was loaded from the internal API for small behavioral differences (e.g., messaging and gating some hash generation).
Changes:
- Add
loaded_from_internal_api?toFormulaandCaskand persistloaded_from_internal_apiinto install receipts/tabs. - Teach cask API loader and internal API cache to build
CaskStructobjects from the internal API (including caching tap git head). - Update tab/cask tab string output and expand test coverage + fixtures for the new receipt field.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/tab_spec.rb | Adds assertions/matcher and new Tab#to_s expectations for internal API installs. |
| Library/Homebrew/test/support/fixtures/receipt.json | Adds loaded_from_internal_api to receipt fixture. |
| Library/Homebrew/test/support/fixtures/cask_receipt.json | Adds loaded_from_internal_api to cask receipt fixture. |
| Library/Homebrew/test/formulary_spec.rb | Asserts formulae loaded from (public) API are not marked as internal. |
| Library/Homebrew/test/formula_spec.rb | Adds Formula#specified_path test for internal API path behavior. |
| Library/Homebrew/test/cask/tab_spec.rb | Updates cask tab serialization and string output expectations for internal API installs. |
| Library/Homebrew/test/cask/info_spec.rb | Adds brew info output coverage for an internally-loaded cask install receipt. |
| Library/Homebrew/test/cask/cask_spec.rb | Asserts casks loaded from (public) API are not marked as internal. |
| Library/Homebrew/test/cask/cask_loader/from_api_loader_spec.rb | Adds expectation for loaded_from_internal_api? == false in API loader spec. |
| Library/Homebrew/tab.rb | Persists and prints loaded_from_internal_api in tabs/receipts. |
| Library/Homebrew/sorbet/rbi/dsl/formula.rbi | Adds RBI for Formula#loaded_from_internal_api?. |
| Library/Homebrew/formulary.rb | Propagates an internal_api: flag into API-loaded formula classes. |
| Library/Homebrew/formula_installer.rb | Writes loaded_from_internal_api into the install tab during bottle pours. |
| Library/Homebrew/formula.rb | Adds loaded_from_internal_api?, adjusts specified_path, and gates to_hash_with_variations. |
| Library/Homebrew/cask/tab.rb | Persists and prints loaded_from_internal_api in cask tabs. |
| Library/Homebrew/cask/cask_loader.rb | Adds internal-API struct loading path and passes internal flag into cask instances. |
| Library/Homebrew/cask/cask.rb | Adds loaded_from_internal_api? and gates to_hash_with_variations. |
| Library/Homebrew/api/internal.rb | Adds internal cask struct caching and exposes internal cask tap git head. |
Files not reviewed (1)
- Library/Homebrew/sorbet/rbi/dsl/formula.rbi: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
10da407 to
e1ad0c3
Compare
|
Going to stop for the night, but the main to-do item is verifying that we can read the internal API JSON files in I haven't tested yet, but I believe this will cause issues with running Edit: uninstall doesn't seem to work at all right now, so that's something to work on |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Looks good when working!
Is the plan still that we will eventually merge the formula and cask files?
This PR primarily enables installing casks from the internal API via
HOMEBREW_REALLY_USE_INTERNAL_API. It's essentially the exact same implementation as for Formulae, and seems to work from preliminary local testing.In addition, I've added a new
#loaded_from_internal_api?method toFormulaandCaskthat gates some minor functionality differences between the internal and non-internal APIs.These two changes are somewhat coupled together, which is why I've done it in a single PR. I've split up the commits into a formula commit and a cask commit, which may make reviewing a bit easier. If it's still too much, I can spend more time getting them split up.