dev-cmd/pr-pull: require cask/cask_loader - #23664
Merged
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a NameError in brew pr-pull for cask-related pull requests by ensuring the command file explicitly requires cask/cask_loader, so Cask::CaskLoader (and related cask constants used in the file) are always defined.
Changes:
- Add
require "cask/cask_loader"todev-cmd/pr-pullso cask-loading code paths work reliably. - Add a regression spec that loads
dev-cmd/pr-pullin a fresh Ruby process to catch missing requires that could be masked by prior test loads.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/dev-cmd/pr-pull.rb | Requires cask/cask_loader so cask constants used by brew pr-pull are available. |
| Library/Homebrew/test/dev-cmd/pr-pull_spec.rb | Adds a subprocess-based regression test to ensure dev-cmd/pr-pull loads cask support independently. |
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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 pr-pullcallsCask::CaskLoader.loadwhen working out which packages a pull request touches, but the file only requiredformula, so the constant was undefined and the command failed with aNameErroron cask pull requests. This was reported in https://github.com/orgs/Homebrew/discussions/7034.Requiring
cask/cask_loaderfixes it, and also covers theCask::Caskreferences further down the file. This is the same class of missing require as the recentcmd/depsandcmd/usesfixes. The new spec loadsdev-cmd/pr-pullin a fresh Ruby process so it actually catches the missing require instead of passing because another spec already loaded the cask code.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.