Skip to content

bump-cask-pr: load modified contents with FromContentLoader - #23738

Merged
p-linnane merged 1 commit into
mainfrom
bump-cask-pr-content-loader
Sep 2, 2026
Merged

bump-cask-pr: load modified contents with FromContentLoader#23738
p-linnane merged 1 commit into
mainfrom
bump-cask-pr-content-loader

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

brew bump --open-pr fails on any cask whose file begins with a comment, as reported in #23735. While recalculating checksums, bump-cask-pr reloads the modified cask source from a string via the generic Cask::CaskLoader.load. FromContentLoader.try_new only matches content whose first non-whitespace token is cask, so a leading comment makes it fall through to the remaining loaders and the tail of the source is misread as a cask token, producing Error: Cask 'texstudio.savedstate", ] end ' is unavailable.

Use Cask::CaskLoader::FromContentLoader explicitly at that boundary, matching the tmp_cask load a few lines above. That was the last string load in the command still going through the generic loader.


  • 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 brew benchmark results.
  • 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?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

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.


Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copilot AI balanced review requested due to automatic review settings September 1, 2026 23:48
@p-linnane p-linnane linked an issue Sep 1, 2026 that may be closed by this pull request
4 tasks

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.

馃煝 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.

@p-linnane
p-linnane enabled auto-merge September 1, 2026 23:57
@p-linnane
p-linnane added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit a48060f Sep 2, 2026
60 checks passed
@p-linnane
p-linnane deleted the bump-cask-pr-content-loader branch September 2, 2026 00:14

@MikeMcQuaid MikeMcQuaid 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.

Makes sense, thanks!

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.

brew bump --open-pr fails on casks with leading comment

4 participants