Skip to content

Store cask metadata as JSON more often#22952

Merged
MikeMcQuaid merged 1 commit into
mainfrom
cask-json-caskroom-metadata
Jul 5, 2026
Merged

Store cask metadata as JSON more often#22952
MikeMcQuaid merged 1 commit into
mainfrom
cask-json-caskroom-metadata

Conversation

@MikeMcQuaid

@MikeMcQuaid MikeMcQuaid commented Jul 4, 2026

Copy link
Copy Markdown
Member
  • 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.

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • AI was used to generate or assist with generating this PR.

OpenAI Codex 5.5 xhigh with local review and testing.


@MikeMcQuaid MikeMcQuaid force-pushed the cask-json-caskroom-metadata branch from ca74a9c to d5411a9 Compare July 5, 2026 08:33
- 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.
@MikeMcQuaid MikeMcQuaid force-pushed the cask-json-caskroom-metadata branch from d5411a9 to 9da6c48 Compare July 5, 2026 12:38
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review July 5, 2026 13:01
Copilot AI review requested due to automatic review settings July 5, 2026 13:01
@MikeMcQuaid MikeMcQuaid changed the title Store cask metadata as JSON Store cask metadata as JSON more often Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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>.json for most casks, falling back to <token>.rb when 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.

Comment thread Library/Homebrew/cask/cask_loader.rb
Comment thread Library/Homebrew/cask/cask.rb

@p-linnane p-linnane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love this.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jul 5, 2026
Merged via the queue into main with commit d327c8f Jul 5, 2026
44 checks passed
@MikeMcQuaid MikeMcQuaid deleted the cask-json-caskroom-metadata branch July 5, 2026 18:00
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