The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(flows): remove redundant engine compatibility tests and update graph hash test
Steven Enamakel5c4c784b93ca
diff --git a/crates/openhuman-core/src/flows/README.md b/crates/openhuman-core/src/flows/README.mdindex 1a07c3be46..6b932e39bc 100644--- a/crates/openhuman-core/src/flows/README.md+++ b/crates/openhuman-core/src/flows/README.md@@ -68,7 +68,7 @@ from always-compiled code.## Tests- `tinyflows/` has its own suite: `checkpoint_compat_tests.rs`, `memory_adapter_tests.rs`, `memory_node_e2e_tests.rs`, `observability_tests.rs`, `langfuse_export_tests.rs`, `tinyflows_tests.rs`, and `caps/*_tests.rs`.-- Not compiled: `types.rs` / `types_tests.rs` are declared by no module (`flows::types` resolves to `tinyflows_catalog::types`, and `store.rs` has no test attachment). They are leftovers from moving the model and store into `tinyflows-catalog` / `tinyflows-sqlite`.+- Not compiled: `store.rs` has no test attachment; it is a leftover from moving the model and store into `tinyflows-catalog` / `tinyflows-sqlite`. (`types_tests.rs` was removed: `flows::types` is `tinyflows_catalog::types`, whose own suite covers it.)## Related docsdiff --git a/crates/openhuman-core/src/flows/ops_approval_manifest_and_catalog_tests.rs b/crates/openhuman-core/src/flows/ops_approval_manifest_and_catalog_tests.rsindex 43de43f026..12d6bb50de 100644--- a/crates/openhuman-core/src/flows/ops_approval_manifest_and_catalog_tests.rs+++ b/crates/openhuman-core/src/flows/ops_approval_manifest_and_catalog_tests.rs@@ -409,34 +409,6 @@ async fn ttl_sweep_still_expires_an_unclaimed_parked_run() {assert_eq!(row.status, "cancelled");}-/// T-M1 scope: the pin must cover `require_approval`, not just the graph.-///-/// The flag feeds `workflow_origin(...)`, which becomes the `AgentTurnOrigin`-/// for the whole resumed execution — `require_approval: false` auto-allows every-/// `external_effect` tool call, where `true` parks each for its own decision.-/// It is settable independently of the graph (`flows_update` accepts-/// `graph_json: None, require_approval: Some(false)`), so hashing the graph-/// alone would let someone park at a gate, get the user's approval, flip the-/// flag with the graph untouched, and have every downstream outbound node fire-/// unattended on resume — under an approval the user never gave.-#[test]-fn graph_hash_covers_require_approval_not_just_the_graph() {- let graph = structurally_valid_graph(trigger_only_graph());-- let gated = compute_graph_hash(&graph, true).expect("should hash");- let ungated = compute_graph_hash(&graph, false).expect("should hash");-- assert_ne!(- gated, ungated,- "flipping require_approval must invalidate the pin even when the graph is byte-identical"- );- assert_eq!(- gated,- compute_graph_hash(&graph, true).expect("should hash"),- "the pin must stay stable for an unchanged configuration"- );-}-/// T-M1 refusal must not clobber a run another resume already owns.////// The stale-approval check runs BEFORE this call claims the run, so a losingdiff --git a/crates/openhuman-core/src/flows/ops_engine_compatibility_tests.rs b/crates/openhuman-core/src/flows/ops_engine_compatibility_tests.rsindex 2932707606..30c689d426 100644--- a/crates/openhuman-core/src/flows/ops_engine_compatibility_tests.rs+++ b/crates/openhuman-core/src/flows/ops_engine_compatibility_tests.rs@@ -1,267 +1,5 @@use super::*;-#[test]-fn engine_compatibility_rejects_main_label_on_conditional_fan_in_path() {- let graph = structurally_valid_graph(main_port_conditional_fan_in_graph());- let errors = engine_compatibility_errors(&graph);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_MAIN_PORT_CONDITIONAL_FAN_IN);- assert_eq!(errors[0].node_id.as_deref(), Some("m"));-- let reconverged = structurally_valid_graph(json!({- "name": "main-port-reconverges-before-fan-in",- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "route", "kind": "switch", "name": "Route", "config": { "field": "kind" } },- { "id": "a", "kind": "output_parser", "name": "A" },- { "id": "c", "kind": "output_parser", "name": "C" },- { "id": "m", "kind": "merge", "name": "Merge" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "route" },- { "from_node": "start", "from_port": "main", "to_node": "c" },- { "from_node": "route", "from_port": "main", "to_node": "a" },- { "from_node": "route", "from_port": "default", "to_node": "a" },- { "from_node": "a", "from_port": "main", "to_node": "m" },- { "from_node": "c", "from_port": "main", "to_node": "m" }- ]- }));- assert!(engine_compatibility_errors(&reconverged).is_empty());-}--/// A loop head has two incoming edges, and this gate mirrors the engine's-/// fan-in classification — so without excluding back-edges it would report-/// every legal bounded loop as an unrelieved fan-in and refuse to save it.-#[test]-fn engine_compatibility_does_not_treat_a_loop_back_edge_as_a_fan_in() {- let looping = structurally_valid_graph(json!({- "name": "bounded-loop",- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "l", "kind": "loop", "name": "Loop",- "config": { "max_iterations": 3, "on_exceeded": "continue" } },- { "id": "work", "kind": "output_parser", "name": "Work" },- { "id": "out", "kind": "output_parser", "name": "Out" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "l" },- { "from_node": "l", "from_port": "body", "to_node": "work" },- { "from_node": "work", "from_port": "main", "to_node": "l" },- { "from_node": "l", "from_port": "done", "to_node": "out" }- ]- }));- assert!(- engine_compatibility_errors(&looping).is_empty(),- "a bounded loop must save cleanly: {:?}",- engine_compatibility_errors(&looping)- );-}--#[test]-fn engine_compatibility_requires_exhaustive_router_choices_for_reconvergence() {- let exhaustive_condition = nested_router_reconvergence_graph("condition", &["true", "false"]);- assert!(engine_compatibility_errors(&exhaustive_condition).is_empty());-- let missing_condition_branch = nested_router_reconvergence_graph("condition", &["true"]);- let errors = engine_compatibility_errors(&missing_condition_branch);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN);-- let exhaustive_switch = nested_router_reconvergence_graph("switch", &["known-case", "default"]);- assert!(engine_compatibility_errors(&exhaustive_switch).is_empty());-- // Same-port fan-out is unconditional: TinyFlows schedules both `main`- // successors. A side path after an exhaustive router must not make the- // reconverging path look like another conditional choice.- let exhaustive_switch_with_main_fanout = structurally_valid_graph(json!({- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "outer", "kind": "condition", "name": "Outer", "config": { "field": "outer" } },- { "id": "inner", "kind": "switch", "name": "Inner", "config": { "field": "inner" } },- { "id": "outer_else", "kind": "output_parser", "name": "Outer else" },- { "id": "fanout", "kind": "output_parser", "name": "Fan out" },- { "id": "a", "kind": "output_parser", "name": "A" },- { "id": "side", "kind": "output_parser", "name": "Side" },- { "id": "c", "kind": "output_parser", "name": "C" },- { "id": "m", "kind": "merge", "name": "Merge" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "outer" },- { "from_node": "start", "from_port": "main", "to_node": "c" },- { "from_node": "outer", "from_port": "true", "to_node": "inner" },- { "from_node": "outer", "from_port": "false", "to_node": "outer_else" },- { "from_node": "inner", "from_port": "known-case", "to_node": "fanout" },- { "from_node": "inner", "from_port": "default", "to_node": "fanout" },- { "from_node": "fanout", "from_port": "main", "to_node": "a" },- { "from_node": "fanout", "from_port": "main", "to_node": "side" },- { "from_node": "a", "from_port": "main", "to_node": "m" },- { "from_node": "c", "from_port": "main", "to_node": "m" }- ]- }));- assert!(engine_compatibility_errors(&exhaustive_switch_with_main_fanout).is_empty());-- // A switch with only `default` is exhaustive: every input takes that edge,- // so it is an unconditional step even though it has a single wired port.- let default_only_switch = nested_router_reconvergence_graph("switch", &["default"]);- assert!(engine_compatibility_errors(&default_only_switch).is_empty());-- let missing_switch_default =- nested_router_reconvergence_graph("switch", &["known-case", "other-case"]);- let errors = engine_compatibility_errors(&missing_switch_default);- assert!(!errors.is_empty());- assert!(errors- .iter()- .all(|error| error.code == UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN));- // Both the switch's own reconvergence and the downstream merge are unsafe;- // multiple switch ports may also report the same predecessor. Pin the- // affected fan-ins without coupling the test to diagnostic multiplicity.- assert!(errors- .iter()- .any(|error| error.node_id.as_deref() == Some("a")));- assert!(errors- .iter()- .any(|error| error.node_id.as_deref() == Some("m")));-}--#[test]-fn engine_compatibility_rejects_reconvergence_before_nested_router() {- let graph = structurally_valid_graph(json!({- "name": "reconverged-before-nested-router",- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "outer", "kind": "condition", "name": "Outer", "config": { "field": "outer" } },- { "id": "inner", "kind": "condition", "name": "Inner", "config": { "field": "inner" } },- { "id": "a", "kind": "output_parser", "name": "A" },- { "id": "inner_else", "kind": "output_parser", "name": "Inner else" },- { "id": "c", "kind": "output_parser", "name": "C" },- { "id": "m", "kind": "merge", "name": "Merge" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "outer" },- { "from_node": "start", "from_port": "main", "to_node": "c" },- { "from_node": "outer", "from_port": "true", "to_node": "inner" },- { "from_node": "outer", "from_port": "false", "to_node": "inner" },- { "from_node": "inner", "from_port": "true", "to_node": "a" },- { "from_node": "inner", "from_port": "false", "to_node": "inner_else" },- { "from_node": "a", "from_port": "main", "to_node": "m" },- { "from_node": "c", "from_port": "main", "to_node": "m" }- ]- }));- let errors = engine_compatibility_errors(&graph);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN);-}--#[test]-fn engine_compatibility_treats_single_wired_router_outputs_as_conditional() {- let graph = structurally_valid_graph(json!({- "name": "single-wired-nested-router-fan-in",- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "outer", "kind": "switch", "name": "Outer", "config": { "field": "outer" } },- { "id": "inner", "kind": "condition", "name": "Inner", "config": { "field": "inner" } },- { "id": "a", "kind": "output_parser", "name": "A" },- { "id": "c", "kind": "output_parser", "name": "C" },- { "id": "m", "kind": "merge", "name": "Merge" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "outer" },- { "from_node": "start", "from_port": "main", "to_node": "c" },- { "from_node": "outer", "from_port": "case", "to_node": "inner" },- { "from_node": "inner", "from_port": "true", "to_node": "a" },- { "from_node": "a", "from_port": "main", "to_node": "m" },- { "from_node": "c", "from_port": "main", "to_node": "m" }- ]- }));-- let errors = engine_compatibility_errors(&graph);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN);- assert_eq!(errors[0].node_id.as_deref(), Some("m"));-}--#[test]-fn engine_compatibility_detects_a_router_directly_preceding_fan_in() {- let nested = structurally_valid_graph(json!({- "name": "direct-nested-router-fan-in",- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "outer", "kind": "switch", "name": "Outer", "config": { "field": "outer" } },- { "id": "inner", "kind": "condition", "name": "Inner", "config": { "field": "inner" } },- { "id": "c", "kind": "output_parser", "name": "C" },- { "id": "m", "kind": "merge", "name": "Merge" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "outer" },- { "from_node": "start", "from_port": "main", "to_node": "c" },- { "from_node": "outer", "from_port": "case", "to_node": "inner" },- { "from_node": "inner", "from_port": "true", "to_node": "m" },- { "from_node": "c", "from_port": "main", "to_node": "m" }- ]- }));- let errors = engine_compatibility_errors(&nested);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN);-- let main_port = structurally_valid_graph(json!({- "name": "direct-main-port-router-fan-in",- "nodes": [- { "id": "start", "kind": "trigger", "name": "Trigger" },- { "id": "route", "kind": "switch", "name": "Route", "config": { "field": "kind" } },- { "id": "c", "kind": "output_parser", "name": "C" },- { "id": "m", "kind": "merge", "name": "Merge" }- ],- "edges": [- { "from_node": "start", "from_port": "main", "to_node": "route" },- { "from_node": "start", "from_port": "main", "to_node": "c" },- { "from_node": "route", "from_port": "main", "to_node": "m" },- { "from_node": "c", "from_port": "main", "to_node": "m" }- ]- }));- let errors = engine_compatibility_errors(&main_port);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_MAIN_PORT_CONDITIONAL_FAN_IN);-}--#[test]-fn engine_compatibility_recurses_through_nested_inline_sub_workflows() {- let unsafe_child = nested_conditional_fan_in_graph();- let middle = json!({- "nodes": [- { "id": "middle-trigger", "kind": "trigger", "name": "Trigger" },- {- "id": "inner-child",- "kind": "sub_workflow",- "name": "Inner child",- "config": { "workflow": unsafe_child }- }- ],- "edges": [- { "from_node": "middle-trigger", "from_port": "main", "to_node": "inner-child" }- ]- });- let parent = structurally_valid_graph(json!({- "nodes": [- { "id": "parent-trigger", "kind": "trigger", "name": "Trigger" },- {- "id": "middle-child",- "kind": "sub_workflow",- "name": "Middle child",- "config": { "workflow": middle }- }- ],- "edges": [- { "from_node": "parent-trigger", "from_port": "main", "to_node": "middle-child" }- ]- }));-- let errors = engine_compatibility_errors(&parent);- assert_eq!(errors.len(), 1);- assert_eq!(errors[0].code, UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN);- assert!(errors[0].message.contains("middle-child"));- assert!(errors[0].message.contains("inner-child"));-}-#[test]fn resolver_lookup_rejects_an_incompatible_saved_child() {let tmp = TempDir::new().unwrap();diff --git a/crates/openhuman-core/src/flows/ops_resume_checkpoint_tests.rs b/crates/openhuman-core/src/flows/ops_resume_checkpoint_tests.rsindex 2f39d88c33..8d78931acd 100644--- a/crates/openhuman-core/src/flows/ops_resume_checkpoint_tests.rs+++ b/crates/openhuman-core/src/flows/ops_resume_checkpoint_tests.rs@@ -118,29 +118,14 @@ async fn flows_resume_allows_a_legacy_row_with_null_graph_hash() {assert_eq!(resumed.value["pending_approvals"], json!([]));}-/// `compute_graph_hash` must hash graph *content*, not incidental JSON object-/// key order. Node `config` is a free-form `serde_json::Value` (see-/// `tinyflows::model::Node::config`), and this crate has the `preserve_order`-/// feature active transitively — `Value`'s object map keeps insertion order-/// rather than sorting automatically — so two structurally-identical graphs-/// built with the same config keys in a different order would hash-/// differently without the canonicalization `compute_graph_hash` applies.+/// The stale-approval pin is a persisted format. The algorithm and its+/// key-order / `require_approval` properties are tested in `tinyflows-catalog`;+/// this pins the same digests in the host build, where `serde_json` has+/// `preserve_order` active, so a feature-unification change cannot silently+/// invalidate every parked run's pin.#[test]-fn graph_hash_is_stable_across_serialization_key_order() {- let graph_a = structurally_valid_graph(json!({- "name": "order-test",- "nodes": [- { "id": "t", "kind": "trigger", "name": "Trigger" },- {- "id": "n",- "kind": "output_parser",- "name": "N",- "config": { "a": 1, "b": 2, "nested": { "x": 1, "y": 2 } }- }- ],- "edges": [ { "from_node": "t", "to_node": "n" } ]- }));- let graph_b = structurally_valid_graph(json!({+fn graph_hash_matches_the_persisted_vector_under_preserve_order() {+ let graph = structurally_valid_graph(json!({"name": "order-test","nodes": [{ "id": "t", "kind": "trigger", "name": "Trigger" },@@ -153,34 +138,13 @@ fn graph_hash_is_stable_across_serialization_key_order() {],"edges": [ { "from_node": "t", "to_node": "n" } ]}));-- let hash_a = compute_graph_hash(&graph_a, false).expect("graph_a should hash");- let hash_b = compute_graph_hash(&graph_b, false).expect("graph_b should hash");assert_eq!(- hash_a, hash_b,- "the same graph content in a different key order must hash identically"+ compute_graph_hash(&graph, false).as_deref(),+ Some("33ff2f572641fba1b81c6726161314f8a9e725a6b8c33a0a119cbe0564b57ad2"));-- // Sanity: an actually-different graph must NOT collide.- let mut graph_c_value = json!({- "name": "order-test",- "nodes": [- { "id": "t", "kind": "trigger", "name": "Trigger" },- {- "id": "n",- "kind": "output_parser",- "name": "N",- "config": { "a": 1, "b": 2, "nested": { "x": 1, "y": 2 } }- }- ],- "edges": [ { "from_node": "t", "to_node": "n" } ]- });- graph_c_value["nodes"][1]["config"]["a"] = json!(999);- let graph_c = structurally_valid_graph(graph_c_value);- let hash_c = compute_graph_hash(&graph_c, false).expect("graph_c should hash");- assert_ne!(- hash_a, hash_c,- "a genuinely different graph must not collide"+ assert_eq!(+ compute_graph_hash(&graph, true).as_deref(),+ Some("a13666dfbcff29a5509b0ee4d0bc50199b47eb11cb32f5ba2b00c7ae626cd179"));}