forked from cleveragents/cleveragents-core
```
fix(a2a): update A2aVersionNegotiator to support JSON-RPC version 2.0
Implemented changes to align the A2A version negotiation with JSON-RPC 2.0 as per the specification and updated the test suite accordingly.
What was implemented
- Updated A2aVersionNegotiator.CURRENT_VERSION from "1.0" to "2.0" in src/cleveragents/a2a/versioning.py
- Updated A2aVersionNegotiator.SUPPORTED_VERSIONS from ("1.0",) to ("2.0",) in src/cleveragents/a2a/versioning.py
- Updated 7 Behave scenarios in features/consolidated_misc.feature to reflect "2.0" as the supported version:
- Negotiate supported version succeeds: now negotiates "2.0" instead of "1.0"
- Negotiate unsupported version raises error: now uses "99.0" as the unsupported version (since "2.0" is now supported)
- is_supported returns True for valid version: now checks "2.0" instead of "1.0"
- get_current returns current version: now expects "2.0" instead of "1.0"
- M6 smoke A2A version negotiation accepts 2.0: updated from "1.0" to "2.0"
- M6 smoke A2A version negotiation rejects unsupported: now uses "99.0" instead of "2.0"
- M6 smoke A2A version is_supported returns correct result: now checks "2.0" instead of "1.0"
Key design decisions
- The A2A protocol is built on JSON-RPC 2.0 per the specification. The version negotiator must be consistent with JSONRPC_VERSION = "2.0" in models.py.
- "1.0" is removed from SUPPORTED_VERSIONS as there is no backward compatibility requirement for the old version in the spec.
- All tests updated to reflect the corrected behavior.
Impacted modules/components
- src/cleveragents/a2a/versioning.py
- features/consolidated_misc.feature
- Behavioral tests referencing A2A version negotiation
ISSUES CLOSED: #2747
```
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
```
|
||||
fix(a2a): update A2aVersionNegotiator to support JSON-RPC version 2.0
|
||||
|
||||
Implemented changes to align the A2A version negotiation with JSON-RPC 2.0 as per the specification and updated the test suite accordingly.
|
||||
|
||||
What was implemented
|
||||
- Updated A2aVersionNegotiator.CURRENT_VERSION from "1.0" to "2.0" in src/cleveragents/a2a/versioning.py
|
||||
- Updated A2aVersionNegotiator.SUPPORTED_VERSIONS from ("1.0",) to ("2.0",) in src/cleveragents/a2a/versioning.py
|
||||
- Updated 7 Behave scenarios in features/consolidated_misc.feature to reflect "2.0" as the supported version:
|
||||
- Negotiate supported version succeeds: now negotiates "2.0" instead of "1.0"
|
||||
- Negotiate unsupported version raises error: now uses "99.0" as the unsupported version (since "2.0" is now supported)
|
||||
- is_supported returns True for valid version: now checks "2.0" instead of "1.0"
|
||||
- get_current returns current version: now expects "2.0" instead of "1.0"
|
||||
- M6 smoke A2A version negotiation accepts 2.0: updated from "1.0" to "2.0"
|
||||
- M6 smoke A2A version negotiation rejects unsupported: now uses "99.0" instead of "2.0"
|
||||
- M6 smoke A2A version is_supported returns correct result: now checks "2.0" instead of "1.0"
|
||||
|
||||
Key design decisions
|
||||
- The A2A protocol is built on JSON-RPC 2.0 per the specification. The version negotiator must be consistent with JSONRPC_VERSION = "2.0" in models.py.
|
||||
- "1.0" is removed from SUPPORTED_VERSIONS as there is no backward compatibility requirement for the old version in the spec.
|
||||
- All tests updated to reflect the corrected behavior.
|
||||
|
||||
Impacted modules/components
|
||||
- src/cleveragents/a2a/versioning.py
|
||||
- features/consolidated_misc.feature
|
||||
- Behavioral tests referencing A2A version negotiation
|
||||
|
||||
ISSUES CLOSED: #2747
|
||||
```
|
||||
@@ -223,20 +223,20 @@ Feature: Consolidated Misc
|
||||
|
||||
Scenario: Negotiate supported version succeeds
|
||||
Given a new A2aVersionNegotiator
|
||||
When I negotiate version "1.0"
|
||||
Then the negotiated version should be "1.0"
|
||||
When I negotiate version "2.0"
|
||||
Then the negotiated version should be "2.0"
|
||||
|
||||
|
||||
Scenario: Negotiate unsupported version raises error
|
||||
Given a new A2aVersionNegotiator
|
||||
When I try to negotiate version "2.0"
|
||||
When I try to negotiate version "99.0"
|
||||
Then an A2aVersionMismatchError should be raised
|
||||
And the error requested_version should be "2.0"
|
||||
And the error requested_version should be "99.0"
|
||||
|
||||
|
||||
Scenario: is_supported returns True for valid version
|
||||
Given a new A2aVersionNegotiator
|
||||
Then version "1.0" should be supported
|
||||
Then version "2.0" should be supported
|
||||
|
||||
|
||||
Scenario: is_supported returns False for invalid version
|
||||
@@ -246,7 +246,7 @@ Feature: Consolidated Misc
|
||||
|
||||
Scenario: get_current returns current version
|
||||
Given a new A2aVersionNegotiator
|
||||
Then the current version should be "1.0"
|
||||
Then the current version should be "2.0"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# A2aRequest model validation
|
||||
@@ -719,24 +719,24 @@ Feature: Consolidated Misc
|
||||
# --- A2A version negotiation ---
|
||||
|
||||
|
||||
Scenario: M6 smoke A2A version negotiation accepts 1.0
|
||||
Scenario: M6 smoke A2A version negotiation accepts 2.0
|
||||
Given a m6 smoke test runner
|
||||
And a m6 smoke A2A local facade
|
||||
When I m6 smoke negotiate A2A version "1.0"
|
||||
Then the m6 smoke negotiated version should be "1.0"
|
||||
When I m6 smoke negotiate A2A version "2.0"
|
||||
Then the m6 smoke negotiated version should be "2.0"
|
||||
|
||||
|
||||
Scenario: M6 smoke A2A version negotiation rejects unsupported
|
||||
Given a m6 smoke test runner
|
||||
And a m6 smoke A2A local facade
|
||||
When I m6 smoke negotiate A2A version "2.0"
|
||||
When I m6 smoke negotiate A2A version "99.0"
|
||||
Then the m6 smoke facade should raise A2aVersionMismatchError
|
||||
|
||||
|
||||
Scenario: M6 smoke A2A version is_supported returns correct result
|
||||
Given a m6 smoke test runner
|
||||
And a m6 smoke A2A local facade
|
||||
When I m6 smoke check if version "1.0" is supported
|
||||
When I m6 smoke check if version "2.0" is supported
|
||||
Then the m6 smoke version support should be true
|
||||
When I m6 smoke check if version "99.0" is supported
|
||||
Then the m6 smoke version support should be false
|
||||
|
||||
@@ -17,8 +17,8 @@ logger: structlog.stdlib.BoundLogger = structlog.get_logger(__name__)
|
||||
class A2aVersionNegotiator:
|
||||
"""Negotiates A2A protocol versions."""
|
||||
|
||||
CURRENT_VERSION: str = "1.0"
|
||||
SUPPORTED_VERSIONS: tuple[str, ...] = ("1.0",)
|
||||
CURRENT_VERSION: str = "2.0"
|
||||
SUPPORTED_VERSIONS: tuple[str, ...] = ("2.0",)
|
||||
|
||||
def negotiate(self, requested: str) -> str:
|
||||
"""Return *requested* if supported, otherwise raise.
|
||||
|
||||
Reference in New Issue
Block a user