Repository navigation
Conversation
Invoke lazyMessage(actualState) when the state check fails. Add regression tests for the default message, custom message evaluation exactly once with the observed state, skipped evaluation when the state matches, and formatting after a forced state change. Fixes modelcontextprotocol#1083
There was a problem hiding this comment.
Nice, focused fix with solid regression coverage — approving!
Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=d57e2c1c-18eb-4800-a86d-ab5887e9577f
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.
Motivation and Context
Callers checking an unexpected transport state receive an exception containing a function representation instead of the expected and observed states. Custom error messages are never evaluated. AbstractClientTransport.checkState returns lazyMessage itself from the check failure block instead of invoking it with actualState.
Invoke lazyMessage(actualState) when the state check fails. Add regression tests for the default message, custom message evaluation exactly once with the observed state, skipped evaluation when the state matches, and formatting after a forced state change.
Fixes #1083
How Has This Been Tested?
Ran
./gradlew testlocally on macOS for the kotlin-sdk AbstractClientTransport change; it passed../gradlew --no-daemon :kotlin-sdk-core:testClassesfailed because the requested task does not exist; no tests ran from this command../gradlew testcompleted successfully, but the transcript does not show the core JVM regression tests running.Breaking Changes
Covered in the summary above.
Types of changes
Checklist
Nothing in the kotlin-sdk AbstractClientTransport change to
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/AbstractClientTransport.ktbacks it.The kotlin-sdk AbstractClientTransport change to
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/AbstractClientTransport.kttouches no documentation.Additional context
Nothing beyond what is described above.