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
test(memory): make the remaining absence and filter assertions discriminate
Shanu933ab148d111
diff --git a/src/openhuman/memory/tools/store.rs b/src/openhuman/memory/tools/store.rsindex 839077702e..3f84999b56 100644--- a/src/openhuman/memory/tools/store.rs+++ b/src/openhuman/memory/tools/store.rs@@ -301,7 +301,7 @@ the tool resolves the bound driver rather than being handed a memory handle"]#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \the tool resolves the bound driver rather than being handed a memory handle"]async fn store_rejects_secret_like_content() {- let (_tmp, mem) = test_mem();+ let (_tmp, _mem) = test_mem();let tool = MemoryStoreTool::new(test_security());let result = tool.execute(json!({@@ -313,7 +313,10 @@ the tool resolves the bound driver rather than being handed a memory handle"].unwrap();assert!(result.is_error);assert!(result.output().contains("looks like a secret"));- assert!(mem.get("global", "api").await.unwrap().is_none());+ // Through the guard, not `test_mem()`: an absence assertion against a+ // store the tool never writes to holds whether or not the refusal+ // worked, which makes it worse than no assertion at all.+ assert!(stored("global", "api").await.is_none());}#[tokio::test]@@ -340,37 +343,39 @@ the tool resolves the bound driver rather than being handed a memory handle"]#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \the tool resolves the bound driver rather than being handed a memory handle"]async fn store_blocked_in_readonly_mode() {- let (_tmp, mem) = test_mem();+ let (_tmp, _mem) = test_mem();let readonly = Arc::new(SecurityPolicy {autonomy: AutonomyLevel::ReadOnly,..SecurityPolicy::default()});let tool = MemoryStoreTool::new(readonly);let result = tool- .execute(json!({"namespace": "global", "key": "lang", "content": "Prefers Rust"}))+ .execute(+ json!({"namespace": "global", "key": "readonly_lang", "content": "Prefers Rust"}),+ ).await.unwrap();assert!(result.is_error);assert!(result.output().contains("read-only mode"));- assert!(mem.get("global", "lang").await.unwrap().is_none());+ assert!(stored("global", "readonly_lang").await.is_none());}#[tokio::test]#[ignore = "needs a built tinymemory module (OPENHUMAN_MODULE_PATH) and its own process: \the tool resolves the bound driver rather than being handed a memory handle"]async fn store_blocked_when_rate_limited() {- let (_tmp, mem) = test_mem();+ let (_tmp, _mem) = test_mem();let limited = Arc::new(SecurityPolicy {max_actions_per_hour: 0,..SecurityPolicy::default()});let tool = MemoryStoreTool::new(limited);let result = tool- .execute(json!({"namespace": "global", "key": "lang", "content": "Prefers Rust"}))+ .execute(json!({"namespace": "global", "key": "ratelimited_lang", "content": "Prefers Rust"})).await.unwrap();assert!(result.is_error);assert!(result.output().contains("Rate limit exceeded"));- assert!(mem.get("global", "lang").await.unwrap().is_none());+ assert!(stored("global", "ratelimited_lang").await.is_none());}}diff --git a/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs b/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rsindex fa9b4c0f96..ed8e01bc4b 100644--- a/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs+++ b/tests/raw_coverage/memory_tree_sync_deep_raw_coverage_e2e.rs@@ -537,6 +537,31 @@ async fn memory_tree_rpc_chunk_reads_set_enabled_and_ingest_errors() {chunk};+ let wrong_kind = {+ let ts = Utc.timestamp_millis_opt(1_700_000_003_000).unwrap();+ let text = "right source, owner and window, wrong source kind";+ let chunk = Chunk {+ id: chunk_id(SourceKind::Email, "chat:#status", 4, text),+ content: text.to_string(),+ metadata: Metadata {+ source_kind: SourceKind::Email,+ source_id: "chat:#status".into(),+ owner: "round18-user".into(),+ timestamp: ts,+ time_range: (ts, ts),+ tags: vec!["round18".into()],+ source_ref: None,+ path_scope: None,+ },+ token_count: 32,+ seq_in_source: 4,+ created_at: ts,+ partial_message: false,+ };+ upsert_chunks(&cfg, std::slice::from_ref(&chunk)).expect("upsert decoy");+ chunk+ };+let listed = list_chunks_rpc(&cfg,ListChunksRequest {@@ -556,10 +581,11 @@ async fn memory_tree_rpc_chunk_reads_set_enabled_and_ingest_errors() {assert_eq!(listed_ids,vec![chunk.id.as_str()],- "every filter must discriminate: {} (source id), {} (window), {} (owner) are all in the store",+ "every filter must discriminate: {} (source id), {} (window), {} (owner), {} (source kind) are all in the store",wrong_source.id,wrong_time.id,- wrong_owner.id+ wrong_owner.id,+ wrong_kind.id);let fetched = get_chunk_rpc(&cfg,