~/talk

Automatically generating types by running tests

Talkat RubyKaigi 2025 · 2025-04-16..04-18· [ruby, typescript]
links:none on file
slides:none on file

A gem named RBS Trace gem on RubyGems automatically records argument and return classes during tests and inserts RBS comments into method definitions; it uses TracePoint plus binding hacks to get argument values, call_allocations and Prism to detect void usage, and unbound-method tricks to recover ActiveRecord and BasicObject class names. It works on real Rails apps (Redmine, Mastodon), supports RSpec/Minitest and parallel tests via a per-worker .rbs merge workflow, and slows tests by 5.4x and 3.8x locally, 1.5x in CI.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:05What is RBS Trace
  3. 2:37How to use RBS Trace
  4. 3:22Generating types from tests
  5. 4:51Testing in Rails apps
  6. 5:33Performance impact
  7. 7:25Design and development challenges
  8. 10:28Implementing the gem
  9. 11:13Handling basic object classes
  10. 12:16Active Record relation names
  11. 14:02Void type handling
  12. 17:51Parallel test support
  13. 21:52Future developments
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.