Skip to content

Filter info JSON package types#22851

Merged
MikeMcQuaid merged 1 commit into
mainfrom
info-json-package-filter
Jun 22, 2026
Merged

Filter info JSON package types#22851
MikeMcQuaid merged 1 commit into
mainfrom
info-json-package-filter

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member

Fixes #22850

  • Respect package-type filters for brew info --json=v2 output.
  • Avoid loading casks for formula-only JSON inventory paths.
  • Cover installed and eval-all formula-only JSON regressions.

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

OpenAI Codex 5.5 xhigh with local review, testing and tweaking.


Copilot AI review requested due to automatic review settings June 22, 2026 15:48

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

Updates brew info’s --json=v2 output to properly honor --formula/--cask filtering, preventing cask enumeration (and related side effects) when formula-only JSON is requested.

Changes:

  • Respect --formula/--cask filters for --json=v2 in both --installed and eval_all JSON inventory paths.
  • Avoid calling cask inventory/eval-all enumerators when --formula is set for v2 JSON.
  • Add tests covering formula-only JSON for installed and eval-all paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/cmd/info.rb Skips formula/cask enumeration in v2 JSON based on --formula/--cask flags, fixing incorrect cask inclusion.
Library/Homebrew/test/cmd/info_spec.rb Adds regression tests ensuring casks are excluded (and not enumerated) for formula-only v2 JSON output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/test/cmd/info_spec.rb Outdated
- Respect package-type filters for `brew info --json=v2` output.
- Avoid loading casks for formula-only JSON inventory paths.
- Cover installed and eval-all formula-only JSON regressions.
@MikeMcQuaid MikeMcQuaid force-pushed the info-json-package-filter branch from 06aea11 to cbd398f Compare June 22, 2026 16:31
@MikeMcQuaid MikeMcQuaid enabled auto-merge June 22, 2026 16:36
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit d4efefd Jun 22, 2026
41 checks passed
@MikeMcQuaid MikeMcQuaid deleted the info-json-package-filter branch June 22, 2026 17:09
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 info --json=v2 --installed --formula returns casks

3 participants