You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: correctly set supported versions for different transports (#205)
This pull request refactors how protocol version compatibility is
handled across transports in the Hermes system. It introduces a new
mechanism for specifying supported protocol versions, updates the
behavior definition, and modifies several transport modules to align
with the new approach.
### Refactoring protocol version handling:
*
[`lib/hermes/protocol.ex`](diffhunk://#diff-98232ed245d0a2546cad3d194c94fd8e637e46a66416b40a5d067ae1850522dbL81-R102):
Added the `supported_transport_versions/1` private function to handle
cases where a transport specifies `:all` as its supported protocol
versions, mapping it to the global `@supported_versions`. Updated the
`validate_transport/2` function to use this new mechanism.
### Updates to transport modules:
*
[`lib/hermes/transport/behaviour.ex`](diffhunk://#diff-71dc0b3f96d79ae5f656538529828d6dbcc9c2cb2f58b5d938b51fdc06851cadL25-R25):
Updated the `supported_protocol_versions/0` callback to allow transports
to return either a list of strings or `:all`.
* `lib/hermes/server/transport/stdio.ex`,
`lib/hermes/transport/stdio.ex`, `lib/hermes/transport/websocket.ex`,
`test/support/mock_transport.ex`, `test/support/stub_transport.ex`:
Modified the `supported_protocol_versions/0` implementations to return
`:all` instead of hardcoded lists for certain transports.
[[1]](diffhunk://#diff-61921887b952ce41ebfb436711dca9d7f8b7c6a9dfd56cc0c2a20baced77362fL98-R98)
[[2]](diffhunk://#diff-6545e6cca647b52bd939e362d7a246724f0190d4eabbeb3cad9724a2f0c4a63cL86-R86)
[[3]](diffhunk://#diff-c1dee42ccc6dfb67a6df853f41e6afb92bcf40f4abf0084d0a4f261da09a0ba4L94-R94)
[[4]](diffhunk://#diff-ceaf02dc0afad3b8c01fbd0ee8194081ab1c0b5ce78f6e1fcbdf3b5ebb04fbbaL15-R15)
[[5]](diffhunk://#diff-1d9b45a0670ea752f56967d81e40b4f9dd2870b0e71c863bb352bf6c94ea2995L93-R93)
*
[`lib/hermes/server/transport/streamable_http.ex`](diffhunk://#diff-da9c9a7a019b46d51290734c0735d5901ec1f1ee58ee44dc8b68912164e90ba0L128-R128):
Updated `supported_protocol_versions/0` to reflect new supported
versions, adding "2025-06-18".
[[1]](diffhunk://#diff-da9c9a7a019b46d51290734c0735d5901ec1f1ee58ee44dc8b68912164e90ba0L128-R128)
[[2]](diffhunk://#diff-783726aa86a0f2e2c55f5aedce0e709b795bc7550f9b816eae300be91329bb75L109-R109)
### Code style improvements:
*
[`lib/hermes/transport/streamable_http.ex`](diffhunk://#diff-783726aa86a0f2e2c55f5aedce0e709b795bc7550f9b816eae300be91329bb75L80-R80):
Adjusted schema definitions to use parentheses for consistency in
formatting.
[[1]](diffhunk://#diff-783726aa86a0f2e2c55f5aedce0e709b795bc7550f9b816eae300be91329bb75L80-R80)
[[2]](diffhunk://#diff-783726aa86a0f2e2c55f5aedce0e709b795bc7550f9b816eae300be91329bb75L89-R89)
These changes enhance flexibility in defining protocol compatibility,
improve maintainability, and ensure consistency across the codebase.
0 commit comments