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(core): reformat assertions and use shared memory backend
Steven Enamakel22eed9d93546
diff --git a/crates/openhuman-core/src/desktop/notifications/store_documents_tests.rs b/crates/openhuman-core/src/desktop/notifications/store_documents_tests.rsindex a41d13dda8..a37c9a4a7f 100644--- a/crates/openhuman-core/src/desktop/notifications/store_documents_tests.rs+++ b/crates/openhuman-core/src/desktop/notifications/store_documents_tests.rs@@ -76,21 +76,15 @@ fn identical_content_within_a_minute_is_skipped() {assert!(store.insert(¬e("a", "slack", "hi", 0), true).unwrap());assert!(!store.insert(¬e("b", "slack", "hi", 0), true).unwrap());assert!(store.insert(¬e("c", "slack", "other", 0), true).unwrap());- assert!(- store- .exists_recent("slack", Some("acct"), "New message", "hi")- .unwrap()- );- assert!(- !store- .exists_recent("slack", None, "New message", "hi")- .unwrap()- );- assert!(- !store- .exists_recent("gmail", Some("acct"), "New message", "hi")- .unwrap()- );+ assert!(store+ .exists_recent("slack", Some("acct"), "New message", "hi")+ .unwrap());+ assert!(!store+ .exists_recent("slack", None, "New message", "hi")+ .unwrap());+ assert!(!store+ .exists_recent("gmail", Some("acct"), "New message", "hi")+ .unwrap());assert_eq!(ids(&store.list(10, 0, None, None).unwrap()).len(), 2);}@@ -112,11 +106,9 @@ fn content_older_than_the_window_is_not_a_duplicate() {.map(|_| ())}).unwrap();- assert!(- !store- .exists_recent("slack", Some("acct"), "New message", "hi")- .unwrap()- );+ assert!(!store+ .exists_recent("slack", Some("acct"), "New message", "hi")+ .unwrap());assert!(store.insert(¬e("b", "slack", "hi", 0), true).unwrap());}@@ -125,22 +117,16 @@ fn dedup_follows_arrival_not_the_notifications_own_timestamp() {let store = docs();// A delayed event (stamped two minutes ago) and a future-dated one both// arrived now, so identical content right after is a duplicate either way.- assert!(- store- .insert(¬e("a", "slack", "late", 120), true)- .unwrap()- );+ assert!(store+ .insert(¬e("a", "slack", "late", 120), true)+ .unwrap());assert!(!store.insert(¬e("b", "slack", "late", 0), true).unwrap());- assert!(- store- .insert(¬e("c", "slack", "future", -3600), true)- .unwrap()- );- assert!(- !store- .insert(¬e("d", "slack", "future", 0), true)- .unwrap()- );+ assert!(store+ .insert(¬e("c", "slack", "future", -3600), true)+ .unwrap());+ assert!(!store+ .insert(¬e("d", "slack", "future", 0), true)+ .unwrap());}#[test]@@ -150,47 +136,37 @@ fn a_failed_insert_releases_its_dedup_claim() {.insert(¬e("taken", "slack", "first", 0), false).unwrap();// Same id, new content: the claim succeeds, the notification put fails.- assert!(- store- .insert(¬e("taken", "slack", "second", 0), true)- .is_err()- );+ assert!(store+ .insert(¬e("taken", "slack", "second", 0), true)+ .is_err());assert!(!store.exists_recent("slack", Some("acct"), "New message", "second").unwrap(),"the claim was rolled back");- assert!(- store- .insert(¬e("fresh", "slack", "second", 0), true)- .unwrap()- );+ assert!(store+ .insert(¬e("fresh", "slack", "second", 0), true)+ .unwrap());}#[test]fn workspaces_keep_core_notifications_apart() {let store = docs();- assert!(- store- .insert_core_notification("/workspace/a", &event("e", 1))- .unwrap()- );- assert!(- store- .insert_core_notification("/workspace/b", &event("e", 2))- .unwrap()- );+ assert!(store+ .insert_core_notification("/workspace/a", &event("e", 1))+ .unwrap());+ assert!(store+ .insert_core_notification("/workspace/b", &event("e", 2))+ .unwrap());let a = store.list_core_notifications("/workspace/a", false, 10).unwrap();assert_eq!(a.len(), 1);assert_eq!(a[0].timestamp_ms, 1);- assert!(- store- .mark_core_notification_read("/workspace/a", "e")- .unwrap()- );+ assert!(store+ .mark_core_notification_read("/workspace/a", "e")+ .unwrap());assert_eq!(store.unread_core_notification_count("/workspace/a")@@ -203,11 +179,9 @@ fn workspaces_keep_core_notifications_apart() {.unwrap(),1);- assert!(- !store- .mark_core_notification_read("/workspace/c", "e")- .unwrap()- );+ assert!(!store+ .mark_core_notification_read("/workspace/c", "e")+ .unwrap());}#[test]@@ -248,11 +222,9 @@ fn triage_status_and_score_filter() {assert_eq!(store.unread_count().unwrap(), 3);assert!(store.set_status("low", NotificationStatus::Read).unwrap());assert!(store.set_status("high", NotificationStatus::Acted).unwrap());- assert!(- !store- .set_status("missing", NotificationStatus::Dismissed)- .unwrap()- );+ assert!(!store+ .set_status("missing", NotificationStatus::Dismissed)+ .unwrap());assert_eq!(store.unread_count().unwrap(), 1);let stats = store.stats().unwrap();@@ -307,12 +279,10 @@ fn core_notifications_persist_once_and_mark_read() {["a"]);assert_eq!(store.unread_core_notification_count(WS).unwrap(), 1);- assert!(- store- .list_core_notifications(WS, false, 0)- .unwrap()- .is_empty()- );+ assert!(store+ .list_core_notifications(WS, false, 0)+ .unwrap()+ .is_empty());}#[test]@@ -360,10 +330,9 @@ fn scopes_keep_notifications_apart() {.unwrap();let bob = docs_in(&storage, "bob");assert!(bob.list(10, 0, None, None).unwrap().is_empty());- assert!(- !bob.exists_recent("slack", Some("acct"), "New message", "hi")- .unwrap()- );+ assert!(!bob+ .exists_recent("slack", Some("acct"), "New message", "hi")+ .unwrap());assert!(bob.insert(¬e("a", "slack", "hi", 0), true).unwrap());}diff --git a/crates/openhuman-core/src/platform/cost/tracker_documents_tests.rs b/crates/openhuman-core/src/platform/cost/tracker_documents_tests.rsindex 74842873b2..5eff4664b1 100644--- a/crates/openhuman-core/src/platform/cost/tracker_documents_tests.rs+++ b/crates/openhuman-core/src/platform/cost/tracker_documents_tests.rs@@ -43,7 +43,7 @@ fn a_record_is_written_once() {#[test]fn scopes_do_not_see_each_others_costs() {- let storage = MemoryStorage::new();+ let storage = memory_backend();let alice = docs_in(&storage, "alice");let bob = docs_in(&storage, "bob");alice.add(&record("a/model", 1.0, 0)).unwrap();@@ -66,7 +66,8 @@ fn a_legacy_jsonl_ledger_is_imported_once_and_set_aside() {),).unwrap();- let docs = docs_in(&MemoryStorage::new(), "local");+ let storage = memory_backend();+ let docs = docs_in(storage.as_ref(), "local");assert_eq!(docs.import_legacy(&path).unwrap(), 2);assert_eq!(docs.all().unwrap().len(), 2);assert!(!path.exists());@@ -88,7 +89,8 @@ fn a_legacy_import_skips_ids_already_stored_or_repeated() {format!("{}\n{}\n{}\n", line(&first), line(&second), line(&second)),).unwrap();- let docs = docs_in(&MemoryStorage::new(), "local");+ let storage = memory_backend();+ let docs = docs_in(storage.as_ref(), "local");docs.add(&first).unwrap();assert_eq!(docs.import_legacy(&path).unwrap(), 1);assert_eq!(docs.all().unwrap().len(), 2);@@ -106,7 +108,8 @@ fn an_earlier_set_aside_ledger_is_kept_and_bad_utf8_lines_are_skipped() {let earlier = dir.path().join("costs.jsonl.migrated");std::fs::write(&earlier, "earlier").unwrap();- let docs = docs_in(&MemoryStorage::new(), "local");+ let storage = memory_backend();+ let docs = docs_in(storage.as_ref(), "local");assert_eq!(docs.import_legacy(&path).unwrap(), 1);assert!(!path.exists());assert_eq!(std::fs::read_to_string(&earlier).unwrap(), "earlier");@@ -120,6 +123,7 @@ fn a_ledger_another_core_already_set_aside_counts_as_done() {assert!(set_aside(&path).is_ok());// An unreadable ledger (here a directory) fails the import instead.std::fs::create_dir_all(&path).unwrap();- let docs = docs_in(&MemoryStorage::new(), "local");+ let storage = memory_backend();+ let docs = docs_in(storage.as_ref(), "local");assert!(docs.import_legacy(&path).is_err());}