Introducing Sorbet into your Ruby codebase
summary
Adds Sorbet to a decade‑old Ruby monolith to make refactors safer and enable LSP jump‑to‑definitions, using RBI files and Shopify’s Tapioca to generate signatures, and enabling the experimental require_ancestor for module dependencies. Tests run with Sorbet on, production partially on; signatures are toggled off in hot loops to limit runtime cost. Found ~6,000 unsafe uses and ~3,000 casts during rollout, saw ~1.5–2% measured overhead but microbenchmarks show some assertions add ~4x slowdowns; works but feels noisy and best for large codebases.
AI-written summary · about
chapters (13)
- 0:00Introduction and background
- 2:16What is Sorbet
- 3:41Sorbet syntax basics
- 6:55Using Sorbet in practice
- 9:45Module dependencies and typing
- 12:14Type inference challenges
- 14:00Generics and RBI files
- 15:24GitHub’s implementation
- 17:50Performance impact of Sorbet
- 20:21Benefits of Sorbet
- 22:30RBI file generation issues
- 24:58Verdict on Sorbet adoption
- 26:05Q&A: Type validation vs static typing
related talks
33mAdopting Sorbet at Scale
30mSorbet at Grailed: Typing a Large Rails Codebase to Ship with...
41mSorbet: A type checker for Ruby 3 you can use today!
48mGradual typing for Ruby at Scale with Sorbet
31mStatic Type Checking in Rails with Sorbet
30mCompiling Ruby to Native Code with Sorbet & LLVM
22mStatic typing with RBS in Ruby
24mType Checking with Sorbet
