Fix issue with missing ruby_soruce_checksum in CaskStruct#21653
Merged
Conversation
MikeMcQuaid
approved these changes
Mar 2, 2026
MikeMcQuaid
enabled auto-merge
March 2, 2026 15:31
Contributor
There was a problem hiding this comment.
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_checksumaccept nil values and provide a default{ sha256: nil }. - In the cask struct generator, omit nil checksum entries via
.compactwhen buildingruby_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.
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Mar 2, 2026
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.
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 inCaskStructdidn'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.