Skip to content

Fix issue with missing ruby_soruce_checksum in CaskStruct#21653

Merged
MikeMcQuaid merged 1 commit into
mainfrom
fix-ruby-source-checksum-issue
Mar 2, 2026
Merged

Fix issue with missing ruby_soruce_checksum in CaskStruct#21653
MikeMcQuaid merged 1 commit into
mainfrom
fix-ruby-source-checksum-issue

Conversation

@Rylan12

@Rylan12 Rylan12 commented Mar 2, 2026

Copy link
Copy Markdown
Member

Fixes #21652

I think what happened in the issue is an old installed cask didn't have ruby_source_checksum, and so the type verification in CaskStruct didn't work. I've checked, and I believe it's fine to have this field be nilable, so let's fallback to a blank { sha256: nil } for cases where this value isn't available.

Copilot AI review requested due to automatic review settings March 2, 2026 15:31
@MikeMcQuaid
MikeMcQuaid enabled auto-merge March 2, 2026 15:31

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

Adjusts Homebrew’s cask API struct handling to tolerate older/installed cask JSON that may not include ruby_source_checksum, preventing Sorbet runtime type-validation failures when loading such data.

Changes:

  • Make Homebrew::API::CaskStruct.ruby_source_checksum accept nil values and provide a default { sha256: nil }.
  • In the cask struct generator, omit nil checksum entries via .compact when building ruby_source_checksum.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Library/Homebrew/api/cask_struct.rb Makes ruby_source_checksum nilable and adds a default to support older/missing API data.
Library/Homebrew/api/cask/cask_struct_generator.rb Compacts the generated ruby_source_checksum hash so missing sha256 does not propagate as a nil entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/api/cask_struct.rb
Comment thread Library/Homebrew/api/cask/cask_struct_generator.rb
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Mar 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 2, 2026
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit 62c59fa Mar 2, 2026
42 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the fix-ruby-source-checksum-issue branch March 2, 2026 16:48
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.

Can't set Homebrew::API::CaskStruct.ruby_source_checksum to {sha256: nil} (instance of Hash)

3 participants