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
feat(storage): add layout status reporting and test coverage
Steven Enamakelb89686dbbdf7
diff --git a/crates/openhuman-core/src/storage/layout/archive_tests.rs b/crates/openhuman-core/src/storage/layout/archive_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/archive_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/db_tests.rs b/crates/openhuman-core/src/storage/layout/db_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/db_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/legacy_tests.rs b/crates/openhuman-core/src/storage/layout/legacy_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/legacy_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/mod_tests.rs b/crates/openhuman-core/src/storage/layout/mod_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/mod_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/plan_tests.rs b/crates/openhuman-core/src/storage/layout/plan_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/plan_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/run_tests.rs b/crates/openhuman-core/src/storage/layout/run_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/run_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/schemas_tests.rs b/crates/openhuman-core/src/storage/layout/schemas_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/schemas_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/state_tests.rs b/crates/openhuman-core/src/storage/layout/state_tests.rsnew file mode 100644index 0000000000..4563e55b7b--- /dev/null+++ b/crates/openhuman-core/src/storage/layout/state_tests.rs@@ -0,0 +1 @@+use super::*;diff --git a/crates/openhuman-core/src/storage/layout/status.rs b/crates/openhuman-core/src/storage/layout/status.rsindex 0bd11545ca..aa7f906fcf 100644--- a/crates/openhuman-core/src/storage/layout/status.rs+++ b/crates/openhuman-core/src/storage/layout/status.rs@@ -80,7 +80,7 @@ pub async fn status(target: &Target, config: &Config, env_url: Option<String>) -async fn read_versions(db: &std::path::Path) -> Result<(Vec<OwnerVersion>, Option<i64>), LayoutError> {use tinystoragedrivers::schema::Progress;- use tinystoragedrivers::{DocumentStoreExt, Query, StorageBackend, MIGRATIONS_COLLECTION};+ use tinystoragedrivers::{DocumentStoreExt, Query, MIGRATIONS_COLLECTION};let url = crate::storage::StorageUrl::parse(&format!("sqlite:{}", db.display())).map_err(|e| LayoutError::Other(anyhow::anyhow!("{e}")))?;let backend = tinystoragedrivers::open(&url)diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rsindex 9b38ebc982..dd6fdbcd6e 100644--- a/crates/openhuman-embed/src/host_internals.rs+++ b/crates/openhuman-embed/src/host_internals.rs@@ -299,6 +299,12 @@ pub mod storage {block_on, block_on_anyhow, clear, configured_url, driver_is_shared, install,install_for_url, installed, open, url_from, StorageBackend, STORAGE_URL_VAR,};++ /// The layout v1 -> v2 migration the host runs at boot when+ /// `[storage] auto_migrate_layout` is set.+ pub mod layout {+ pub use openhuman_core::storage::layout::auto_migrate;+ }}pub mod profiles {diff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rsindex f8fb1e8b8e..44337136af 100644--- a/crates/openhuman-rpc/src/session_store/mod.rs+++ b/crates/openhuman-rpc/src/session_store/mod.rs@@ -98,11 +98,19 @@ async fn configured_storage_url() -> anyhow::Result<Option<String>> {return Ok(storage_url_from(env, &Default::default()));}// Boot-time resolution: the host's own context, no turn's.- let config = crate::core_host::config::ops::load_config_in(- &crate::core_host::core::runtime::DispatchCtx::host_default(),- )- .await- .map_err(|error| anyhow::anyhow!("loading the config to resolve the storage url: {error}"))?;+ let ctx = crate::core_host::core::runtime::DispatchCtx::host_default();+ let load = || async {+ crate::core_host::config::ops::load_config_in(&ctx).await.map_err(|error| {+ anyhow::anyhow!("loading the config to resolve the storage url: {error}")+ })+ };+ let mut config = load().await?;+ // `[storage] auto_migrate_layout`: move a layout-v1 profile to v2 before+ // the backend opens, then re-read the config, whose workspace is now the+ // profile's `files/` directory.+ if crate::core_host::storage::layout::auto_migrate(&config).await {+ config = load().await?;+ }Ok(storage_url_from(env, &config))}