Skip to content

Send required initialize params in the mutex probe test helper#452

Merged
koic merged 1 commit into
modelcontextprotocol:mainfrom
koic:fix_mutex_probe_test_helper_initialize_params
Jul 11, 2026
Merged

Send required initialize params in the mutex probe test helper#452
koic merged 1 commit into
modelcontextprotocol:mainfrom
koic:fix_mutex_probe_test_helper_initialize_params

Conversation

@koic

@koic koic commented Jul 11, 2026

Copy link
Copy Markdown
Member

Motivation and Context

bundle exec rake fails on main with four errors in streamable_http_transport_test.rb:

NoMethodError: undefined method '[]=' for nil
  streamable_http_transport_test.rb:5119 (install_mutex_probe_stream)

This is a semantic conflict between two merged PRs. #451 made the server reject initialize requests that lack the required protocolVersion, capabilities, and clientInfo params with -32602. #449, merged after but developed before it, added the "writes outside the mutex" tests, whose initialize_test_session helper sends an initialize request with no params. That request is now rejected, no session is created, so @sessions[session_id] is nil and installing the probe stream raises NoMethodError.

The fix adds params: initialize_params to the helper's request body, matching the pattern used by every other initialize request in the file via InitializeParamsTestHelper.

How Has This Been Tested?

bundle exec rake now passes: 1318 runs, 0 failures, 0 errors, and RuboCop reports no offenses. The four previously failing tests are the regression coverage.

Breaking Changes

None. Test-only change.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

## Motivation and Context

`bundle exec rake` fails on main with four errors in `streamable_http_transport_test.rb`:

```
NoMethodError: undefined method '[]=' for nil
  streamable_http_transport_test.rb:5119 (install_mutex_probe_stream)
```

This is a semantic conflict between two merged PRs. modelcontextprotocol#451 made the server reject `initialize` requests
that lack the required `protocolVersion`, `capabilities`, and `clientInfo` params with -32602. modelcontextprotocol#449,
merged after but developed before it, added the "writes outside the mutex" tests,
whose `initialize_test_session` helper sends an `initialize` request with no params.
That request is now rejected, no session is created, so `@sessions[session_id]` is nil and installing
the probe stream raises `NoMethodError`.

The fix adds `params: initialize_params` to the helper's request body, matching the pattern used
by every other `initialize` request in the file via `InitializeParamsTestHelper`.

## How Has This Been Tested?

`bundle exec rake` now passes: 1318 runs, 0 failures, 0 errors, and RuboCop reports no offenses.
The four previously failing tests are the regression coverage.

## Breaking Changes

None. Test-only change.
@koic

koic commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

I'll merge this to restore the main branch CI.

@koic koic merged commit d8ba1a8 into modelcontextprotocol:main Jul 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant