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): cover legacy profile conversation migration
Steven Enamakel0b227bf21a3d
diff --git a/crates/openhuman-core/src/storage/import/mod_tests.rs b/crates/openhuman-core/src/storage/import/mod_tests.rsindex 33d26471c2..7cee78dc67 100644--- a/crates/openhuman-core/src/storage/import/mod_tests.rs+++ b/crates/openhuman-core/src/storage/import/mod_tests.rs@@ -247,6 +247,74 @@ fn a_marker_row_an_older_build_wrote_counts_as_a_finished_import() {assert!(dump(&backend, &source, "devices.paired").is_empty());}+#[cfg(feature = "storage-sqlite")]+#[tokio::test(flavor = "multi_thread")]+async fn historical_profile_fixture_conversation_migrates_through_typed_owner_api() {+ use crate::storage::layout::{Target, legacy};+ use crate::storage::Scope;++ let root = TempDir::new().unwrap();+ let target = Target::new(root.path(), "u1");+ std::fs::create_dir_all(target.workspace()).unwrap();+ std::fs::create_dir_all(&target.profile_dir).unwrap();+ let config_path = target.profile_dir.join("config.toml");+ std::fs::write(&config_path, "# legacy profile fixture\n").unwrap();+ let fixture = Path::new(env!("CARGO_MANIFEST_DIR"))+ .join("src/storage/import/fixtures/legacy-v1-profile/storage.db");+ let source_db = legacy::v1_db(&target);+ std::fs::create_dir_all(source_db.parent().unwrap()).unwrap();+ std::fs::copy(fixture, &source_db).unwrap();++ let config = Config {+ config_path,+ workspace_dir: target.workspace(),+ ..Config::default()+ };+ crate::storage::layout::migrate(+ &target,+ &config,+ &crate::storage::layout::Options {+ allow_live: true,+ ..Default::default()+ },+ )+ .await+ .unwrap();++ let destination_url = format!("sqlite:{}", target.storage_db().display());+ let destination = crate::storage::test_support::sqlite_backend_in(root, destination_url.clone())+ .unwrap();+ let backend = Arc::clone(&destination.backend);+ let _installed =+ crate::storage::test_support::install_for_test(&destination_url, Arc::clone(&backend));+ assert_eq!(+ backend+ .for_scope(&Scope::local())+ .unwrap()+ .documents()+ .query_all("conversation_threads_v1", &Query::all())+ .await+ .unwrap()+ .len(),+ 1,+ "layout migration carries the actual v1 source row into bootable storage"+ );++ let conversations = crate::threads::store::ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ target.workspace(),+ );+ let threads = conversations.list_threads().unwrap();+ assert_eq!(threads.len(), 1);+ assert_eq!(threads[0].id, "fixture-thread");+ assert_eq!(threads[0].title, "Fixture thread");+ assert_eq!(threads[0].message_count, 1);+ let messages = conversations.get_messages("fixture-thread").unwrap();+ assert_eq!(messages.len(), 1);+ assert_eq!(messages[0].id, "fixture-message");+ assert_eq!(messages[0].content, "historical profile message");+}+#[cfg(feature = "storage-sqlite")]#[tokio::test(flavor = "multi_thread")]async fn historical_profile_fixture_boots_into_typed_owner_records_without_resurrection() {