fix: UnsupportedOperationError gRPC status should be FAILED_PRECONDITION per spec
Problem
The A2A specification (section 5.4) defines the following gRPC status mapping for UnsupportedOperationError:
| A2A Error Type | JSON-RPC Code | gRPC Status | HTTP Status |
|---|---|---|---|
UnsupportedOperationError |
-32004 |
FAILED_PRECONDITION |
400 Bad Request |
However, A2AErrorCodes.UNSUPPORTED_OPERATION in the SDK maps to UNIMPLEMENTED:
https://github.com/a2aproject/a2a-java/blob/643f1f803e992892b1bac89c8ccfb9481e563141/spec/src/main/java/org/a2aproject/sdk/spec/A2AErrorCodes.java#L29
UNSUPPORTED_OPERATION(-32004, "UNIMPLEMENTED", 400),
This diverges from the spec table, which says the gRPC status should be FAILED_PRECONDITION.
Expected behavior
UNSUPPORTED_OPERATION should map to gRPC FAILED_PRECONDITION to match the spec.
Context
Found during review of #1041, which correctly changed streaming-not-supported errors from InvalidRequestError to UnsupportedOperationError. The gRPC status mismatch is a pre-existing issue unrelated to that PR.
I reproduced this on current main (643f1f80). I updated only the existing gRPC assertions for paths that emit UnsupportedOperationError and ran:
mvn -pl transport/grpc -am -Dtest=GrpcHandlerTest -Dsurefire.failIfNoSpecifiedTests=false test
All 8 affected paths failed consistently with expected: <FAILED_PRECONDITION> but was: <UNIMPLEMENTED> (42 tests total, 34 unaffected tests passed). I am working on the minimal mapping/test/doc update.
Closing as per https://github.com/a2aproject/a2a-java/pull/1059#issuecomment-5341719508