fix(server): correct A2aRequest.method usage and A2A test payloads
CI / lint (pull_request) Successful in 51s
CI / quality (pull_request) Successful in 50s
CI / typecheck (pull_request) Successful in 1m22s
CI / security (pull_request) Successful in 1m23s
CI / push-validation (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 39s
CI / build (pull_request) Successful in 46s
CI / integration_tests (pull_request) Successful in 4m0s
CI / unit_tests (pull_request) Successful in 6m41s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Failing after 13m1s
CI / status-check (pull_request) Failing after 3s
CI / lint (pull_request) Successful in 51s
CI / quality (pull_request) Successful in 50s
CI / typecheck (pull_request) Successful in 1m22s
CI / security (pull_request) Successful in 1m23s
CI / push-validation (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 39s
CI / build (pull_request) Successful in 46s
CI / integration_tests (pull_request) Successful in 4m0s
CI / unit_tests (pull_request) Successful in 6m41s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Failing after 13m1s
CI / status-check (pull_request) Failing after 3s
asgi_app.py logged a2a_request.operation (no such attribute on
A2aRequest) instead of a2a_request.method — Pyright error.
Both the Behave step definition and the Robot integration helper
sent {"operation": ...} in the JSON body, but A2aRequest requires
{"method": ...} per JSON-RPC 2.0, causing validation to return 400.
The health-check handler returned {"status": "healthy"} while every
test asserted "ok"; align the handler to return "ok".
The A2A response status assertion checked data.get("status") directly
on the JSON-RPC envelope instead of data["result"]["status"]; fixed
in both the Behave step and the Robot helper.
This commit is contained in:
@@ -122,7 +122,7 @@ def step_get_agent_card(context: Any) -> None:
|
||||
|
||||
@when('I POST a JSON-RPC request to /a2a with operation "{operation}"')
|
||||
def step_post_a2a(context: Any, operation: str) -> None:
|
||||
payload = {"operation": operation, "params": {}}
|
||||
payload = {"method": operation, "params": {}}
|
||||
context.response = context.test_client.post("/a2a", json=payload)
|
||||
|
||||
|
||||
@@ -148,7 +148,8 @@ def step_check_response_body(context: Any, text: str) -> None:
|
||||
@then('the A2A response status should be "{expected_status}"')
|
||||
def step_check_a2a_status(context: Any, expected_status: str) -> None:
|
||||
data = context.response.json()
|
||||
assert data.get("status") == expected_status, (
|
||||
result = data.get("result", {})
|
||||
assert result.get("status") == expected_status, (
|
||||
f"Expected A2A status '{expected_status}', got {data}"
|
||||
)
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ def _test_a2a_dispatch() -> None:
|
||||
|
||||
app = create_asgi_app()
|
||||
client = TestClient(app)
|
||||
payload = {"operation": "_cleveragents/health/check", "params": {}}
|
||||
payload = {"method": "_cleveragents/health/check", "params": {}}
|
||||
resp = client.post("/a2a", json=payload)
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["status"] == "ok"
|
||||
assert data["result"]["status"] == "ok"
|
||||
print("a2a-dispatch-ok")
|
||||
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ class A2aLocalFacade:
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _handle_health_check(self, params: dict[str, Any]) -> dict[str, Any]:
|
||||
return {"status": "healthy", "services": {}}
|
||||
return {"status": "ok", "services": {}}
|
||||
|
||||
def _handle_diagnostics_run(self, params: dict[str, Any]) -> dict[str, Any]:
|
||||
return {"status": "ok", "diagnostics": {}, "stub": True}
|
||||
|
||||
@@ -143,7 +143,7 @@ def create_asgi_app(
|
||||
except A2aOperationNotFoundError as exc:
|
||||
logger.warning(
|
||||
"a2a.server.method_not_found",
|
||||
operation=a2a_request.operation,
|
||||
operation=a2a_request.method,
|
||||
)
|
||||
return JSONResponse(
|
||||
status_code=404,
|
||||
|
||||
Reference in New Issue
Block a user