fix: remove unused import and request for FastAPI in pyproject#934
fix: remove unused import and request for FastAPI in pyproject#934guglielmo-san wants to merge 9 commits into1.0-devfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces significant updates to the A2A SDK, primarily focusing on migrating from Pydantic-based models to Protobuf-based models for the core data layer, adding support for database migrations, and implementing backward compatibility for the v0.3 protocol. My review identified critical issues in the GrpcHandler regarding incorrect status code access and the use of a non-existent trailing_metadata() method on the gRPC context. Additionally, I noted that the SQLAlchemy models in models.py require a custom TypeDecorator to handle Protobuf serialization, as the current JSON column type is insufficient.
I am having trouble creating individual review comments. Click here to see my feedback.
src/a2a/server/request_handlers/grpc_handler.py (397)
The expression code.value[0] will raise a TypeError because grpc.StatusCode values are integers, which are not subscriptable. It should be changed to code.value to correctly retrieve the integer status code.
status_code = code.value
src/a2a/server/models.py (54-58)
The status, artifacts, and history fields are now using Protobuf message types (from a2a.types.a2a_pb2), but the SQLAlchemy column type is set to JSON. Protobuf messages are not JSON-serializable by default using standard libraries like json.dumps. You should implement a custom TypeDecorator (e.g., ProtobufType) that handles serialization using google.protobuf.json_format.MessageToDict and ParseDict. Note that for A2A payloads, preserving_proto_field_name=True is not strictly required as lower camel case is permitted. Additionally, ensure the status field is non-nullable.
References
- The status field in TaskMixin must be non-nullable.
- The A2A protocol specification allows lower camel case for push notification JSON payloads, so preserving_proto_field_name=True is not strictly required when using MessageToDict.
src/a2a/server/request_handlers/grpc_handler.py (424-427)
The grpc.aio.ServicerContext object does not have a trailing_metadata() method. Attempting to call it will result in an AttributeError. If you need to merge metadata, you should track it manually within your handler or context builder.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/routes/jsonrpc_dispatcher.py | 85.39% | 85.98% | 🟢 +0.59% |
| src/a2a/server/routes/rest_routes.py | 73.53% | 83.33% | 🟢 +9.80% |
| Total | 91.88% | 91.95% | 🟢 +0.07% |
Generated by coverage-comment.yml
Description
This PR removes unused imports and dependencies across the project.