Repository navigation
Add Sorbet spec adoption guardrails - #16505
Draft
JamieMagee wants to merge 2 commits into
Draft
JamieMagee wants to merge 2 commits into
JamieMagee wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the stated guardrails and includes comprehensive integration coverage for its key behaviors.
0 open findings
What changed in this PR
Adds CI guardrails to prevent regressions while incrementally enabling Sorbet checking for Ruby specs.
Changes:
- Adds a Git-base ratchet for effective spec inclusion and strictness.
- Reports checked, false, ignored, and untyped usage metrics.
- Documents migration, exception, and validation requirements.
| File | Description |
|---|---|
sorbet/config |
Includes the ratchet in Sorbet checking. |
script/sorbet-spec-ratchet |
Implements comparison and reporting logic. |
common/spec/sorbet_spec_ratchet_spec.rb |
Adds integration coverage for ratchet behavior. |
.github/workflows/sorbet.yml |
Reports spec coverage from full type checks. |
.github/workflows/check-sorbet-typing-mode.yml |
Enforces the ratchet on pull requests. |
README.md |
Documents spec typing workflows. |
.github/instructions/testing.instructions.md |
Adds spec-testing guidance. |
.github/instructions/code-quality.instructions.md |
Defines RSpec migration requirements. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4 of 5 tasks
Comment on lines
+123
to
+124
| def self.regressions(paths, base, contents, head) | ||
| paths.select { |path| spec_file?(path) }.filter_map do |path| |
5 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What are you trying to accomplish?
Prevent Sorbet test coverage from regressing while spec trees are enrolled incrementally.
Add a Git-base ratchet that uses the pinned compiler's file table to compare effective spec inclusion and strictness. Report checked, false, and ignored files separately, with untyped usage from the full type check. Run typing checks on stacked PR bases as well as
main, and document strict-target migration and reviewed exceptions.Builds on the experimental RSpec rollout in #16469.
Anything you want to highlight for special attention from reviewers?
The ratchet analyzes a Git snapshot of the immediate PR base, rather than approximating Sorbet's ignore rules or trusting sigils in ignored directories. Existing excluded suites remain excluded. Checked files cannot be downgraded or re-excluded; new included non-strict files and changed/newly enrolled false files need a specific explanation and reference.
The new CLI has 14 integration regressions covering actual Git repositories and compiler inputs, including strictness overrides, stacked bases, missing bases, and spaced paths. Its signature-bearing
letdeclarations have a scopedRSpec/ScatteredLetexception because moving declarations would detach their signatures.No runtime type-validation handlers or production interfaces change.
The common CI image now explicitly copies the root CLI needed by these integration specs. This fixes the initial CI-only loading failure caused by that image's selected source copies.
How will you know you've accomplished your goal?
Validated inside Docker with the locked root bundle:
bundle exec srb tc— passed.bundle exec tapioca gem --verify— passed; gem RBIs are up to date.bundle exec rubocop script/sorbet-spec-ratchet common/spec/sorbet_spec_ratchet_spec.rb --format simple— passed, no offenses.common:bundle exec rspec -I spec spec/sorbet_spec_ratchet_spec.rb— passed, 14 examples.BASE_REF=main bundle exec ruby script/sorbet-spec-ratchet— passed against the actual checkout.bundle exec srb tc --track-untyped=everywhere --print=file-table-json:tmp/sorbet-file-table.jsonfollowed bybundle exec ruby script/sorbet-spec-ratchet --report tmp/sorbet-file-table.json— passed; checked/false/ignored counts distinguish effective coverage.docker build --quiet --file common/Dockerfile --tag dependabot-rspec-common:652b9b3a .anddocker run --rm --init --env CI=true --workdir /home/dependabot/common dependabot-rspec-common:652b9b3a bundle exec rspec -I spec spec/sorbet_spec_ratchet_spec.rb --format progress— passed, all 14 examples in the actual CI image without full-checkout mounts.At the dependent support layer, both
bundle exec rspec -I spec spec --format progressfromcommonand the rebuilt common image's exact./script/ci-testcommand passed all 2,354 examples. Other ecosystem suites and the complete monorepo suite were not run locally.Checklist