Skip to content

Migrate Sorbet signatures to RBS comments#455

Open
Morriar wants to merge 17 commits intomainfrom
at/rbs-comment-signatures
Open

Migrate Sorbet signatures to RBS comments#455
Morriar wants to merge 17 commits intomainfrom
at/rbs-comment-signatures

Conversation

@Morriar
Copy link
Copy Markdown
Contributor

@Morriar Morriar commented May 1, 2026

Summary

Migrate all Sorbet sig blocks and type annotations to RBS comment signatures, allowing us to drop the runtime dependency on sorbet-runtime.

The main goal is to remove the sorbet-runtime dependency from the gem. This eliminates the runtime overhead of signature validation and method wrapping, boosting performance for all Packwerk users — especially on large codebases where the cost of sorbet-runtime adds up across thousands of file checks.

What changed

  • Translate all sig blocks to #: RBS comment signatures
  • Translate T.let, T.cast, T.must, T.bind, T.unsafe to RBS comment equivalents (#: as Type, #: as !nil, etc.)
  • Translate T.type_alias to #: type name = ... RBS syntax
  • Migrate T::Struct subclasses to plain Ruby classes
  • Remove extend T::Sig, extend T::Helpers, T::Generics usage
  • Remove sorbet-runtime from gemspec dependencies
  • Remove disable_sorbet.rb shim (no longer needed)

@Morriar Morriar requested a review from a team as a code owner May 1, 2026 19:20
@Morriar Morriar force-pushed the at/rbs-comment-signatures branch from fa09654 to 52480ca Compare May 1, 2026 19:23
Base automatically changed from at/bump-sorbet to main May 1, 2026 19:46
Comment thread Gemfile.lock
thor (>= 1.2.0)
tsort
thor (1.5.0)
thor (1.4.0)
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.

random downgrade?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, not sure why bundler decided to downgrade some gems because I remove sorbet-runtime

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.

Downgrades are still there

Comment thread Gemfile.lock
Morriar added 17 commits May 5, 2026 10:36
* Use conservative rubocop bump (1.69.0 instead of 1.86.1) to minimize
  transitive dependency changes
* Add minitest-mock gem (extracted from minitest 6) to restore Object#stub
* Require "parser" instead of sub-files to fix AST constant load order
  with parser 3.3.11.1
* Use Prism::Translation::Parser::Builder as base class for
  TolerateInvalidUtf8Builder to fix Prism 1.9.0 deprecation warnings
* Update integration test to match new nil error message after T.must
  removal
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar force-pushed the at/rbs-comment-signatures branch from 52480ca to fdeee74 Compare May 5, 2026 14:38
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.

2 participants