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

Steven Enamakel981da82cfd14
diff --git a/crates/openhuman-core/src/memory/brain_tests.rs b/crates/openhuman-core/src/memory/brain_tests.rs
index 1af5b76cf2..c7b723eb8e 100644
--- a/crates/openhuman-core/src/memory/brain_tests.rs
+++ b/crates/openhuman-core/src/memory/brain_tests.rs
@@ -1,5 +1,6 @@
use super::*;
+use tinymemory_tools::layout::identity::Identity as MemoryIdentity;
use tinymemory_tools::layout::placement::file_into;
use tinymemory_api::{ItemKind, MemoryMeta, MetaFilter};
@@ -56,12 +57,7 @@ async fn a_sources_collections_count_and_forget_with_it() {
};
engine.store(StoreItem::document(text, meta)).await.unwrap();
}
- let view = sources(
- &config,
- &tinymemory_tools::layout::identity::Identity::root(),
- )
- .await
- .unwrap();
+ let view = sources(&config, &MemoryIdentity::root()).await.unwrap();
let counts: Vec<(&str, u64)> = view
.sources
.iter()
@@ -72,7 +68,7 @@ async fn a_sources_collections_count_and_forget_with_it() {
let gone = forget(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainForgetParams {
source: "github".into(),
},
@@ -98,7 +94,7 @@ async fn text_is_ingested_searched_counted_and_forgotten_per_source() {
let ingested = ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainIngestParams {
path: None,
text: Some("Refunds are issued within 14 days.".into()),
@@ -111,7 +107,7 @@ async fn text_is_ingested_searched_counted_and_forgotten_per_source() {
assert_eq!(ingested.source, "notion");
ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainIngestParams {
path: None,
text: Some("Onboarding takes a week.".into()),
@@ -130,19 +126,14 @@ async fn text_is_ingested_searched_counted_and_forgotten_per_source() {
"one belief build per source"
);
- let counts = sources(
- &config,
- &tinymemory_tools::layout::identity::Identity::root(),
- )
- .await
- .unwrap();
+ let counts = sources(&config, &MemoryIdentity::root()).await.unwrap();
assert_eq!(counts.root, "root");
assert_eq!(counts.sources.len(), 2);
assert_eq!(counts.unfiled, 0);
let found = search(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainSearchParams {
query: "refunds".into(),
source: Some("notion".into()),
@@ -155,7 +146,7 @@ async fn text_is_ingested_searched_counted_and_forgotten_per_source() {
let gone = forget(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainForgetParams {
source: "notion".into(),
},
@@ -197,18 +188,13 @@ async fn ingest_refuses_bad_input() {
},
] {
assert!(matches!(
- ingest(
- &config,
- &tinymemory_tools::layout::identity::Identity::root(),
- params
- )
- .await,
+ ingest(&config, &MemoryIdentity::root(), params).await,
Err(Error::InvalidRequest(_))
));
}
assert!(search(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainSearchParams {
query: " ".into(),
source: None,
@@ -229,7 +215,7 @@ async fn ingest_rejects_path_and_text_together_without_ingesting() {
let error = ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainIngestParams {
path: Some(path.display().to_string()),
text: Some("valid text content".into()),
@@ -258,7 +244,7 @@ async fn a_file_is_converted_and_filed_under_files() {
std::fs::write(&path, "# Guide\n\nAlways tag releases.").unwrap();
let ingested = ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainIngestParams {
path: Some(path.display().to_string()),
text: None,
@@ -288,7 +274,7 @@ async fn an_ingest_queues_a_belief_build_only_for_an_engine_that_waits_for_one()
);
ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainIngestParams {
path: None,
text: Some("Refunds are issued within 14 days.".into()),
@@ -333,12 +319,7 @@ async fn ingest_refuses_a_credential_store_a_system_root_traversal_and_null_byte
format!("{}/../guide.md", notes.display()),
format!("{}\0.md", tmp.path().join("guide").display()),
] {
- let result = ingest(
- &config,
- &tinymemory_tools::layout::identity::Identity::root(),
- path_params(path.clone()),
- )
- .await;
+ let result = ingest(&config, &MemoryIdentity::root(), path_params(path.clone())).await;
assert!(
matches!(result, Err(Error::InvalidRequest(_))),
"{path:?}: {result:?}"
@@ -361,7 +342,7 @@ async fn ingest_refuses_a_symlink_into_a_credential_store() {
let result = ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
path_params(link.display().to_string()),
)
.await;
@@ -379,7 +360,7 @@ async fn ingest_keeps_the_legacy_blank_source_error() {
bind_reference(&config);
let error = ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
BrainIngestParams {
path: None,
text: Some("body".into()),
@@ -407,7 +388,7 @@ async fn ingest_keeps_the_legacy_oversized_file_error() {
let error = ingest(
&config,
- &tinymemory_tools::layout::identity::Identity::root(),
+ &MemoryIdentity::root(),
path_params(path.display().to_string()),
)
.await