Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(storage): run legacy profile boot assertions on a dedicated runtime

Steven Enamakel977270ce29a5
diff --git a/tests/storage_legacy_profile_boot_e2e.rs b/tests/storage_legacy_profile_boot_e2e.rs
index 2805df7c60..846c7a4be0 100644
--- a/tests/storage_legacy_profile_boot_e2e.rs
+++ b/tests/storage_legacy_profile_boot_e2e.rs
@@ -150,42 +150,58 @@ async fn desktop_boot_reads_a_preserved_existing_v1_profile_database() {
let mut config = openhuman_core::config::Config::default();
config.config_path = profile.join("config.toml");
config.workspace_dir = workspace.clone();
- let runtime = openhuman_core::core::runtime::CoreBuilder::new(
- openhuman_core::core::types::HostKind::TauriShell,
- )
- .boot_mode(openhuman_core::core::runtime::CoreBootMode::Inspection)
- .token(openhuman_core::core::runtime::TokenSource::Fixed(
- std::sync::Arc::new("legacy-profile-inspection-token".to_owned()),
- ))
- .services(openhuman_core::core::runtime::ServiceSet::none())
- .config(config.clone())
- .build()
+ let owner_workspace = workspace.clone();
+ tokio::task::spawn_blocking(move || {
+ let owner_runtime = tokio::runtime::Builder::new_multi_thread()
+ .enable_all()
+ .build()
+ .unwrap();
+ owner_runtime.block_on(async move {
+ let runtime = openhuman_core::core::runtime::CoreBuilder::new(
+ openhuman_core::core::types::HostKind::TauriShell,
+ )
+ .boot_mode(openhuman_core::core::runtime::CoreBootMode::Inspection)
+ .token(openhuman_core::core::runtime::TokenSource::Fixed(
+ std::sync::Arc::new("legacy-profile-inspection-token".to_owned()),
+ ))
+ .services(openhuman_core::core::runtime::ServiceSet::none())
+ .config(config.clone())
+ .build()
+ .await
+ .unwrap();
+ let profile_context = runtime.context().derive_with(
+ openhuman_core::core::runtime::ContextOverlay::new(
+ config.clone(),
+ openhuman_core::core::runtime::DomainSet::full(),
+ openhuman_core::tools::toolpacks::ToolGroups::none(),
+ )
+ .profile("u1"),
+ );
+ openhuman_core::core::runtime::CoreContext::scope(profile_context, async {
+ let dispatch = openhuman_core::core::runtime::DispatchCtx::ambient();
+ let thread_store = openhuman_core::threads::store::ConversationStore::new(
+ dispatch,
+ owner_workspace,
+ );
+ assert_eq!(
+ thread_store.transcript_key("fixture-thread").unwrap().as_deref(),
+ Some("fixture-transcript-key"),
+ "thread owner did not read the v1 database transcript key"
+ );
+ let approvals =
+ openhuman_core::security::approval::store::list_pending(&config).unwrap();
+ assert_eq!(
+ approvals.len(),
+ 1,
+ "approval owner did not read the v1 database record"
+ );
+ assert_eq!(approvals[0].request_id, "fixture-approval");
+ })
+ .await;
+ });
+ })
.await
.unwrap();
- let profile_context = runtime.context().derive_with(
- openhuman_core::core::runtime::ContextOverlay::new(
- config.clone(),
- openhuman_core::core::runtime::DomainSet::full(),
- openhuman_core::tools::toolpacks::ToolGroups::none(),
- )
- .profile("u1"),
- );
- openhuman_core::core::runtime::CoreContext::scope(profile_context, async {
- let dispatch = openhuman_core::core::runtime::DispatchCtx::ambient();
- let thread_store = openhuman_core::threads::store::ConversationStore::new(
- dispatch,
- workspace.clone(),
- );
- assert_eq!(
- thread_store.transcript_key("fixture-thread").unwrap().as_deref(),
- Some("fixture-transcript-key"),
- "thread owner did not read the v1 database transcript key"
- );
- let approvals = openhuman_core::security::approval::store::list_pending(&config).unwrap();
- assert_eq!(approvals.len(), 1, "approval owner did not read the v1 database record");
- assert_eq!(approvals[0].request_id, "fixture-approval");
- })
- .await;
// Read the confidential record with TinyStorage's document-secret owner
// API after the desktop boot has installed and migrated the profile DB.