bump-cask-pr: load modified contents with FromContentLoader - #23738
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
bevanjkay
approved these changes
Sep 1, 2026
4 tasks
Contributor
There was a problem hiding this comment.
馃煝 Approval recommended
The targeted loader change is consistent with adjacent code and the regression test covers the failure path.
Pull request overview
Fixes checksum recalculation for casks whose source begins with a comment.
Changes:
- Explicitly loads modified source with
FromContentLoader. - Adds regression coverage for preserving leading comments while updating version and checksum.
File summaries
| File | Description |
|---|---|
Library/Homebrew/dev-cmd/bump-cask-pr.rb |
Corrects modified-content loading. |
Library/Homebrew/test/dev-cmd/bump-cask-pr_spec.rb |
Tests the reported failure case. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
8 tasks
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.
brew bump --open-prfails on any cask whose file begins with a comment, as reported in #23735. While recalculating checksums,bump-cask-prreloads the modified cask source from a string via the genericCask::CaskLoader.load.FromContentLoader.try_newonly matches content whose first non-whitespace token iscask, so a leading comment makes it fall through to the remaining loaders and the tail of the source is misread as a cask token, producingError: Cask 'texstudio.savedstate", ] end ' is unavailable.Use
Cask::CaskLoader::FromContentLoaderexplicitly at that boundary, matching thetmp_caskload a few lines above. That was the last string load in the command still going through the generic loader.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Opus 5) drafted the implementation and tests; I reviewed the diff, verified the new test fails without the fix and passes with it, and ran
brew lgtm+ targeted specs.