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(storage): route import tests through storage facade
Steven Enamakel2825900718bc
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rsindex 945f5cd9e0..4bb78afb56 100644--- a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs@@ -2,6 +2,7 @@ use super::*;use crate::config::Config;use crate::storage::Scope;use crate::storage::test_support::memory_backend;+use crate::storage::state_kv::StateKv;use std::collections::BTreeMap;use std::sync::Arc;@@ -142,9 +143,8 @@ fn values_are_tsd_kv_entries_that_kv_itself_reads_and_updates_in_place() {assert_eq!(bumped, 2);let scoped = storage.for_scope(&Scope::local()).unwrap();- let kv = tinystoragedrivers::Kv::ns(scoped.documents(), "composio", "state").unwrap();- let read: Option<BTreeMap<String, u32>> =- crate::storage::block_on(async move { kv.get(path()).await }).unwrap();+ let kv = StateKv::over(&scoped, "composio", "state");+ let read: Option<BTreeMap<String, u32>> = kv.get(path()).unwrap();assert_eq!(read.unwrap()["gmail"], 2);}@@ -193,13 +193,8 @@ async fn v1_state_documents_move_into_kv_without_replacing_a_newer_value() {.await.unwrap();}- let kv = tinystoragedrivers::Kv::ns(raw, "composio", "state").unwrap();- for spec in tinystoragedrivers::primitives::collection_specs() {- raw.ensure_collection(&spec).await.unwrap();- }- kv.put("b.json", &serde_json::json!({ "n": 99 }))- .await- .unwrap();+ let kv = StateKv::over(&scoped, "composio", "state");+ kv.put("b.json", &serde_json::json!({ "n": 99 })).unwrap();assert_eq!(migrate_legacy_state(&scoped).await.unwrap(), 1);assert_eq!(diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rsindex 04b007af12..cdb44c450d 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs@@ -1,6 +1,7 @@use super::*;use crate::storage::test_support::memory_backend;use crate::storage::{Precondition, Storage, scope_for_module};+use serde_json::json;use sha2::Digest;fn scoped() -> Storage {diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rsindex 28780328c6..ca2c39f635 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs@@ -76,7 +76,7 @@ impl Rig {self.backend.for_scope(&self.scope).unwrap()}- fn secrets(&self) -> crate::storage::secrets::DocumentSecrets {+ fn secrets(&self) -> impl SecretStore {let scoped = self.scoped();crate::storage::secrets::over(&scoped, self.scope.clone(), keys())}diff --git a/crates/openhuman-core/src/storage/import/mod_tests.rs b/crates/openhuman-core/src/storage/import/mod_tests.rsindex 5881aafba9..0122661484 100644--- a/crates/openhuman-core/src/storage/import/mod_tests.rs+++ b/crates/openhuman-core/src/storage/import/mod_tests.rs@@ -7,7 +7,8 @@ use crate::storage::test_support::{SqliteBackend, sqlite_backend};use std::collections::BTreeMap;use std::ops::Deref;use tempfile::TempDir;-use tinystoragedrivers::{DocumentStoreExt, Query};+use crate::storage::DocumentStoreExt as _;+use tinystoragedrivers::Query;struct TestBackend(SqliteBackend);@@ -366,7 +367,8 @@ fn records_the_previous_release_wrote_as_documents_are_imported_and_win_over_leglet db = dir.path().join(source.db);{use tinystoragedrivers::StorageBackend as _;- let storage = tinystoragedrivers::sqlite::SqliteStorage::open(&db).unwrap();+ let url = format!("sqlite:{}", db.display());+ let storage = crate::storage::block_on(crate::storage::open(&url)).unwrap();let docs = Arc::clone(storage.for_scope(&Scope::local()).unwrap().documents());crate::storage::block_on(async move {docs.ensure_collection(&(source.collections)().remove(0))diff --git a/crates/openhuman-core/src/storage/import/sessions_tests.rs b/crates/openhuman-core/src/storage/import/sessions_tests.rsindex e5d56a19e9..64226b4979 100644--- a/crates/openhuman-core/src/storage/import/sessions_tests.rs+++ b/crates/openhuman-core/src/storage/import/sessions_tests.rs@@ -1,6 +1,7 @@#![cfg(feature = "storage-sqlite")]use super::*;+use crate::storage::Scope;use crate::storage::rusqlite;use crate::storage::test_support::{SqliteBackend, sqlite_backend};use crate::util::classic_transcript_fixture::write_classic;diff --git a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_tests.rsindex f359674246..bd57522b33 100644--- a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs+++ b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs@@ -87,7 +87,7 @@ fn tree(root: &Path) -> BTreeMap<String, String> {fn documents(backend: &Arc<dyn StorageBackend>,scope: &Scope,-) -> Arc<dyn tinystoragedrivers::DocumentStore> {+) -> Arc<dyn crate::storage::DocumentStore> {Arc::clone(backend.for_scope(scope).unwrap().documents())}diff --git a/crates/openhuman-core/src/storage/layout/mod.rs b/crates/openhuman-core/src/storage/layout/mod.rsindex 1a2b3d24ab..c17a26b4b1 100644--- a/crates/openhuman-core/src/storage/layout/mod.rs+++ b/crates/openhuman-core/src/storage/layout/mod.rs@@ -207,7 +207,7 @@ pub enum Outcome {}#[cfg(all(test, feature = "legacy-import"))]-mod test_fixtures;+pub(crate) mod test_fixtures;#[cfg(all(test, feature = "legacy-import"))]#[path = "mod_tests.rs"]