Skip to content

Add supported_platforms to cask API data - #23503

Merged
MikeMcQuaid merged 2 commits into
mainfrom
cask-api-platform-support
Aug 12, 2026
Merged

Add supported_platforms to cask API data#23503
MikeMcQuaid merged 2 commits into
mainfrom
cask-api-platform-support

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

Cask variations became explicit for every valid OS and architecture tag in 233377e. formulae.brew.sh read the presence of Linux variations as evidence of Linux support, so macOS-only casks such as VSCodium advertised Linux. variations describes per-platform data overrides and has to keep entries for unsupported platforms, so support cannot be inferred from it.

This adds a top-level supported_platforms array listing every tag a cask can install on, emitted for every cask. It applies the rules the installer already enforces, including the artifact type rules that previously only existed in the extend/os prepends and so were invisible to API generation.

The audit rule requiring an installable artifact has been a no-op since cask.artifacts became a set of artifact objects rather than a symbol-keyed hash. It now checks properly, across valid tags. One cask in homebrew/cask was affected, fixed in Homebrew/homebrew-cask#280460; third-party casks with only uninstall and zap will start failing audit.

Adds roughly 1.68 MB raw to cask.jws.json, 9.8 KB gzipped.


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

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

Claude Code (Opus 5) drafted the implementation and tests; I reviewed the diff, verified the new tests fail without the fix and pass with it, and ran brew lgtm + targeted specs.


Signed-off-by: Patrick Linnane <patrick@linnane.io>
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copilot AI lite review requested due to automatic review settings August 12, 2026 05:30

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

Adds an explicit supported_platforms field to Cask API serialization so downstream consumers can determine installability per OS/arch without inferring support from variations, and centralises platform artifact support rules into the core Cask model.

Changes:

  • Emit a top-level supported_platforms array from Cask::Cask#to_hash_with_variations, applying installer/audit-equivalent eligibility rules per valid OS/arch tag.
  • Move OS-specific “artifact supported on this OS” logic into Cask::Cask#artifacts_supported_on_os? and reuse it from macOS/Linux installer checks.
  • Fix the required-stanzas audit to properly require an installable artifact (including across on_system-scoped casks) and add coverage for uninstall-only and Linux-only-installable cases.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Library/Homebrew/cask/cask.rb Adds installable_artifact?, artifacts_supported_on_os?, and supported_platforms emission with per-tag support filtering.
Library/Homebrew/cask/audit.rb Updates required-stanzas audit to validate presence of an installable artifact (including across tags for on_system casks).
Library/Homebrew/cask/installer.rb Reuses installable_artifact? when rejecting API-loaded casks that lack installable artifacts on the current system.
Library/Homebrew/extend/os/mac/cask/installer.rb Switches stanza OS requirement checks to use cask.artifacts_supported_on_os?(:macos).
Library/Homebrew/extend/os/linux/cask/installer.rb Switches stanza OS requirement checks to use cask.artifacts_supported_on_os?(:linux).
Library/Homebrew/test/cask/cask_spec.rb Adds unit coverage for artifacts_supported_on_os? and supported_platforms behaviour across OS/arch/tag scenarios.
Library/Homebrew/test/cask/audit_spec.rb Adds audit coverage for uninstall-only casks and casks installable only on Linux via on_linux.

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

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

Thanks!

Comment thread Library/Homebrew/cask/cask.rb
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit 0d7b47e Aug 12, 2026
54 of 55 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the cask-api-platform-support branch August 12, 2026 07:43
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