Skip to content

Skip RBS rewrite when no markers are present#2616

Draft
mattkubej wants to merge 1 commit intomainfrom
rbs-marker-guard
Draft

Skip RBS rewrite when no markers are present#2616
mattkubej wants to merge 1 commit intomainfrom
rbs-marker-guard

Conversation

@mattkubej
Copy link
Copy Markdown

@mattkubej mattkubej commented May 7, 2026

Summary

Avoid running Spoom's RBS-to-Sorbet-sig translator for typed Ruby files that cannot contain runtime-rewriteable RBS syntax.

Tapioca currently calls Spoom::Sorbet::Translate.rbs_comments_to_sorbet_sigs for every typed Ruby file loaded through the RBS rewriter. A large portion of typed files in Core do not contain RBS signatures or supported RBS annotations, so the translator often parses source only to return it unchanged.

This keeps the existing typed: gate and adds a conservative marker gate. Translation now runs only when source contains one of:

  • #:
  • #|
  • # @abstract
  • # @interface
  • # @sealed
  • # @final
  • # @requires_ancestor:
  • # @override
  • # @overridable
  • # @without_runtime

False positives are safe because they still use the existing translator. False negatives would be unsafe, so the annotation list is intentionally aligned with Spoom's currently supported runtime-rewrite annotations.

Core validation

Validated with a temporary Core CI experiment in shop/world#675510.

Clean timing run: https://buildkite.com/shopify/world-shopify-linters/builds/981200

Job Time
marker guard 479.10s
stock Tapioca 590.41s

Delta: 111.31s faster (~18.9%).

The paired equivalence job on the same build produced byte-identical DSL RBI output:

Stock and marker-guard Tapioca DSL outputs are byte-identical.

Diagnostics from that run:

typed_files=60314
typed_marker_positive=22244
typed_marker_negative=38070
translate_calls=22244
rewrite_changed=21816
rewrite_unchanged=428
translate_errors=0

@mattkubej mattkubej force-pushed the rbs-marker-guard branch from c06244a to 3ad4466 Compare May 7, 2026 23:24
@mattkubej mattkubej added the enhancement New feature or request label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant