Skip to content

tapioca/compilers/cask/config: Generate accessors from DEFAULT_DIRS - #23661

Merged
MikeMcQuaid merged 1 commit into
mainfrom
tapioca-cask-config-default-dirs
Aug 26, 2026
Merged

tapioca/compilers/cask/config: Generate accessors from DEFAULT_DIRS#23661
MikeMcQuaid merged 1 commit into
mainfrom
tapioca-cask-config-default-dirs

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

On Linux OS::Linux::Cask::Config::ClassMethods overrides Cask::Config.defaults with a smaller hash, and the CaskConfig DSL compiler built its accessor list from it. Running brew typecheck --update on Linux therefore deleted input_methoddir and nine other accessors from sorbet/rbi/dsl/cask/config.rbi, and the brew typecheck that follows failed on three input_methoddir calls in test/cask/config_spec.rb. That breaks portable-ruby's integration path, which runs both in sequence.

Cask::Config defines its accessors from the base DEFAULT_DIRS plus languages, and that set is identical on every platform because the Linux override is prepended to the singleton class and does not affect Cask::Config::DEFAULT_DIRS. Generating from those two sources makes the committed RBI independent of which OS runs Tapioca. LINUX_ONLY_DIRS goes away, having been a no-op since appimagedir moved into the base DEFAULT_DIRS.

To reproduce, run brew typecheck --update then brew typecheck on Linux. In ghcr.io/homebrew/brew:main an unpatched tree cuts the RBI from 17 accessors to 6 and fails on those three calls; with this change --update reproduces the committed RBI byte for byte and typecheck passes.


  • 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 brew benchmark results.
  • 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 plus the full brew typecheck --update and brew typecheck sequence on Linux in ghcr.io/homebrew/brew:main.


Signed-off-by: Patrick Linnane <patrick@linnane.io>

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 fixes OS-dependent Tapioca RBI generation for Cask::Config by making the CaskConfig DSL compiler derive its accessor list from Cask::Config::DEFAULT_DIRS (plus :languages) instead of Cask::Config.defaults, ensuring consistent sorbet/rbi/dsl/cask/config.rbi output across macOS and Linux.

Changes:

  • Update Tapioca::Compilers::CaskConfig to generate accessors from Cask::Config::DEFAULT_DIRS (and :languages), removing the now-obsolete LINUX_ONLY_DIRS workaround.
  • Add a regression test that stubs Cask::Config.defaults to a reduced set and asserts the compiler still generates accessors for cross-platform default dirs (e.g. input_methoddir) while not generating unrelated keys (e.g. flatpakdir).

Reviewed changes

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

File Description
Library/Homebrew/sorbet/tapioca/compilers/cask/config.rb Make accessor generation independent of Cask::Config.defaults by using DEFAULT_DIRS + :languages.
Library/Homebrew/test/sorbet/tapioca/config_spec.rb Add a regression spec to ensure generated accessors remain stable even when defaults is overridden to a smaller hash.

馃挕 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!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit 01c6a74 Aug 26, 2026
51 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the tapioca-cask-config-default-dirs branch August 26, 2026 08:01
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