Skip to content

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

test(flows): add structural validation helper for tests

Steven Enamakel7d3c39cb5bf0
diff --git a/crates/openhuman-core/src/flows/ops_tests.rs b/crates/openhuman-core/src/flows/ops_tests.rs
index 8eef2225f8..1bafae20c9 100644
--- a/crates/openhuman-core/src/flows/ops_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_tests.rs
@@ -19,6 +19,13 @@ fn test_config(tmp: &TempDir) -> Config {
config
}
+fn structurally_valid_graph(value: Value) -> Value {
+ let graph = tinyflows::migrate::deserialize_graph(value).expect("graph should deserialize");
+ tinyflows::validate::validate(&graph).expect("fixture should be structurally valid");
+ tinyflows::compat::ensure_compatible(&graph).expect("fixture should be engine-compatible");
+ serde_json::to_value(graph).expect("graph serializes to portable JSON")
+}
+
fn trigger_only_graph() -> Value {
json!({
"name": "trigger-only",
diff --git a/crates/openhuman-core/src/flows/store_tests.rs b/crates/openhuman-core/src/flows/store_tests.rs
index 2e6e3eef21..1b043e9c31 100644
--- a/crates/openhuman-core/src/flows/store_tests.rs
+++ b/crates/openhuman-core/src/flows/store_tests.rs
@@ -20,7 +20,7 @@ fn graph() -> serde_json::Value {
fn catalog_clients_preserve_definition_revisions_and_suggestion_semantics() {
let tmp = TempDir::new().unwrap();
let config = config(&tmp);
- let flow = create_flow(&config, "before".into(), graph(), false)
+ let flow = create_flow(&config, "before".into(), graph(), false, true)
.unwrap()
.workflow;
assert_eq!(get_flow(&config, &flow.id).unwrap().unwrap().name, "before");