Skip to content

fix: support Sorbet sigs on methods defined after with_limit - #143

Open
smudge wants to merge 1 commit into
smudge/canonical-tz-namesfrom
smudge/with-limit-sorbet
Open

smudge wants to merge 1 commit into
smudge/canonical-tz-namesfrom
smudge/with-limit-sorbet

Conversation

@smudge

@smudge smudge commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Why?

with_limit is usually declared above perform (or whichever on: methods it wraps), but its wrapper took effect right away, hiding each method below it while that method was still being defined. With sorbet-runtime loaded, any of those methods with a sig failed to load.

How?

The wrapper now takes effect when the class is first instantiated. A new spec checks real sorbet-runtime sigs in a separate process, so the rest of the suite still runs (and is checked to run) without Sorbet loaded.

An alternative to:

`with_limit` is usually declared above the methods it wraps, but it
prepended its wrapper right away, so each method defined below it was
shadowed by the wrapper while it was being defined. Sorbet's runtime
`sig` hooks then found the wrapper instead of the method and raised.

The wrapper is now prepended when the class is first instantiated, for
`perform` and any other `on:` methods alike. sorbet-runtime is added as
a dev dependency, but it is only loaded in a separate process, so the
rest of the suite still runs without it.
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.

1 participant