Skip to content

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

test(memory): run the layout-migration state tests only where storage can claim imports

M3gA-Mind8d8ca1040ab8
diff --git a/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs b/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs
index 39d4d61011..decdec60da 100644
--- a/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs
@@ -5,11 +5,13 @@ use tinymemory_api::MemoryEngine;
use super::*;
use crate::memory::engine::install_test_engine_for_root;
+#[cfg(feature = "storage-sqlite")]
use crate::memory::layout_migration::ops::scan;
+#[cfg(feature = "storage-sqlite")]
use crate::memory::layout_migration::test_host::{count, fact};
-use tinymemory_tools::layout_migration::{
- FsLegacyClaim, LayoutHost, LegacyClaim, Outcome, Trigger,
-};
+use tinymemory_tools::layout_migration::{FsLegacyClaim, LayoutHost, LegacyClaim};
+#[cfg(feature = "storage-sqlite")]
+use tinymemory_tools::layout_migration::{Outcome, Trigger};
const ACCOUNT: &str = "0123456789abcdef01234567";
@@ -42,6 +44,7 @@ fn signed_in(tmp: &tempfile::TempDir) -> Config {
config
}
+#[cfg(feature = "storage-sqlite")] // reads migration state; see `ops.rs`
#[tokio::test]
async fn signed_out_there_is_nothing_to_move() {
let tmp = tempfile::tempdir().unwrap();
@@ -53,6 +56,7 @@ async fn signed_out_there_is_nothing_to_move() {
assert!(!scan(&AppHost::new(config.clone())).await.unwrap().needed);
}
+#[cfg(feature = "storage-sqlite")] // reads migration state; see `ops.rs`
#[tokio::test]
async fn binds_the_legacy_tree_and_the_users_own() {
let tmp = tempfile::tempdir().unwrap();
@@ -153,6 +157,7 @@ async fn the_switch_writes_the_migrated_persons_own_config_fresh() {
/// The host hands the module its claim: a self-hosted tree is not moved until
/// the user consents, and the account that did not claim it has nothing to
/// move. Fails if the adapter stops passing the claim on.
+#[cfg(feature = "storage-sqlite")] // reads migration state; see `ops.rs`
#[tokio::test]
async fn a_shared_tree_reaches_the_module_as_a_claim() {
let tmp = tempfile::tempdir().unwrap();
diff --git a/crates/openhuman-core/src/memory/layout_migration/mod.rs b/crates/openhuman-core/src/memory/layout_migration/mod.rs
index bd2337ca8c..80047a79f9 100644
--- a/crates/openhuman-core/src/memory/layout_migration/mod.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/mod.rs
@@ -7,7 +7,8 @@ pub mod app_host;
pub mod ops;
pub mod state;
-#[cfg(test)]
+// Only the storage-sqlite tests (see `ops.rs`) drive the fake host.
+#[cfg(all(test, feature = "storage-sqlite"))]
pub(crate) mod test_host;
pub use app_host::AppHost;
diff --git a/crates/openhuman-core/src/memory/layout_migration/ops.rs b/crates/openhuman-core/src/memory/layout_migration/ops.rs
index 79df46226f..2c5dbe8f49 100644
--- a/crates/openhuman-core/src/memory/layout_migration/ops.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/ops.rs
@@ -104,6 +104,10 @@ pub fn tick(
)
}
-#[cfg(test)]
+// These read and write the migration state, and every state read adopts the
+// legacy file under an import claim that needs conditional writes. The
+// in-memory test backend has none; only `storage-sqlite` gives tests a
+// backend that does (`StateKv::open`), so without it they cannot run.
+#[cfg(all(test, feature = "storage-sqlite"))]
#[path = "ops_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/memory/layout_migration/state.rs b/crates/openhuman-core/src/memory/layout_migration/state.rs
index bf1a4fc214..ec098aa923 100644
--- a/crates/openhuman-core/src/memory/layout_migration/state.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/state.rs
@@ -89,6 +89,10 @@ pub fn path(workspace_dir: &Path) -> PathBuf {
crate::memory::state_store::legacy_path(workspace_dir, STATE)
}
-#[cfg(test)]
+// These read and write the migration state, and every state read adopts the
+// legacy file under an import claim that needs conditional writes. The
+// in-memory test backend has none; only `storage-sqlite` gives tests a
+// backend that does (`StateKv::open`), so without it they cannot run.
+#[cfg(all(test, feature = "storage-sqlite"))]
#[path = "state_tests.rs"]
mod tests;