Skip to content

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

chore(memory): add test modules for import, layout migration, and local root

Steven Enamakel1b15f32e1731
diff --git a/crates/openhuman-core/src/memory/import_tests.rs b/crates/openhuman-core/src/memory/import_tests.rs
index 398d67c7aa..2ad8671a3d 100644
--- a/crates/openhuman-core/src/memory/import_tests.rs
+++ b/crates/openhuman-core/src/memory/import_tests.rs
@@ -2,7 +2,7 @@ use super::*;
use crate::memory::test_fixtures::config_in;
#[test]
-fn the_state_file_round_trips_through_the_atomic_store() {
+fn the_state_round_trips_through_the_store() {
let tmp = tempfile::tempdir().unwrap();
let store = FileCheckpointStore::new(tmp.path());
assert_eq!(
@@ -17,7 +17,6 @@ fn the_state_file_round_trips_through_the_atomic_store() {
store.save(&file).unwrap();
assert_eq!(store.load(), file);
assert!(listed_unconfirmed(tmp.path()));
- assert!(tmp.path().join("memory/import_state.json").is_file());
}
#[test]
diff --git a/crates/openhuman-core/src/memory/layout_migration/service_tests.rs b/crates/openhuman-core/src/memory/layout_migration/service_tests.rs
index 600b4d1cc0..a6ee856d23 100644
--- a/crates/openhuman-core/src/memory/layout_migration/service_tests.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/service_tests.rs
@@ -114,16 +114,15 @@ async fn nothing_starts_while_an_import_is_unfinished() {
let tmp = tempfile::tempdir().unwrap();
let config = crate::memory::test_fixtures::config_in(&tmp);
let host = Arc::new(FakeHost::with(3, &config).await);
- let path = config
- .workspace_dir
- .join("memory")
- .join("import_state.json");
- std::fs::create_dir_all(path.parent().unwrap()).unwrap();
- std::fs::write(
- &path,
- r#"{"state":{"phase":"running","total":3,"imported":1}}"#,
- )
- .unwrap();
+ let state = |json: &str| {
+ crate::memory::state_store::save(
+ &config.workspace_dir,
+ "import_state",
+ &serde_json::from_str::<serde_json::Value>(json).unwrap(),
+ )
+ .unwrap();
+ };
+ state(r#"{"state":{"phase":"running","total":3,"imported":1}}"#);
assert!(crate::memory::import::in_progress(&config));
assert!(!start(
&crate::core::runtime::DispatchCtx::ambient(),
@@ -140,11 +139,7 @@ async fn nothing_starts_while_an_import_is_unfinished() {
));
assert_eq!(count(host.tree.as_ref()).await, 0);
- std::fs::write(
- &path,
- r#"{"state":{"phase":"done","total":3,"imported":3}}"#,
- )
- .unwrap();
+ state(r#"{"state":{"phase":"done","total":3,"imported":3}}"#);
assert!(start(
&crate::core::runtime::DispatchCtx::ambient(),
config.clone(),
diff --git a/crates/openhuman-core/src/memory/local_root_tests.rs b/crates/openhuman-core/src/memory/local_root_tests.rs
index 3333a29f53..1aea421ca0 100644
--- a/crates/openhuman-core/src/memory/local_root_tests.rs
+++ b/crates/openhuman-core/src/memory/local_root_tests.rs
@@ -22,7 +22,7 @@ fn forget_cached(config: &Config) {
}
fn recorded(config: &Config) -> LocalRoot {
- read(&path(&config.workspace_dir)).unwrap().unwrap()
+ read(&config.workspace_dir).unwrap().unwrap()
}
#[test]