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(tests): add coverage for flow builder validation and tier gating
Steven Enamakel2e2ca8723305
diff --git a/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs b/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rsindex fa0a287c00..81f2c4825f 100644--- a/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs+++ b/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs@@ -365,14 +365,14 @@ async fn edit_workflow_edits_a_draft_and_writes_back() {assert_eq!(reloaded.graph["nodes"].as_array().unwrap().len(), 3);}-// T-m6: when the draft write-back itself fails (here: a genuine permission-// denial on the drafts dir, not a mock), the response must surface the-// failure instead of claiming "Edits live on draft {id}" — the exact-// wording that used to ship regardless of whether the write actually landed.-#[cfg(unix)]+// T-m6: when the draft write-back itself fails (here: a genuine write lock on+// the catalog database held by another connection, not a mock), the response+// must surface the failure instead of claiming "Edits live on draft {id}" —+// the exact wording that used to ship regardless of whether the write+// actually landed. Reads still work under the lock (WAL), so the draft loads+// and only the write-back fails, after the database's busy timeout.#[tokio::test]async fn edit_workflow_surfaces_draft_write_back_failure() {- use std::os::unix::fs::PermissionsExt;use tinyflows_catalog::DraftOrigin;let tmp = TempDir::new().unwrap();@@ -388,20 +388,9 @@ async fn edit_workflow_surfaces_draft_write_back_failure() {.unwrap().value;- // Force the final `flows_draft_update` write to genuinely fail: strip- // write permission from the drafts dir after the draft file already- // exists in it (create_dir_all is a no-op; the write of the new tmp- // file inside it is what fails).- let drafts_dir = config.workspace_dir.join("flows").join("drafts");- std::fs::set_permissions(&drafts_dir, std::fs::Permissions::from_mode(0o555)).unwrap();- let probe = drafts_dir.join(".write_probe");- let write_is_blocked = std::fs::write(&probe, b"x").is_err();- let _ = std::fs::remove_file(&probe);- if !write_is_blocked {- // Running as root — permissions are ignored, assertion is moot.- std::fs::set_permissions(&drafts_dir, std::fs::Permissions::from_mode(0o755)).unwrap();- return;- }+ let lock =+ crate::storage::rusqlite::Connection::open(crate::flows::store::db_path(&config)).unwrap();+ lock.execute_batch("BEGIN IMMEDIATE").unwrap();let tool = EditWorkflowTool::new(config.clone());let result = tool@@ -412,8 +401,7 @@ async fn edit_workflow_surfaces_draft_write_back_failure() {.await.unwrap();- // Restore so the tempdir can be cleaned up.- std::fs::set_permissions(&drafts_dir, std::fs::Permissions::from_mode(0o755)).unwrap();+ lock.execute_batch("ROLLBACK").unwrap();assert!(result.is_error, "{}", result.output());assert!(diff --git a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rsindex e3786ff756..d809724798 100644--- a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs+++ b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs@@ -545,7 +545,7 @@ async fn boot_sweep_handles_schema_init_failure_gracefully() {let warning = String::from_utf8(capture.0.lock().unwrap().clone()).unwrap();assert!(- warning.contains("Failed to create flows directory"),+ warning.contains("create the directory"),"the sweep warning must preserve the operation context, got {warning:?}");assert!(diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rsindex 6ed71619eb..83eda55ca2 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs@@ -499,14 +499,14 @@ async fn resolver_rejects_an_engine_incompatible_saved_graph() {{ "from_node": "c", "from_port": "main", "to_node": "m" }]});- let db = config.workspace_dir.join("flows").join("flows.db");- rusqlite::Connection::open(db)- .unwrap()- .execute(- "UPDATE flow_definitions SET graph_json = ?1 WHERE id = ?2",- rusqlite::params![unsafe_graph.to_string(), flow.id],- )- .unwrap();+ // Stage a stored graph no save path would accept: written raw, under the+ // flow's id, as a legacy row would be.+ crate::flows::store::force_corrupt_graph_json_for_test(+ &config,+ &flow.id,+ &unsafe_graph.to_string(),+ )+ .unwrap();let error = OpenHumanWorkflowResolver { config }.resolve(&flow.id)