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
test(flows): cover builder tools, store, and tinyflows state
Steven Enamakelafa27a7dde30
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 0e8586c8cb..23d6270037 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@@ -390,7 +390,8 @@ async fn edit_workflow_surfaces_draft_write_back_failure() {// Updating a draft document aborts; creating, reading and listing do not,// so the draft loads and only the write-back fails.let conn =- crate::storage::rusqlite::Connection::open(crate::flows::store::db_path(&config)).unwrap();+ crate::storage::rusqlite::Connection::open(config.workspace_dir.join("storage/storage.db"))+ .unwrap();let docs_table: String = conn.query_row("SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE '%\\_tsd\\_docs' ESCAPE '\\'",diff --git a/crates/openhuman-core/src/flows/store_tests.rs b/crates/openhuman-core/src/flows/store_tests.rsindex 9e05db84af..fbd2b316a3 100644--- a/crates/openhuman-core/src/flows/store_tests.rs+++ b/crates/openhuman-core/src/flows/store_tests.rs@@ -1,5 +1,5 @@//! The catalog's storage and the import of the files tinyflows used to write-//! (`flows.db`, `checkpoints.db`, `drafts/*.json`) on first use.+//! (`flows.db`, `checkpoints.db`, `drafts/*.json`) by the storage importer.use super::*;use tempfile::TempDir;@@ -30,23 +30,27 @@ fn config(tmp: &TempDir) -> Config {}#[test]-fn the_catalog_lives_in_its_own_workspace_database() {+fn the_catalog_lives_in_the_workspace_default_database() {let tmp = TempDir::new().unwrap();let config = config(&tmp);assert!(crate::storage::installed().is_none());assert!(list_flows(&config).unwrap().0.is_empty());- assert_eq!(db_path(&config), tmp.path().join("flows/catalog.db"));- assert!(db_path(&config).is_file());+ assert!(tmp.path().join("storage/storage.db").is_file());}#[test]-fn legacy_flows_drafts_and_checkpoints_are_imported_on_first_use_and_left_untouched() {+fn legacy_flows_drafts_and_checkpoints_are_imported_and_left_untouched() {let tmp = TempDir::new().unwrap();let config = config(&tmp);copy_tree(&fixture_workspace(), tmp.path());let flows_db = dir(&config).join("flows.db");let before = std::fs::read(&flows_db).unwrap();+ let backend = crate::storage::local::backend_for(&config.workspace_dir).unwrap();+ for report in crate::storage::import::tinyflows::run_with(&backend, &config) {+ report.outcome.unwrap();+ }+let (flows, _) = list_flows(&config).unwrap();let mut ids: Vec<_> = flows.iter().map(|flow| flow.id.clone()).collect();ids.sort();@@ -78,6 +82,8 @@ fn legacy_flows_drafts_and_checkpoints_are_imported_on_first_use_and_left_untouc// Imported once: a flow removed afterwards stays removed after a restart.remove_flow(&config, "flow-alpha").unwrap();- crate::storage::local::forget(&db_path(&config));+ for report in crate::storage::import::tinyflows::run_with(&backend, &config) {+ report.outcome.unwrap();+ }assert_eq!(list_flows(&config).unwrap().0.len(), 1);}diff --git a/crates/openhuman-core/src/flows/tinyflows/state_tests.rs b/crates/openhuman-core/src/flows/tinyflows/state_tests.rsindex 4e4f168972..ae4abbc0e7 100644--- a/crates/openhuman-core/src/flows/tinyflows/state_tests.rs+++ b/crates/openhuman-core/src/flows/tinyflows/state_tests.rs@@ -64,7 +64,7 @@ async fn an_unresolved_scope_fails_every_call() {}#[test]-fn without_a_backend_the_flow_state_is_on_the_workspace_database() {+fn without_a_backend_the_flow_state_is_in_the_workspace_default_database() {let dir = tempfile::tempdir().unwrap();let config = Config {workspace_dir: dir.path().to_path_buf(),@@ -76,5 +76,5 @@ fn without_a_backend_the_flow_state_is_on_the_workspace_database() {FlowState::open(&config, "flow:a"),FlowState::Documents(_)));- assert!(crate::flows::store::db_path(&config).is_file());+ assert!(config.workspace_dir.join("storage/storage.db").is_file());}