Skip to content

generate-zap: resolve apps from package receipts - #23623

Open
loganrosen wants to merge 2 commits into
Homebrew:mainfrom
loganrosen:loganrosen-generate-zap-pkg-apps
Open

generate-zap: resolve apps from package receipts#23623
loganrosen wants to merge 2 commits into
Homebrew:mainfrom
loganrosen:loganrosen-generate-zap-pkg-apps

Conversation

@loganrosen

Copy link
Copy Markdown
Contributor

  • 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.

GitHub Copilot CLI using GPT-5.6 Sol helped investigate the issue, implement the change, and write tests. I reviewed the resulting diff, tested it against Cloudflare WARP, Google Drive, and Zoom package receipts, and ran brew lgtm --online.


brew generate-zap resolves search patterns from an app artifact's name and bundle identifier. Casks installed through a pkg artifact do not expose an app artifact, even when the package installs an application. The command therefore falls back to the title-cased token and can incorrectly report that no zap stanza is required.

For example:

$ brew install --cask cloudflare-warp
$ open "/Applications/Cloudflare WARP.app"
$ brew generate-zap cloudflare-warp
Warning: No files found matching "Cloudflare Warp".
# No zap stanza required

This change uses pkgutil directives from uninstall and zap artifacts to find installed package receipts. It derives top-level application bundles from each receipt, excluding nested helper apps and stale receipt paths, then scans using their application names and bundle identifiers. The existing token-derived pattern remains as a fallback so broader matches such as Zoom updater files are preserved.

Package receipts are the local source of truth for package-installed applications and avoid downloading or expanding installers. This lets package-based casks use the same bundle-aware zap generation as casks with explicit app artifacts.

Copilot AI lite review requested due to automatic review settings August 22, 2026 23:39

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

Enhances the brew generate-zap dev command to better derive scan patterns for package-installed casks by using local package receipts to discover installed .app bundles and their bundle identifiers, while preserving the existing token-derived fallback behavior.

Changes:

  • Derive scan patterns from .app bundles discovered via pkgutil receipts when no app artifact exists.
  • Add helpers to extract top-level app bundle paths from receipt BOM entries and read bundle identifiers from Info.plist.
  • Add/adjust specs to cover receipt-based resolution and stale receipt handling, and update bundle_identifiers to accept Pathname.
Show a summary per file
File Description
Library/Homebrew/dev-cmd/generate-zap.rb Adds receipt-based app discovery and pattern derivation for generate-zap.
Library/Homebrew/test/dev-cmd/generate-zap_spec.rb Adds tests for package receipt resolution and updates bundle identifier tests to use Pathname.

Review details

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread Library/Homebrew/dev-cmd/generate-zap.rb
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.

2 participants