Skip to content

Type Formulary options instead of **options - #24032

Merged
MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
dduugg:formulary-typed-options
Sep 19, 2026
Merged

MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
dduugg:formulary-typed-options

Conversation

@dduugg

@dduugg dduugg commented Sep 18, 2026

Copy link
Copy Markdown
Member

Formulary.from_rack and from_keg each built an options hash only to splat it into factory, and a **hash splat makes Sorbet skip keyword checking for the whole call, so a mistyped keyword raised an ArgumentError at runtime instead of failing brew typecheck. Pass each callee's keywords explicitly instead.

.compact was a no-op here: the only key it could drop was alias_path, which factory and from_keg both already default to nil. The *spec positional splats go too, since a positional splat disables arity and type checking the same way, so factory's own :stable default is now spelled out at the two call sites that relied on it.


  • 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 with Opus 5, with local review and testing.


- `from_rack` and `from_keg` built an options hash only to splat it
  into `factory`, so Sorbet skipped keyword checking on those calls
  and a mistyped keyword raised only at runtime.
- Pass each callee's keywords explicitly. `.compact` was a no-op:
  the only key it could drop was `alias_path`, which `factory` and
  `from_keg` already default to nil.
- Replace the `*spec` positional splats, which disabled arity and
  type checking the same way, with the callee's own default.
Copilot AI lite review requested due to automatic review settings September 18, 2026 21:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Much nicer, thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 19, 2026
Merged via the queue into Homebrew:main with commit c2cb058 Sep 19, 2026
52 checks passed
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