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(attachments): update attachment tests and e2e scenarios
Steven Enamakelcf430c7a35e4
diff --git a/crates/openhuman-core/src/threads/attachments_tests.rs b/crates/openhuman-core/src/threads/attachments_tests.rsindex 047a783584..b4cad70acb 100644--- a/crates/openhuman-core/src/threads/attachments_tests.rs+++ b/crates/openhuman-core/src/threads/attachments_tests.rs@@ -48,10 +48,12 @@ fn public_projection_hides_paths_but_keeps_opaque_attachment_refs() {vec![(part.clone(), "uploads/thread/a.png".into())],);assert_eq!(public, vec![part]);- assert!(metadata[STORAGE_KEY][0]["path"]- .as_str()- .unwrap()- .contains("uploads/"));+ assert!(+ metadata[STORAGE_KEY][0]["path"]+ .as_str()+ .unwrap()+ .contains("uploads/")+ );let projected = public_refs(&metadata);assert_eq!(projected, public);@@ -265,9 +267,7 @@ async fn native_attachment_refs_are_bound_to_profile_agent_account_and_turn() {let forged_part = match part.clone() {ContentPart::Image {- media,- alt_text,- ..+ media, alt_text, ..} => ContentPart::Image {media,caption: Some("forged turn".into()),@@ -294,6 +294,12 @@ async fn native_attachment_refs_are_bound_to_profile_agent_account_and_turn() {.is_err(),"an unclaimed reference from another turn is not authorized");+ assert!(+ read_authorized_native_attachment(&alice, &config, thread, &opaque_id, &[], true)+ .await+ .is_err(),+ "history access still requires a committed host claim"+ );}#[tokio::test]@@ -316,15 +322,17 @@ async fn multipart_claim_failure_keeps_prior_claim_owned_by_retry() {insert_record(&repo, &staged_record(first.clone(), "first.png"));insert_record(&repo, &staged_record(second.clone(), "second.png"));let second_claim = claim("", second.clone(), true);- assert!(cancel_staged_record(- &repo,- &second_claim.tenant,- "thread",- &staged_doc_id(&second_id).unwrap(),- &second,- &second_claim,- )- .unwrap());+ assert!(+ cancel_staged_record(+ &repo,+ &second_claim.tenant,+ "thread",+ &staged_doc_id(&second_id).unwrap(),+ &second,+ &second_claim,+ )+ .unwrap()+ );let entries = vec![StoredAttachment {part: first.clone(),@@ -335,35 +343,41 @@ async fn multipart_claim_failure_keeps_prior_claim_owned_by_retry() {path: "second.png".into(),},];- assert!(claim_staged_refs(- &crate::core::runtime::DispatchCtx::ambient(),- "thread",- &config,- "user:req",- &entries,- )- .await- .is_err());+ assert!(+ claim_staged_refs(+ &crate::core::runtime::DispatchCtx::ambient(),+ "thread",+ &config,+ "user:req",+ &entries,+ )+ .await+ .is_err()+ );let first_claim = claim("user:req", first.clone(), false);- assert!(!claim_staged_record(- &repo,- &first_claim.tenant,- "thread",- &staged_doc_id(&first_id).unwrap(),- &first,- &first_claim,- )- .unwrap());+ assert!(+ !claim_staged_record(+ &repo,+ &first_claim.tenant,+ "thread",+ &staged_doc_id(&first_id).unwrap(),+ &first,+ &first_claim,+ )+ .unwrap()+ );let other = claim("user:other", first.clone(), false);- assert!(claim_staged_record(- &repo,- &other.tenant,- "thread",- &staged_doc_id(&first_id).unwrap(),- &first,- &other,- )- .is_err());+ assert!(+ claim_staged_record(+ &repo,+ &other.tenant,+ "thread",+ &staged_doc_id(&first_id).unwrap(),+ &first,+ &other,+ )+ .is_err()+ );}#[tokio::test]@@ -381,15 +395,17 @@ async fn discarding_claimed_attachment_preserves_row_owned_file() {let repo = test_repo(&config.workspace_dir);insert_record(&repo, &staged_record(part.clone(), "committed.png"));let bound = claim("user:req", part.clone(), false);- assert!(claim_staged_record(- &repo,- &bound.tenant,- "thread",- &staged_doc_id(&opaque_id).unwrap(),- &part,- &bound,- )- .unwrap());+ assert!(+ claim_staged_record(+ &repo,+ &bound.tenant,+ "thread",+ &staged_doc_id(&opaque_id).unwrap(),+ &part,+ &bound,+ )+ .unwrap()+ );let workspace = crate::agent::attachments::thread_action_dir(&crate::core::runtime::DispatchCtx::ambient(),&config,diff --git a/tests/native_channel_session_restart_e2e.rs b/tests/native_channel_session_restart_e2e.rsindex 71ae2c7c79..54229ac9c3 100644--- a/tests/native_channel_session_restart_e2e.rs+++ b/tests/native_channel_session_restart_e2e.rs@@ -1030,7 +1030,11 @@ async fn native_telegram_typed_media_reaches_the_model_without_provider_paths()&module_source_dir,&logs.join("typed-media-restarted.log"),);- assert_ne!(first_pid, restarted.child.id(), "media resume uses a new process");+ assert_ne!(+ first_pid,+ restarted.child.id(),+ "media resume uses a new process"+ );wait_healthy(&restarted_rpc,&mut restarted,