Add supported_platforms to cask API data - #23503
Merged
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Contributor
There was a problem hiding this comment.
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_platformsarray fromCask::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.
This was referenced Aug 12, 2026
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.
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.
variationsdescribes 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_platformsarray 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 theextend/osprepends and so were invisible to API generation.The audit rule requiring an installable artifact has been a no-op since
cask.artifactsbecame 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 onlyuninstallandzapwill start failing audit.Adds roughly 1.68 MB raw to
cask.jws.json, 9.8 KB gzipped.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?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.