tapioca/compilers/cask/config: Generate accessors from DEFAULT_DIRS - #23661
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
This was referenced Aug 26, 2026
Contributor
There was a problem hiding this comment.
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::CaskConfigto generate accessors fromCask::Config::DEFAULT_DIRS(and:languages), removing the now-obsoleteLINUX_ONLY_DIRSworkaround. - Add a regression test that stubs
Cask::Config.defaultsto 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.
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.
On Linux
OS::Linux::Cask::Config::ClassMethodsoverridesCask::Config.defaultswith a smaller hash, and theCaskConfigDSL compiler built its accessor list from it. Runningbrew typecheck --updateon Linux therefore deletedinput_methoddirand nine other accessors fromsorbet/rbi/dsl/cask/config.rbi, and thebrew typecheckthat follows failed on threeinput_methoddircalls intest/cask/config_spec.rb. That breaks portable-ruby's integration path, which runs both in sequence.Cask::Configdefines its accessors from the baseDEFAULT_DIRSpluslanguages, and that set is identical on every platform because the Linux override is prepended to the singleton class and does not affectCask::Config::DEFAULT_DIRS. Generating from those two sources makes the committed RBI independent of which OS runs Tapioca.LINUX_ONLY_DIRSgoes away, having been a no-op sinceappimagedirmoved into the baseDEFAULT_DIRS.To reproduce, run
brew typecheck --updatethenbrew typecheckon Linux. Inghcr.io/homebrew/brew:mainan unpatched tree cuts the RBI from 17 accessors to 6 and fails on those three calls; with this change--updatereproduces the committed RBI byte for byte and typecheck passes.brew benchmarkresults.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 lgtmplus the fullbrew typecheck --updateandbrew typechecksequence on Linux inghcr.io/homebrew/brew:main.