Stop inferring cask OS support from artifact types - #23513
Merged
Conversation
8 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes artifact-type-based inference of Cask OS support and makes OS support determination rely solely on explicit depends_on declarations, aligning installer behavior and API serialization with a single source of truth.
Changes:
- Removes
Cask::Cask#artifacts_supported_on_os?and theCask::Artifact::*_ONLY_ARTIFACTSconstants, and stops filteringsupported_platformsbased on artifact types. - Updates installer OS checks to use
supports_macos?/supports_linux?directly and drops the now-redundant macOS installer prepend. - Expands
Homebrew/OSDependsOnRuboCop cop coverage to detect OS-specific artifacts insideon_arm/on_intel/on_systemblocks and adds/updates specs accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/rubocops/os_depends_on_spec.rb | Adds coverage for OSDependsOn behavior with architecture and on_system blocks, including non-autocorrect cases for cross-platform intent. |
| Library/Homebrew/test/cask/cask_spec.rb | Updates supported platform expectations to ensure OS support is not inferred from artifact types, and adds explicit depends_on OS-only cases. |
| Library/Homebrew/rubocops/os_depends_on.rb | Refactors OSDependsOn to handle platform blocks and cross-platform intent detection while preserving autocorrect insertion ordering. |
| Library/Homebrew/extend/os/mac/cask/installer.rb | Removes macOS-specific installer prepend now that shared behavior is sufficient. |
| Library/Homebrew/extend/os/linux/cask/installer.rb | Simplifies Linux installer OS requirement check to rely on supports_linux?. |
| Library/Homebrew/extend/os/cask/installer.rb | Drops conditional require of the deleted macOS installer extension. |
| Library/Homebrew/cask/cask.rb | Removes artifact-based OS filtering and the artifacts_supported_on_os? method. |
| Library/Homebrew/cask/artifact/abstract_artifact.rb | Moves/keeps the module-level documentation for Cask::Artifact. |
| Library/Homebrew/cask/artifact.rb | Removes OS-only artifact constant tables that were previously used for inference. |
| docs/Cask-Cookbook.md | Updates documentation to describe OS support determination via depends_on (needs clarification per review comment). |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Patrick Linnane <patrick@linnane.io>
p-linnane
force-pushed
the
cask-no-artifact-os-inference
branch
from
August 13, 2026 19:57
1aadedd to
fa4f922
Compare
p-linnane
enabled auto-merge
August 13, 2026 19:57
8 tasks
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 operating system support is now determined solely by explicit
depends_ondeclarations. Artifact types no longer imply a platform, soappno longer means macOS-only andapp_imageno longer means Linux-only. This follows up on review feedback in #23503, where the artifact tables acted as a second source of platform truth alongsidedepends_on.Cask::Artifact::MACOS_ONLY_ARTIFACTS,LINUX_ONLY_ARTIFACTSandCask#artifacts_supported_on_os?are gone, and the installer checks usesupports_linux?andsupports_macos?directly. The macOS prepend became identical to the shared implementation, so it is deleted.supported_platformsstill filters on download completeness, installable artifact presence, architecture and macOS version, so casks that scope their artifacts withon_macosoron_linuxare unaffected.Homebrew/OSDependsOnis now solely responsible for requiring OS dependencies on OS-specific artifact stanzas, so it also detects artifacts insideon_arm,on_intelandon_system, which all run on both operating systems, and places autocorrected stanzas in the right group. Where a cask shows cross-platform intent, through a siblingon_macosoron_linuxblock, anon_systemblock, or artifacts for both operating systems, it reports the stanza without autocorrecting, since a bare dependency there would drop platform support or produce contradictory stanzas. Checked against all 7,695 casks in homebrew/homebrew-cask with no new offenses.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 change and pass with it, and ran
brew lgtm --onlineplus targeted specs.