Handle payload superclass redefinition errors during gem RBI validation#2653
Open
zeeshankhan-05 wants to merge 1 commit into
Open
Handle payload superclass redefinition errors during gem RBI validation#2653zeeshankhan-05 wants to merge 1 commit into
zeeshankhan-05 wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Hi @KaanOzkan. I appreciate the help with #1834 about using the |
Author
|
I have signed the CLA! |
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.
Motivation
Fixes #1834.
When Tapioca validates generated gem RBIs, some definitions can redefine a Sorbet payload class with a different superclass. Sorbet reports this as error
5012and recommends adding--suppress-payload-superclass-redefinition-for=ConstantNametosorbet/config. Tapioca already auto-adjusts RBI strictness for error4010, but it did not handle5012or inform users about the mismatch.Closes #1834
Implementation
--stop-after namervalidation pass for error4010auto-strictness behavior.auto_strictnessis enabled, run a second full Sorbet pass to detect resolver-level error5012(the namer pass alone does not surface this error).--suppress-payload-superclass-redefinition-for=ConstantNametosorbet/configwhen missing.config.lines(chomp: true).include?(flag)) so similar suppressions for other constants do not block the correct entry.sorbet/configcontent when appending (no stripping of trailing whitespace or blank lines).Tests
Added an integration test in the
describe "strictness"block ofspec/tapioca/cli/gem_spec.rb(following maintainer guidance on #1834). The test exercisestapioca gem, verifies the suppression is written tosorbet/config, verifies user-facing output on first and second runs, and confirms idempotency.Ran locally on the clean branch (1 commit ahead of
upstream/main):bin/test spec/tapioca/cli/gem_spec.rb— 67 tests, 494 assertions, 0 failures, 0 errors, 1 skipbin/test spec/tapioca/cli/dsl_spec.rb— 69 tests, 335 assertions, 0 failures, 0 errors, 0 skipsbin/typecheck— passbin/style— passAn earlier full-suite run (
bin/test) completed with 794 tests, 0 failures, 2 errors, and 2 skips. The two errors were unrelatedRubyLsp::Tapioca::AddonURI::InvalidURIErrorfailures caused by spaces in the local directory path; they are not related to this change.