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(agent): add coverage for artifact file and store helpers
Steven Enamakel9b33402a600d
diff --git a/crates/openhuman-core/src/agent/artifacts/files_tests.rs b/crates/openhuman-core/src/agent/artifacts/files_tests.rsindex e402d4304d..951b0287ce 100644--- a/crates/openhuman-core/src/agent/artifacts/files_tests.rs+++ b/crates/openhuman-core/src/agent/artifacts/files_tests.rs@@ -155,19 +155,17 @@ async fn regenerate_overwrites_the_file_it_owns() {let files_dir = tmp.path().join("Files");let original = create_ready(tmp.path(), &files_dir, "Deck", b"v1").await;- let (again, path) = REGENERATE_TARGET_ID- .scope(original.id.clone(), async {- create_artifact(- tmp.path(),- &files_dir,- ArtifactKind::Document,- "Deck",- "txt",- )- .await- })- .await- .unwrap();+ let (again, path) = create_artifact_regenerating(+ tmp.path(),+ &files_dir,+ ArtifactKind::Document,+ "Deck",+ "txt",+ None,+ Some(original.id.as_str()),+ )+ .await+ .unwrap();assert_eq!(again.id, original.id);assert_eq!(again.file, original.file);diff --git a/crates/openhuman-core/src/agent/artifacts/store_tests.rs b/crates/openhuman-core/src/agent/artifacts/store_tests.rsindex c3e84277d0..7dbc6c5a7a 100644--- a/crates/openhuman-core/src/agent/artifacts/store_tests.rs+++ b/crates/openhuman-core/src/agent/artifacts/store_tests.rs@@ -530,23 +530,21 @@ async fn create_artifact_mints_fresh_id_without_scope() {}#[tokio::test]-async fn create_artifact_reuses_id_inside_regenerate_scope() {+async fn create_artifact_reuses_id_for_an_explicit_regenerate_target() {let tmp = TempDir::new().unwrap();let workspace = tmp.path().to_path_buf();- let (meta, _path) = REGENERATE_TARGET_ID- .scope("reused-id".to_string(), async move {- create_artifact(- &workspace,- &workspace.join("Files"),- ArtifactKind::Presentation,- "Q3 Deck",- "pptx",- )- .await- })- .await- .unwrap();- // The scoped target id is reused verbatim so the card swaps in place.+ let (meta, _path) = create_artifact_regenerating(+ &workspace,+ &workspace.join("Files"),+ ArtifactKind::Presentation,+ "Q3 Deck",+ "pptx",+ None,+ Some("reused-id"),+ )+ .await+ .unwrap();+ // The explicit target id is reused verbatim so the card swaps in place.assert_eq!(meta.id, "reused-id");// And the meta is actually persisted under that id.let got = get_artifact(tmp.path(), "reused-id").await.unwrap();@@ -574,19 +572,17 @@ async fn regenerate_preserves_original_created_at() {// artifact jumps to the top of the created_at-sorted list (#3162).let id = first.id.clone();let ws = workspace.clone();- let (second, _) = REGENERATE_TARGET_ID- .scope(id.clone(), async move {- create_artifact(- &ws,- &ws.join("Files"),- ArtifactKind::Presentation,- "Deck",- "pptx",- )- .await- })- .await- .unwrap();+ let (second, _) = create_artifact_regenerating(+ &ws,+ &ws.join("Files"),+ ArtifactKind::Presentation,+ "Deck",+ "pptx",+ None,+ Some(id.as_str()),+ )+ .await+ .unwrap();assert_eq!(second.id, id);assert_eq!(second.created_at, original_created,