Skip to content

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

chore: files changed crates/openhuman-core/src/memory/brain_tests.rs,crates/openhuman-core/src/memor

Steven Enamakel4431132a9714
diff --git a/crates/openhuman-core/src/memory/brain_tests.rs b/crates/openhuman-core/src/memory/brain_tests.rs
index 0b995b64bb..7b41b8a422 100644
--- a/crates/openhuman-core/src/memory/brain_tests.rs
+++ b/crates/openhuman-core/src/memory/brain_tests.rs
@@ -219,6 +219,56 @@ async fn ingest_refuses_bad_input() {
.is_err());
}
+#[tokio::test]
+async fn ingest_keeps_the_legacy_blank_source_error() {
+ let tmp = tempfile::tempdir().unwrap();
+ let config = config_in(&tmp);
+ bind_reference(&config);
+ let error = ingest(
+ &config,
+ &tinymemory_tools::layout::identity::Identity::root(),
+ BrainIngestParams {
+ path: None,
+ text: Some("body".into()),
+ source: Some(" ".into()),
+ title: None,
+ },
+ )
+ .await
+ .unwrap_err();
+
+ assert_eq!(
+ error.to_string(),
+ "invalid request: invalid request: a brain source id must not be blank"
+ );
+}
+
+#[tokio::test]
+async fn ingest_keeps_the_legacy_oversized_file_error() {
+ let tmp = tempfile::tempdir().unwrap();
+ let config = config_in(&tmp);
+ bind_reference(&config);
+ let path = config.workspace_dir.join("oversized.bin");
+ let size = MAX_INGEST_BYTES + 1;
+ std::fs::File::create(&path)
+ .unwrap()
+ .set_len(size)
+ .unwrap();
+
+ let error = ingest(
+ &config,
+ &tinymemory_tools::layout::identity::Identity::root(),
+ path_params(path.display().to_string()),
+ )
+ .await
+ .unwrap_err();
+
+ assert_eq!(
+ error.to_string(),
+ format!("invalid request: the file is {size} bytes; the limit is {MAX_INGEST_BYTES}")
+ );
+}
+
#[tokio::test]
async fn a_file_is_converted_and_filed_under_files() {
let tmp = tempfile::tempdir().unwrap();
diff --git a/crates/openhuman-core/src/memory/sources/state_tests.rs b/crates/openhuman-core/src/memory/sources/state_tests.rs
index bf32e36f11..6f6f458060 100644
--- a/crates/openhuman-core/src/memory/sources/state_tests.rs
+++ b/crates/openhuman-core/src/memory/sources/state_tests.rs
@@ -17,3 +17,25 @@ fn corrupt_source_state_file_is_set_aside() {
b"{\"source-1\":"
);
}
+
+#[test]
+fn native_source_state_keeps_the_persisted_host_shape() {
+ let tmp = tempfile::tempdir().unwrap();
+ let file = path(tmp.path());
+ std::fs::create_dir_all(file.parent().unwrap()).unwrap();
+ let saved = serde_json::json!({
+ "src-1": {
+ "last_sync_at": "2025-01-02T03:04:05Z",
+ "status": "error",
+ "error": "reader failed",
+ "items": 7
+ }
+ });
+ std::fs::write(&file, serde_json::to_vec(&saved).unwrap()).unwrap();
+
+ let all = load(tmp.path());
+ assert_eq!(all["src-1"].status, SourceStatus::Error);
+ assert_eq!(all["src-1"].error.as_deref(), Some("reader failed"));
+ assert_eq!(all["src-1"].items, 7);
+ assert_eq!(serde_json::to_value(all).unwrap(), saved);
+}