generate-zap: load casks via named args and skip unreadable dirs#22821
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates brew generate-zap to resolve casks via the standard named-args loading path (instead of calling Cask::CaskLoader.load directly) and to make filesystem scanning more robust by skipping directories that can’t be read due to permissions.
Changes:
- Switch cask resolution in
runtoargs.named.to_casks.fetch(0), picking up the shared loader defaults (includingwarn: false) and standard error handling. - Refactor
resolve_patterns_from_caskto accept aCask::Caskobject and usecask.tokenfor the fallback path. - Add
each_readable_childhelper to ignoreEACCES/EPERMwhile scanning, with new unit tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/dev-cmd/generate-zap.rb | Uses named-args cask loading and adds permission-safe directory iteration for scanning. |
| Library/Homebrew/test/dev-cmd/generate-zap_spec.rb | Updates pattern-resolution tests to pass a cask object and adds coverage for unreadable-directory skipping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Resolve the cask through
args.named.to_casksinstead of callingCask::CaskLoader.loaddirectly. The shared named-args loader path defaults towarn: false, sogenerate-zapno longer reprints a tap migration/rename warning on every run the way the direct call did (it inherited the loader'swarn: truedefault), and it picks up the standard cask resolution and error handling for free.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Opus 4.8) investigated the issue, made the change, and wrote the
tests; I verified with
brew lgtmand by re-runningbrew generate-zapbeforeand after.