Skip to content

Stop inferring cask OS support from artifact types - #23513

Merged
p-linnane merged 1 commit into
mainfrom
cask-no-artifact-os-inference
Aug 13, 2026
Merged

Stop inferring cask OS support from artifact types#23513
p-linnane merged 1 commit into
mainfrom
cask-no-artifact-os-inference

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

Cask operating system support is now determined solely by explicit depends_on declarations. Artifact types no longer imply a platform, so app no longer means macOS-only and app_image no longer means Linux-only. This follows up on review feedback in #23503, where the artifact tables acted as a second source of platform truth alongside depends_on.

Cask::Artifact::MACOS_ONLY_ARTIFACTS, LINUX_ONLY_ARTIFACTS and Cask#artifacts_supported_on_os? are gone, and the installer checks use supports_linux? and supports_macos? directly. The macOS prepend became identical to the shared implementation, so it is deleted. supported_platforms still filters on download completeness, installable artifact presence, architecture and macOS version, so casks that scope their artifacts with on_macos or on_linux are unaffected.

Homebrew/OSDependsOn is now solely responsible for requiring OS dependencies on OS-specific artifact stanzas, so it also detects artifacts inside on_arm, on_intel and on_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 sibling on_macos or on_linux block, an on_system block, 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.


  • 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 change and pass with it, and ran brew lgtm --online plus targeted specs.


Copilot AI lite review requested due to automatic review settings August 13, 2026 19:20

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

Nice thanks!

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

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 the Cask::Artifact::*_ONLY_ARTIFACTS constants, and stops filtering supported_platforms based on artifact types.
  • Updates installer OS checks to use supports_macos?/supports_linux? directly and drops the now-redundant macOS installer prepend.
  • Expands Homebrew/OSDependsOn RuboCop cop coverage to detect OS-specific artifacts inside on_arm/on_intel/on_system blocks 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.

Comment thread docs/Cask-Cookbook.md Outdated
Signed-off-by: Patrick Linnane <patrick@linnane.io>
@p-linnane
p-linnane force-pushed the cask-no-artifact-os-inference branch from 1aadedd to fa4f922 Compare August 13, 2026 19:57
@p-linnane
p-linnane enabled auto-merge August 13, 2026 19:57
@p-linnane
p-linnane added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 6cf9b12 Aug 13, 2026
45 checks passed
@p-linnane
p-linnane deleted the cask-no-artifact-os-inference branch August 13, 2026 20:44
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