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): reorganize test files and remove duplicate test modules
Steven Enamakelc2091776fc69
diff --git a/crates/openhuman-core/src/flows/import_tests.rs b/crates/openhuman-core/src/flows/import_tests.rsdeleted file mode 100644index 61ab202a87..0000000000--- a/crates/openhuman-core/src/flows/import_tests.rs+++ /dev/null@@ -1,11 +0,0 @@-//! Host-side coverage for the n8n importer, for the one property the crate-//! cannot assert on its own.-//!-//! `tinyflows_catalog::import::n8n` tests its own mapping. What it cannot test-//! is that an imported graph then clears *this host's* gates: an import that-//! produced a graph `propose_workflow` / `revise_workflow` / `save_workflow`-//! would refuse is a broken import even though every mapping assertion passed.--#[cfg(test)]-#[path = "import_tests_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/flows/import_tests_tests.rs b/crates/openhuman-core/src/flows/import_tests_tests.rsdeleted file mode 100644index 87bc574ad7..0000000000--- a/crates/openhuman-core/src/flows/import_tests_tests.rs+++ /dev/null@@ -1,75 +0,0 @@-use serde_json::json;-use tinyflows_catalog::import::n8n::map_n8n_workflow;--/// Imports a small n8n fixture that uses `$json` bindings end-to-end-/// through the exact same path `ops::flows_import` takes (map →-/// re-serialize → `validate_and_migrate_graph`), then runs the imported-/// graph through the domain's own binding-resolvability hard gate-/// (`ops::validate_binding_resolvability`, the same gate-/// `propose_workflow`/`revise_workflow`/`save_workflow` enforce before-/// accepting ANY graph — see `ops.rs`'s "Enforcing binding-resolvability-/// gate" section) and confirms it is accepted with zero errors, exactly-/// as `ops_tests.rs`'s `binding_to_agent_with_matching_schema_is_accepted`-/// exercises the gate for a hand-authored graph.-#[test]-fn imported_json_bindings_pass_binding_resolvability_and_resolve_the_real_item() {- use crate::flows::ops::{validate_and_migrate_graph, validate_binding_resolvability};-- let wf = json!({- "name": "json-binding-import",- "nodes": [- { "id": "t", "name": "Webhook", "type": "n8n-nodes-base.webhook" },- { "id": "h", "name": "Notify", "type": "n8n-nodes-base.httpRequest",- "parameters": {- "url": "={{ $json.callback_url }}",- "requestMethod": "POST"- } }- ],- "connections": {- "Webhook": { "main": [[{ "node": "Notify", "type": "main", "index": 0 }]] }- }- });-- let mapped = map_n8n_workflow(&wf).expect("map");- // No warning for the `$json.callback_url` binding — it's the trivial- // translatable case.- assert!(- !mapped- .warnings- .iter()- .any(|w| w.contains("callback_url") || w.contains("not automatically translated")),- "{:?}",- mapped.warnings- );-- let http_node = mapped.graph.node("h").expect("http node");- assert_eq!(http_node.config["url"], json!("=.item.callback_url"));-- // Re-enter the same migrate + validate path `flows_import` uses.- let value = serde_json::to_value(&mapped.graph).expect("serialize graph");- let graph = validate_and_migrate_graph(value).expect("imported graph is structurally valid");-- // The domain's hard binding-resolvability gate accepts the imported- // graph — the same gate a hand-authored graph must clear before- // `propose_workflow`/`save_workflow` will accept it.- assert!(- validate_binding_resolvability(&graph).is_empty(),- "{:?}",- validate_binding_resolvability(&graph)- );-- // The direct proof this whole importer exists to guarantee: the- // translated binding actually resolves the real upstream item field- // at runtime, evaluated against a scope shaped like the tinyflows- // engine's real `expr_scope_for` — NOT null, which is exactly what- // the pre-fix `=.callback_url` translation would have produced.- let http_node = graph.node("h").expect("http node");- let scope = json!({- "item": { "callback_url": "https://example.com/hook" },- "items": [{ "callback_url": "https://example.com/hook" }],- "run": {},- "nodes": {},- });- let resolved = tinyflows::expr::evaluate(&http_node.config["url"], &scope);- assert_eq!(resolved, json!("https://example.com/hook"));-}diff --git a/crates/openhuman-core/src/flows/mod.rs b/crates/openhuman-core/src/flows/mod.rsindex 76ac693aec..75851b30f5 100644--- a/crates/openhuman-core/src/flows/mod.rs+++ b/crates/openhuman-core/src/flows/mod.rs@@ -30,9 +30,6 @@ pub mod bus;pub mod catalogue;pub mod discovery_tools;mod draft_store;-#[cfg(test)]-#[path = "import_tests.rs"]-mod import_tests;pub mod memory_tools;pub mod node_contracts;pub mod ops;diff --git a/crates/openhuman-core/src/flows/ops_migration_and_side_effect_tests.rs b/crates/openhuman-core/src/flows/ops_migration_and_side_effect_tests.rsindex 8fe4840cec..b60c839e6a 100644--- a/crates/openhuman-core/src/flows/ops_migration_and_side_effect_tests.rs+++ b/crates/openhuman-core/src/flows/ops_migration_and_side_effect_tests.rs@@ -30,33 +30,6 @@ async fn flows_discover_applies_the_flow_discovery_definitions_effective_iteratiassert_eq!(agent.agent_config().max_tool_iterations, expected);}-#[test]-fn validate_and_migrate_graph_rejects_condition_edges_with_branch_label_on_to_port() {- // The exact malformed shape the workflow_builder agent produced live- // (see issue B23): both edges share `from_port: "main"` with the branch- // label on `to_port` instead. The engine routes exclusively on- // `from_port` (B24, `tinyflows::validate`), so this must be a hard- // reject here — never persisted as a silently-broken no-op condition.- let bad_graph = condition_graph("main", "true", "main", "false");-- let err = validate_and_migrate_graph(bad_graph)- .expect_err("condition edges with the branch label on to_port must be rejected");- assert!(- err.contains("condition") && err.contains("from_port"),- "expected an InvalidConditionRouting-style error naming from_port, got: {err}"- );-}--#[test]-fn validate_and_migrate_graph_accepts_condition_edges_with_branch_label_on_from_port() {- // The correct shape: `from_port` carries "true"/"false", `to_port` stays- // "main".- let good_graph = condition_graph("true", "main", "false", "main");-- validate_and_migrate_graph(good_graph)- .expect("correctly-routed condition graph (branch label on from_port) must validate");-}-#[tokio::test]async fn flows_create_rejects_condition_edges_with_branch_label_on_to_port() {// The same hard gate applies at the actual persistence path@@ -354,48 +327,6 @@ async fn flows_update_does_not_force_require_approval_on_readonly_graph() {// ── graph_has_outbound_side_effect / trigger_is_automatic helper tests ────-#[test]-fn graph_has_outbound_side_effect_detects_tool_call() {- let g = graph(tool_call_graph());- assert!(graph_has_outbound_side_effect(&g));-}--#[test]-fn graph_has_outbound_side_effect_detects_http_request() {- let g = graph(http_request_graph());- assert!(graph_has_outbound_side_effect(&g));-}--#[test]-fn graph_has_outbound_side_effect_detects_code() {- let g = graph(code_graph());- assert!(graph_has_outbound_side_effect(&g));-}--#[test]-fn graph_has_outbound_side_effect_false_for_agent_only() {- let g = graph(readonly_graph());- assert!(!graph_has_outbound_side_effect(&g));-}--#[test]-fn trigger_is_automatic_schedule() {- let g = graph(schedule_trigger_graph("0 9 * * *"));- assert!(trigger_is_automatic(&g));-}--#[test]-fn trigger_is_automatic_manual() {- let g = graph(manual_trigger_graph());- assert!(!trigger_is_automatic(&g));-}--#[test]-fn trigger_is_automatic_no_trigger_kind() {- let g = graph(trigger_only_graph());- assert!(!trigger_is_automatic(&g));-}-#[tokio::test]async fn strict_gate_passes_a_valid_graph_and_rejects_a_structurally_invalid_one() {let config = Config::default();diff --git a/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs b/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rsindex 41ebc161c1..113cfbf4d2 100644--- a/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs+++ b/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs@@ -164,37 +164,6 @@ fn agent_prompt_binding_unaffected() {assert!(validate_binding_resolvability(&g).is_empty());}-#[test]-fn finalize_terminal_status_pending_approval_wins_over_error() {- // Precedence: an outstanding pending_approval always wins, even if a step- // also settled with an error — mirrors degrade_completed_status's own- // precedence rule, now centralized in finalize_terminal_status.- let mut errored = clean_step("a");- errored.status = Some("error".to_string());- let steps = vec![errored];- let (status, error) = finalize_terminal_status(&steps, &["gate".to_string()]);- assert_eq!(status, "pending_approval");- assert_eq!(error, None);-}--#[test]-fn finalize_terminal_status_populates_error_on_degraded_failure() {- let mut errored = clean_step("x");- errored.status = Some("error".to_string());- let steps = vec![errored];- let (status, error) = finalize_terminal_status(&steps, &[]);- assert_eq!(status, "failed");- assert!(error.unwrap().contains('x'));-}--#[test]-fn finalize_terminal_status_no_error_when_clean() {- let steps = vec![clean_step("a")];- let (status, error) = finalize_terminal_status(&steps, &[]);- assert_eq!(status, "completed");- assert_eq!(error, None);-}-/// Regression for issue #4593 (widened for #4881's `resume_flow_run`//// `cancel_flow_run` addition to the belt): the `flows_build` builder turn/// runs under `AgentTurnOrigin::Cli`, which makes the `ApprovalGate`diff --git a/crates/openhuman-core/src/flows/tinyflows/checkpoint_compat_tests.rs b/crates/openhuman-core/src/flows/tinyflows/checkpoint_compat_tests.rsdeleted file mode 100644index 911db20cf3..0000000000--- a/crates/openhuman-core/src/flows/tinyflows/checkpoint_compat_tests.rs+++ /dev/null@@ -1,12 +0,0 @@-//! Equivalence coverage between the flow-run checkpoint store and the-//! `tinyagents` backend it was ported from.-//!-//! This lives here rather than in `tinyflows-sqlite` for one reason: it is the-//! only place both crates are present. The store is a *port*, not a rewrite —-//! an existing `<workspace>/flows/checkpoints.db` is read and written by it-//! after the upgrade — and this host is the one that has to keep both halves of-//! that promise, so it is the one that owns the proof.--#[cfg(test)]-#[path = "checkpoint_compat_tests_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/flows/tinyflows/checkpoint_compat_tests_tests.rs b/crates/openhuman-core/src/flows/tinyflows/checkpoint_compat_tests_tests.rsdeleted file mode 100644index 32a200f2ae..0000000000--- a/crates/openhuman-core/src/flows/tinyflows/checkpoint_compat_tests_tests.rs+++ /dev/null@@ -1,91 +0,0 @@-use serde_json::json;-use tempfile::TempDir;-use tinyflows::graph::ids::NodeId;-use tinyflows::graph::Checkpointer;-use tinyflows_sqlite::checkpoint::SqliteCheckpointer;--/// The reason this file exists. The port is a retarget of the backend-/// `tinyagents` shipped, and an existing `<workspace>/flows/checkpoints.db`-/// written by that backend is read and written by this code after the-/// upgrade; a divergence would surface as an interrupted flow that cannot-/// resume — at the worst possible moment, on a user's machine, with the run-/// already half-done.-///-/// The two schemas were byte-identical at the port. `tinyagents-graph` has-/// since grown its own copy (a `format_version` / `created_at` column pair and-/// a `thread_leases` table for its execution leases), so byte-equality is no-/// longer the contract. What still must hold is that every table and index-/// the ported schema creates is also created, with the same name, by the-/// backend it replaced — the ported reader only ever touches those.-#[test]-fn ported_schema_objects_all_exist_in_the_backend_it_replaced() {- let ported = SqliteCheckpointer::<serde_json::Value>::schema_sql();- let backend = tinyagents_graph::SqliteCheckpointer::<serde_json::Value>::schema_sql();- let objects = |ddl: &str| -> Vec<String> {- ddl.lines()- .map(str::trim)- .filter(|line| line.starts_with("CREATE "))- .map(|line| {- line.split_whitespace()- .skip_while(|word| *word != "EXISTS")- .nth(1)- .unwrap_or_default()- .to_string()- })- .collect()- };- let ported_objects = objects(&ported);- let backend_objects = objects(&backend);- assert!(- !ported_objects.is_empty(),- "no CREATE statements parsed from:\n{ported}"- );- for object in &ported_objects {- assert!(- backend_objects.contains(object),- "the ported schema creates `{object}`, which the tinyagents backend that \- wrote every checkpoints.db in the field does not — an existing database \- would stop resuming"- );- }-}--/// A database written by the backend this replaced must be readable here, and-/// the schema check above is a statement about DDL rather than about-/// behaviour. This writes through the old type and reads back through the new-/// one, against one file.-#[tokio::test]-async fn reads_a_database_written_by_the_previous_backend() {- let tmp = TempDir::new().unwrap();- let db = tmp.path().join("checkpoints.db");-- // Fully qualified: the two `Checkpointer` traits share a method set, so- // importing both here would make every call in this file ambiguous.- use tinyagents_graph::Checkpointer as LegacyCheckpointer;-- let old = tinyagents_graph::SqliteCheckpointer::<serde_json::Value>::open(&db).unwrap();- // Built through the constructor rather than a struct literal: the- // upstream record keeps growing bookkeeping fields (channel versions,- // barrier arrivals, ...) and this test only cares about the columns the- // ported reader must still decode.- let mut written = tinyagents_graph::Checkpoint::new(json!({ "counter": 7 }), Vec::new())- .with_thread_id("flow:f1:run-a")- .with_checkpoint_id("cp-1");- written.run_id = Some("run-1".to_string());- written.next_nodes = vec![tinyagents_harness::ids::NodeId::new("next")];- written.completed_tasks = vec![tinyagents_harness::ids::NodeId::new("done")];- written.metadata = json!({ "source": "loop", "step": 3 });- LegacyCheckpointer::put(&old, written).await.unwrap();- drop(old);-- let new = SqliteCheckpointer::<serde_json::Value>::open(&db).unwrap();- let read = new- .get("flow:f1:run-a", None)- .await- .unwrap()- .expect("the pre-upgrade checkpoint must still load");- assert_eq!(read.checkpoint_id, "cp-1");- assert_eq!(read.state, json!({ "counter": 7 }));- assert_eq!(read.next_nodes, vec![NodeId::new("next")]);- assert_eq!(read.metadata["step"], 3);-}diff --git a/crates/openhuman-core/src/flows/tinyflows/mod.rs b/crates/openhuman-core/src/flows/tinyflows/mod.rsindex f9ce9cfcbc..a576aaddb9 100644--- a/crates/openhuman-core/src/flows/tinyflows/mod.rs+++ b/crates/openhuman-core/src/flows/tinyflows/mod.rs@@ -16,9 +16,6 @@//! [`langfuse_export::export_flow_run_trace`] after it settles.pub mod caps;-#[cfg(test)]-#[path = "checkpoint_compat_tests.rs"]-mod checkpoint_compat_tests;pub mod langfuse_export;pub mod memory_adapter;/// End-to-end coverage for the `memory` node through the REAL engine + realdiff --git a/vendor/tinyflows b/vendor/tinyflowsindex ae01e28939..b7c34cc307 160000--- a/vendor/tinyflows+++ b/vendor/tinyflows@@ -1 +1 @@-Subproject commit ae01e28939f75d474aa3ffb205cfd2ff924558ff+Subproject commit b7c34cc3075a0f15159bcd54cc54c0f7089a0c79