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
refactor(memory): simplify legacy store opening and share test helpers
Steven Enamakelf3417e31ba31
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rsindex b44b6a664e..9e9a7e7b9f 100644--- a/crates/openhuman-core/src/memory/import.rs+++ b/crates/openhuman-core/src/memory/import.rs@@ -281,18 +281,11 @@ fn write_file(workspace_dir: &Path, file: &ImportFile) {}}-/// Opens the legacy store at `workspace_dir` for scanning, counting,-/// importing or retrying. Every caller goes through here so connector syncs-/// (Gmail, Slack, Notion, Linear, GitHub, ClickUp, ... from Composio) are-/// skipped everywhere alike and the scan counts match the run.-fn open_legacy(- workspace_dir: &Path,-) -> Result<LegacyWorkspace, tinymemory_integrations::import::Error> {- tracing::debug!(- workspace = %workspace_dir.display(),- "[memory:import] opening legacy store, skipping connector syncs (composio/connectors are re-synced, not migrated)"- );- LegacyWorkspace::open(workspace_dir).map(|workspace| workspace.skip_connector_syncs(true))+/// Opens the legacy store for every scan, count, import and retry, skipping+/// connector (Composio) syncs so the scan counts match the run.+fn open_legacy(dir: &Path) -> Result<LegacyWorkspace, tinymemory_integrations::import::Error> {+ tracing::debug!(workspace = %dir.display(), "[memory:import] skipping connector syncs");+ LegacyWorkspace::open(dir).map(|workspace| workspace.skip_connector_syncs(true))}/// Counts what a legacy store at `workspace_dir` holds, or `None` when there@@ -754,3 +747,7 @@ mod organize_tests;#[cfg(test)]#[path = "import_wait_tests.rs"]mod wait_tests;++#[cfg(test)]+#[path = "import_connector_tests.rs"]+mod connector_tests;diff --git a/crates/openhuman-core/src/memory/import_connector_tests.rs b/crates/openhuman-core/src/memory/import_connector_tests.rsindex 0372546b4e..1b2084e5c3 100644--- a/crates/openhuman-core/src/memory/import_connector_tests.rs+++ b/crates/openhuman-core/src/memory/import_connector_tests.rs@@ -1,7 +1,9 @@-use super::tests::legacy_workspace;+//! The import leaves out what v1 synced from Composio and the connectors.++use super::tests::{chunk_only_workspace, legacy_workspace, memory_doc, wait_until_settled};use super::*;use crate::memory::test_fixtures::{bind_reference, config_in, stored};-use rusqlite::{params, Connection};+use rusqlite::Connection;use tinymemory_api::MetaFilter;#[tokio::test]@@ -71,4 +73,3 @@ async fn connector_syncs_are_not_imported() {.iter().any(|id| id == "mem_tree_chunks:document:mem_src:folder"));}-diff --git a/crates/openhuman-core/src/memory/import_tests.rs b/crates/openhuman-core/src/memory/import_tests.rsindex 8732e548af..5be906d7b2 100644--- a/crates/openhuman-core/src/memory/import_tests.rs+++ b/crates/openhuman-core/src/memory/import_tests.rs@@ -20,7 +20,7 @@ CREATE TABLE user_profile (facet_id TEXT PRIMARY KEY, facet_type TEXT NOT NULL,first_seen_at REAL NOT NULL, last_seen_at REAL NOT NULL);";-fn memory_doc(conn: &Connection, id: &str, namespace: &str, title: &str, content: &str) {+pub(super) fn memory_doc(conn: &Connection, id: &str, namespace: &str, title: &str, content: &str) {conn.execute("INSERT INTO memory_docs (document_id, namespace, key, title, content, source_type, priority,tags_json, metadata_json, category, created_at, updated_at, markdown_rel_path)@@ -102,7 +102,7 @@ async fn scan_counts_what_a_legacy_store_holds() {/// A store from the later v1 engine: only `memory_tree/chunks.db`, with an/// document source of two chunks and a chat source of one (not an email: the/// import skips connector syncs, see `connector_syncs_are_not_imported`).-fn chunk_only_workspace(workspace_dir: &Path) {+pub(super) fn chunk_only_workspace(workspace_dir: &Path) {std::fs::create_dir_all(workspace_dir.join("memory_tree")).unwrap();let conn = Connection::open(workspace_dir.join("memory_tree").join("chunks.db")).unwrap();conn.execute_batch(