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(memory): add import tests for memory module
Steven Enamakel318ac05c5763
diff --git a/crates/openhuman-core/src/memory/import_tests.rs b/crates/openhuman-core/src/memory/import_tests.rsindex 6ee7cb3c05..d1a9964f94 100644--- a/crates/openhuman-core/src/memory/import_tests.rs+++ b/crates/openhuman-core/src/memory/import_tests.rs@@ -100,7 +100,8 @@ async fn scan_counts_what_a_legacy_store_holds() {}/// A store from the later v1 engine: only `memory_tree/chunks.db`, with an-/// email source of two chunks and a chat source of one.+/// 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) {std::fs::create_dir_all(workspace_dir.join("memory_tree")).unwrap();let conn = Connection::open(workspace_dir.join("memory_tree").join("chunks.db")).unwrap();@@ -112,8 +113,8 @@ fn chunk_only_workspace(workspace_dir: &Path) {content TEXT NOT NULL, token_count INTEGER NOT NULL, seq_in_source INTEGER NOT NULL,created_at_ms INTEGER NOT NULL);INSERT INTO mem_tree_chunks VALUES- ('k1', 'email', 'e1', NULL, NULL, 'me', 1, 1, 1, '[]', 'launch moved', 3, 0, 1),- ('k2', 'email', 'e1', NULL, NULL, 'me', 2, 2, 2, '[]', 'to friday', 3, 1, 2),+ ('k1', 'document', 'd1', NULL, NULL, 'me', 1, 1, 1, '[]', 'launch moved', 3, 0, 1),+ ('k2', 'document', 'd1', NULL, NULL, 'me', 2, 2, 2, '[]', 'to friday', 3, 1, 2),('k3', 'chat', 'c1', NULL, NULL, 'me', 3, 3, 3, '[]', 'hi there', 2, 0, 3);",).unwrap();@@ -189,6 +190,64 @@ async fn learnings_count_every_learning_section_the_import_yields() {assert_eq!(stored(&engine, MetaFilter::default()).await.len(), 9);}+#[tokio::test]+async fn connector_syncs_are_not_imported() {+ let tmp = tempfile::tempdir().unwrap();+ let config = config_in(&tmp);+ legacy_workspace(&config.workspace_dir);+ // Composio leftovers: a `skill-gmail` doc, a Gmail identity facet, and a+ // chunk store with an email and a Slack source beside a memory-source+ // folder file that must still come across.+ let conn = Connection::open(config.workspace_dir.join("memory").join("memory.db")).unwrap();+ memory_doc(&conn, "d9", "skill-gmail", "Inbox", "Mail from Ann");+ conn.execute(+ "INSERT INTO user_profile (facet_id, facet_type, key, value, confidence, first_seen_at, last_seen_at)+ VALUES ('skill-gmail-c1-name', 'identity', 'skill:gmail:name', 'Ann', 0.9, 1.0, 1.0)",+ [],+ )+ .unwrap();+ drop(conn);+ chunk_only_workspace(&config.workspace_dir);+ let conn = Connection::open(config.workspace_dir.join("memory_tree").join("chunks.db")).unwrap();+ conn.execute_batch(+ "INSERT INTO mem_tree_chunks VALUES+ ('k4', 'email', 'thread-1', NULL, NULL, 'me', 4, 4, 4, '[]', 'invoice attached', 3, 0, 4),+ ('k5', 'chat', 'slack:conn1', NULL, NULL, 'me', 5, 5, 5, '[]', 'standup at 10', 3, 0, 5),+ ('k6', 'document', 'mem_src:folder', NULL, NULL, 'me', 6, 6, 6, '[]', 'folder note', 3, 0, 6);",+ )+ .unwrap();+ drop(conn);++ // Documents: 2 notes + 2 chunk sources (d1, mem_src); the skill-gmail doc+ // and the email/slack sources are absent. Learnings: doc + 1 facet.+ let counts = scan(&config).await.unwrap().counts.expect("counts");+ assert_eq!(+ (counts.documents, counts.conversations, counts.learnings),+ (5, 1, 2),+ "scan counts exclude connector syncs"+ );++ let engine = bind_reference(&config);+ start(&config, true).await.unwrap();+ let done = wait_until_settled(&config).await;+ assert_eq!(+ (done.phase, done.imported, done.total),+ (ImportPhase::Done, 8, 8)+ );+ let items = stored(&engine, MetaFilter::default()).await;+ assert_eq!(items.len(), 8);+ let ids: Vec<String> = items.iter().map(legacy_id).collect();+ for skipped in [+ "memory_docs:d9",+ "user_profile:skill-gmail-c1-name",+ "mem_tree_chunks:email:thread-1",+ "mem_tree_chunks:chat:slack:conn1",+ ] {+ assert!(!ids.iter().any(|id| id == skipped), "{skipped} imported: {ids:?}");+ }+ assert!(ids.iter().any(|id| id == "mem_tree_chunks:document:mem_src:folder"));+}+#[test]fn status_of_an_untouched_workspace_is_idle() {let tmp = tempfile::tempdir().unwrap();