Store cask metadata as JSON more often#22952
Merged
Merged
Conversation
ca74a9c to
d5411a9
Compare
- Use a minimal post-install snapshot for supported casks. - Read receipt-owned version and artifacts from `INSTALL_RECEIPT.json`. - Leave uninstall flight block caskfiles as Ruby until ported.
d5411a9 to
9da6c48
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR shifts Homebrew Cask “installed caskfile” metadata toward a minimal, post-install JSON snapshot for more casks, relying on INSTALL_RECEIPT.json for receipt-owned data (e.g., version and uninstall artifacts) while keeping Ruby metadata for casks that still require uninstall flight blocks.
Changes:
- Write installed cask metadata as
<token>.jsonfor most casks, falling back to<token>.rbwhen uninstall flight blocks are present. - Load installed casks via
load_from_installed_caskfile, and hydrate missing receipt-owned fields when loading from installed JSON. - Update and add tests to reflect the new installed-metadata behavior and edge cases.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/cmd/upgrade_spec.rb | Adjusts expectations and fixtures to reflect installed cask metadata moving to .json. |
| Library/Homebrew/test/cmd/uninstall_spec.rb | Updates trust/untrusted-tap uninstall coverage for JSON-installed metadata and Ruby fallbacks. |
| Library/Homebrew/test/cmd/doctor_spec.rb | Mirrors upgrade/doctor expectations for .json installed metadata. |
| Library/Homebrew/test/cask/upgrade_spec.rb | Switches stubbing to load_from_installed_caskfile for installed-metadata error paths. |
| Library/Homebrew/test/cask/installer_spec.rb | Adds coverage for JSON-installed metadata shape, only_path preservation, and Ruby fallback for uninstall flight blocks. |
| Library/Homebrew/json_api_postinstall_preflight_postflight_plan.md | Documents the intended installed metadata format and migration direction. |
| Library/Homebrew/cask/upgrade.rb | Uses load_from_installed_caskfile and simplifies invalid-installed-metadata handling. |
| Library/Homebrew/cask/installer.rb | Changes installed-metadata writing logic: Ruby only for uninstall flight blocks, otherwise minimal JSON. |
| Library/Homebrew/cask/caskroom.rb | Reorders preferred installed caskfile extensions to prefer .json. |
| Library/Homebrew/cask/cask.rb | Adds to_installed_json_hash to generate the minimal installed JSON snapshot. |
| Library/Homebrew/cask/cask_loader.rb | Permits empty JSON only for installed caskfiles and hydrates version/artifacts when loading installed JSON. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
INSTALL_RECEIPT.json.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?OpenAI Codex 5.5 xhigh with local review and testing.