feat(a2a): implement JSON-RPC 2.0 wire format and method routing #11114

Closed
HAL9000 wants to merge 1 commits from PR-10910-a2a-json-rpc-routing into master

1 Commits

Author SHA1 Message Date
HAL9000 df237e839b feat(a2a): implement JSON-RPC 2.0 wire format and method routing
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 48s
CI / lint (pull_request) Failing after 1m4s
CI / build (pull_request) Successful in 59s
CI / quality (pull_request) Successful in 1m15s
CI / benchmark-regression (pull_request) Failing after 1m20s
CI / typecheck (pull_request) Failing after 1m28s
CI / security (pull_request) Successful in 1m45s
CI / integration_tests (pull_request) Failing after 3m13s
CI / e2e_tests (pull_request) Successful in 4m4s
CI / unit_tests (pull_request) Failing after 4m55s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 24s
CI / status-check (pull_request) Failing after 3s
Enhance the A2A module to better comply with JSON-RPC 2.0 specification:

- facade.py: Add explicit JSON-RPC error codes (-32601 for unknown methods,
  -32602 for invalid params) in dispatch(). Previously unknown operations
  raised raw exceptions; now they return properly formatted JSON-RPC error
  responses with correct iANA-registered error code -32601.

- stdio_transport.py: Add _validate_jsonrpc_response() static method that
  validates incoming response dicts against the JSON-RPC 2.0 wire format
  before passing them to A2aResponse deserialization. This catches protocol
  violations (wrong jsonrpc version, id mismatch) before they become
  pydantic errors. Improved error logging includes raw_response for debugging.

- tests/a2a/test_models.py: Comprehensive tests for JSON-RPC 2.0 wire format
  compliance covering all model validators.

- tests/a2a/test_facade_dispatch.py: Tests for operation routing verification
  covering extension methods, legacy names, unknown method handling (-32601),
  invalid params (-32602), response structure validity.

- tests/a2a/test_stdio_transport.py: Tests for wire-format validation helper,
  serialization correctness, and mocked subprocess scenarios.

- tests/a2a/test_versioning.py: Version negotiation tests.

- tests/a2a/test_events.py: Event queue lifecycle and SSE formatting tests.
2026-05-11 02:51:35 +00:00