🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

generate-zap: load casks via named args and skip unreadable dirs#22821

Merged
MikeMcQuaid merged 1 commit into
mainfrom
generate-zap-named-args
Jun 20, 2026
Merged

generate-zap: load casks via named args and skip unreadable dirs#22821
MikeMcQuaid merged 1 commit into
mainfrom
generate-zap-named-args

Conversation

@p-linnane

Copy link
Copy Markdown
Member

Resolve the cask through args.named.to_casks instead of calling Cask::CaskLoader.load directly. The shared named-args loader path defaults to warn: false, so generate-zap no longer reprints a tap migration/rename warning on every run the way the direct call did (it inherited the loader's warn: true default), and it picks up the standard cask resolution and error handling for free.


  • 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 Hyperfine benchmarks.
  • 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?

  • AI was used to generate or assist with generating this PR.

Claude Code (Opus 4.8) investigated the issue, made the change, and wrote the
tests; I verified with brew lgtm and by re-running brew generate-zap before
and after.


Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copilot AI review requested due to automatic review settings June 20, 2026 00:31

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.

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 run to args.named.to_casks.fetch(0), picking up the shared loader defaults (including warn: false) and standard error handling.
  • Refactor resolve_patterns_from_cask to accept a Cask::Cask object and use cask.token for the fallback path.
  • Add each_readable_child helper to ignore EACCES/EPERM while 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.

@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!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jun 20, 2026
Merged via the queue into main with commit 116e96f Jun 20, 2026
43 checks passed
@MikeMcQuaid MikeMcQuaid deleted the generate-zap-named-args branch June 20, 2026 09:29
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.

3 participants