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
style: apply rustfmt formatting across storage and cron tests
Steven Enamakel3bc8d30e1342
diff --git a/crates/openhuman-core/src/cron/store.rs b/crates/openhuman-core/src/cron/store.rsindex a0cef622d4..ec89293d57 100644--- a/crates/openhuman-core/src/cron/store.rs+++ b/crates/openhuman-core/src/cron/store.rs@@ -48,8 +48,10 @@ fn documents(config: &Config) -> Result<CronDocuments> {config,&|backend, scope, config| legacy_import(backend, scope, config),)?;- Ok(CronDocuments::new(std::sync::Arc::clone(opened.scoped()?.documents()))- .with_limits(config.cron.max_run_history, config.scheduler.max_tasks))+ Ok(+ CronDocuments::new(std::sync::Arc::clone(opened.scoped()?.documents()))+ .with_limits(config.cron.max_run_history, config.scheduler.max_tasks),+ )}/// Brings `jobs.db` into a freshly opened per-store database (the defaultdiff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rsindex 41aaf5bfd0..6fa33ff4aa 100644--- a/crates/openhuman-core/src/cron/store_tests.rs+++ b/crates/openhuman-core/src/cron/store_tests.rs@@ -143,8 +143,14 @@ fn a_legacy_jobs_db_is_imported_on_first_use_and_left_untouched() {let jobs = list_jobs(&config).unwrap();assert_eq!(jobs.len(), 3);assert!(jobs.iter().any(|job| job.name.as_deref() == Some("inbox")));- assert!(find_flow_schedule_job(&config, "flow-beta").unwrap().is_some());- assert_eq!(std::fs::read(&legacy).unwrap(), before, "jobs.db was modified");+ assert!(find_flow_schedule_job(&config, "flow-beta")+ .unwrap()+ .is_some());+ assert_eq!(+ std::fs::read(&legacy).unwrap(),+ before,+ "jobs.db was modified"+ );// Imported once: a job removed afterwards stays removed.let inbox = jobsdiff --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 7bc217a3b8..0e8586c8cb 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@@ -414,7 +414,6 @@ async fn edit_workflow_surfaces_draft_write_back_failure() {.await.unwrap();-assert!(result.is_error, "{}", result.output());assert!(!result.output().contains("Edits live on draft"),diff --git a/crates/openhuman-core/src/flows/store_tests.rs b/crates/openhuman-core/src/flows/store_tests.rsindex f7d56373ec..a6340676ff 100644--- a/crates/openhuman-core/src/flows/store_tests.rs+++ b/crates/openhuman-core/src/flows/store_tests.rs@@ -51,9 +51,17 @@ fn legacy_flows_drafts_and_checkpoints_are_imported_on_first_use_and_left_untouclet mut ids: Vec<_> = flows.iter().map(|flow| flow.id.clone()).collect();ids.sort();assert_eq!(ids, ["flow-alpha", "flow-beta"]);- assert_eq!(super::super::draft_store::list_drafts(&config).unwrap().len(), 2);+ assert_eq!(+ super::super::draft_store::list_drafts(&config)+ .unwrap()+ .len(),+ 2+ );assert_eq!(list_revisions(&config, "flow-alpha", 10).unwrap().len(), 2);- assert_eq!(get_flow_run(&config, "run-done").unwrap().unwrap().flow_id, "flow-alpha");+ assert_eq!(+ get_flow_run(&config, "run-done").unwrap().unwrap().flow_id,+ "flow-alpha"+ );use tinyflows::engine::Checkpointer;let checkpointer = crate::flows::tinyflows::open_flow_checkpointer(&config).unwrap();diff --git a/crates/openhuman-core/src/flows/tinyflows/state_tests.rs b/crates/openhuman-core/src/flows/tinyflows/state_tests.rsindex a38c73f5d4..4e4f168972 100644--- a/crates/openhuman-core/src/flows/tinyflows/state_tests.rs+++ b/crates/openhuman-core/src/flows/tinyflows/state_tests.rs@@ -8,9 +8,7 @@ fn documents(namespace: &str) -> FlowState {}fn documents_on(storage: &MemoryStorage, namespace: &str) -> FlowState {- let scoped = storage- .for_scope(&Scope::new("local").unwrap())- .unwrap();+ let scoped = storage.for_scope(&Scope::new("local").unwrap()).unwrap();FlowState::Documents(FlowStateDocuments::new(FlowCatalogDocuments::new(Arc::clone(scoped.documents())),namespace,diff --git a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_tests.rsindex 2bf4cc841a..0ff4d5d249 100644--- a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs+++ b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs@@ -4,9 +4,9 @@ use serde_json::Value;use sha2::Digest;use std::collections::BTreeMap;use tempfile::TempDir;+use tinyflows::engine::Checkpointer;use tinyflows_drivers::catalog::FlowCatalogDocuments;use tinyflows_drivers::schedule::CronDocuments;-use tinyflows::engine::Checkpointer;use tinyflows_drivers::DriverCheckpointer;fn fixtures() -> PathBuf {@@ -159,8 +159,7 @@ fn flow_checkpoints_come_across_with_their_lineage() {let backend = backend();import_flows(&backend, &Scope::local(), &config).unwrap();- let checkpointer =- DriverCheckpointer::<Value>::new(documents(&backend, &Scope::local()));+ let checkpointer = DriverCheckpointer::<Value>::new(documents(&backend, &Scope::local()));let expected = expected()["checkpoints"].clone();crate::storage::block_on_anyhow(async move {for thread in ["run-1", "Run Two/Upper"] {@@ -279,10 +278,9 @@ fn an_import_runs_once_and_does_not_resurrect_a_deleted_flow() {let again = import_flows(&backend, &Scope::local(), &config).unwrap();assert_eq!(again, Outcome::AlreadyDone);- let still = crate::storage::block_on_anyhow(async move {- Ok(catalog.list_flows().await?.0.len())- })- .unwrap();+ let still =+ crate::storage::block_on_anyhow(async move { Ok(catalog.list_flows().await?.0.len()) })+ .unwrap();assert_eq!(still, 1, "the legacy flow came back");}@@ -360,15 +358,14 @@ fn an_agents_cron_database_lands_in_that_agents_scope() {let (dir, config) = workspace();let agent_dir = dir.path().join("agents").join("alpha");std::fs::create_dir_all(agent_dir.join("cron")).unwrap();- std::fs::copy(- legacy_jobs_db(dir.path()),- legacy_jobs_db(&agent_dir),- )- .unwrap();+ std::fs::copy(legacy_jobs_db(dir.path()), legacy_jobs_db(&agent_dir)).unwrap();let backend = backend();let reports = run_with(&backend, &config);- assert!(reports.iter().all(|report| report.outcome.is_ok()), "{reports:?}");+ assert!(+ reports.iter().all(|report| report.outcome.is_ok()),+ "{reports:?}"+ );let count = |scope: Scope| {let cron = CronDocuments::new(documents(&backend, &scope));diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rsindex 5717ba34c3..a024cbdd54 100644--- a/crates/openhuman-core/src/storage/local.rs+++ b/crates/openhuman-core/src/storage/local.rs@@ -298,8 +298,8 @@ pub fn open_standing(import: StandingImport<'_>,) -> Result<Opened> {if let Some(backend) = installed() {- let scope = current_scope()- .with_context(|| format!("[{domain}] resolve the storage scope"))?;+ let scope =+ current_scope().with_context(|| format!("[{domain}] resolve the storage scope"))?;return Ok(Opened { backend, scope });}if crate::core::runtime::mode::is_saas() {diff --git a/tests/storage_flows_e2e.rs b/tests/storage_flows_e2e.rsindex 52508e663b..9c70668785 100644--- a/tests/storage_flows_e2e.rs+++ b/tests/storage_flows_e2e.rs@@ -99,7 +99,10 @@ async fn a_configured_backend_holds_cron_flows_and_flow_state(case: Case) {};policy::set_policy(&policy_config, &job.id, wanted).unwrap();assert_eq!(policy::get_policy(&policy_config, &job.id).unwrap(), wanted);- assert_eq!(cron::get_job(&policy_config, &job.id).unwrap().policy, wanted);+ assert_eq!(+ cron::get_job(&policy_config, &job.id).unwrap().policy,+ wanted+ );policy::clear_policy(&policy_config, &job.id).unwrap();assert_eq!(policy::get_policy(&policy_config, &job.id).unwrap(),@@ -144,7 +147,6 @@ async fn a_configured_backend_holds_cron_flows_and_flow_state(case: Case) {assert!(workspace.path().join("graph_checkpoints.db").exists());}-/// The stores tinyflows used to write (`jobs.db`, `flows.db`, `checkpoints.db`,/// `drafts/`) are copied into a configured backend by the boot-time import,/// read-only: the legacy files are byte-identical afterwards.@@ -183,7 +185,11 @@ async fn legacy_tinyflows_files_are_imported_into_a_configured_backend(case: Casfor report in openhuman_core::storage::import::run(&config).await {report.outcome.unwrap();}- assert_eq!(digest(workspace.path()), before, "a legacy file was modified");+ assert_eq!(+ digest(workspace.path()),+ before,+ "a legacy file was modified"+ );}fn copy_tree(from: &std::path::Path, to: &std::path::Path) {diff --git a/tests/support/cron_policy_failure.rs b/tests/support/cron_policy_failure.rsindex 0f9989aa29..2353ce77d9 100644--- a/tests/support/cron_policy_failure.rs+++ b/tests/support/cron_policy_failure.rs@@ -320,16 +320,12 @@ pub(super) async fn policy_reads_refuse_execution_without_consuming_a_slot(case:.unwrap();}).await;- let before = CoreContext::scope(Arc::clone(&alpha), async {- next_run_of(&config, &job.id)- })- .await;+ let before =+ CoreContext::scope(Arc::clone(&alpha), async { next_run_of(&config, &job.id) }).await;faults.read.store(true, Ordering::SeqCst);cron::scheduler::run_live_agent_pass(1).await;- let after = CoreContext::scope(Arc::clone(&alpha), async {- next_run_of(&config, &job.id)- })- .await;+ let after =+ CoreContext::scope(Arc::clone(&alpha), async { next_run_of(&config, &job.id) }).await;let scheduled_calls = calls.load(Ordering::SeqCst);let mut agent_job = job.clone();agent_job.job_type = cron::JobType::Agent;