Fix a SyntaxError on Ruby 2.7.0 caused by arguments forwarding syntax#419
Merged
koic merged 1 commit intoJun 20, 2026
Merged
Conversation
0bb0601 to
c326213
Compare
SyntaxError on Ruby 2.7.0 Caused by Arguments Forwarding SyntaxSyntaxError on Ruby 2.7.0 caused by arguments forwarding syntax
SyntaxError on Ruby 2.7.0 caused by arguments forwarding syntaxSyntaxError on Ruby 2.7.0 caused by arguments forwarding syntax
## Motivation and Context The gemspec already declares `required_ruby_version >= 2.7.0`, but `ServerContext` used the `...` arguments forwarding syntax in `method_missing`. That syntax was added in Ruby 2.7.3, so requiring the gem raised a `SyntaxError` on Ruby 2.7.0 through 2.7.2, and the library could not be loaded at all. RuboCop did not catch this because its Parser backend runs on Ruby 2.7.8, where the syntax is valid. CI missed it too because the test matrix tested `2.7`, which resolves to the latest 2.7.x rather than the declared minimum. ## How Has This Been Tested? Forward arguments explicitly with `*args, **kwargs, &block` so the method loads on Ruby 2.7.0, and pin the CI test matrix to 2.7.0 so the suite runs against the declared minimum instead of the latest 2.7.x. Running the suite on 2.7.0 also requires a `Hash.ruby2_keywords_hash?` shim in the test helper, since mocha would otherwise raise a `NoMethodError` on that version. ## Breaking Changes None. Closes modelcontextprotocol#418
c326213 to
c4c73e0
Compare
atesgoral
approved these changes
Jun 20, 2026
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 and Context
The gemspec already declares
required_ruby_version >= 2.7.0, butServerContextused the...arguments forwarding syntax inmethod_missing. That syntax was added in Ruby 2.7.3, so requiring the gem raised aSyntaxErroron Ruby 2.7.0 through 2.7.2, and the library could not be loaded at all.RuboCop did not catch this because its Parser backend runs on Ruby 2.7.8, where the syntax is valid. CI missed it too because the test matrix tested
2.7, which resolves to the latest 2.7.x rather than the declared minimum.How Has This Been Tested?
Forward arguments explicitly with
*args, **kwargs, &blockso the method loads on Ruby 2.7.0, and pin the CI test matrix to 2.7.0 so the suite runs against the declared minimum instead of the latest 2.7.x.Running the suite on 2.7.0 also requires a
Hash.ruby2_keywords_hash?shim in the test helper, since mocha would otherwise raise aNoMethodErroron that version.Closes #418
Breaking Changes
None.
Types of changes
Checklist
Additional context