Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(json-rpc): cover serde error detail in flows_validate response

Steven Enamakel969c557ba2c3
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index e91f496864..3a48cafed4 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -11151,6 +11151,34 @@ async fn json_rpc_flows_validate_wire_shape() {
assert_eq!(vb.get("valid").and_then(Value::as_bool), Some(false));
assert!(vb.get("errors").and_then(Value::as_array).is_some());
+ // Preserve serde's member path and detail across the JSON-RPC envelope.
+ let malformed_graph = json!({
+ "inputs": [ { "type": "string" } ]
+ });
+ let validate_malformed = post_json_rpc(
+ &rpc_base,
+ 9503,
+ "openhuman.flows_validate",
+ json!({ "graph": malformed_graph }),
+ )
+ .await;
+ let malformed = peel_logs_envelope(assert_no_jsonrpc_error(
+ &validate_malformed,
+ "flows_validate malformed graph",
+ ));
+ assert_eq!(malformed.get("valid").and_then(Value::as_bool), Some(false));
+ let errors = malformed
+ .get("errors")
+ .and_then(Value::as_array)
+ .expect("errors");
+ assert_eq!(errors.len(), 1, "malformed graph has one parse error");
+ let error = errors[0].as_str().expect("string error");
+ assert!(error.contains("inputs[0]"), "missing member path: {error}");
+ assert!(
+ error.contains("missing field"),
+ "missing serde detail: {error}"
+ );
+
api_join.abort();
rpc_join.abort();
}