Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(artifacts): read artifact metadata from the document store

Steven Enamakelf17ed7ee8f2c
diff --git a/crates/openhuman-core/src/config/ops_files_dir_tests.rs b/crates/openhuman-core/src/config/ops_files_dir_tests.rs
index d1ba54e0f1..5667fc16d1 100644
--- a/crates/openhuman-core/src/config/ops_files_dir_tests.rs
+++ b/crates/openhuman-core/src/config/ops_files_dir_tests.rs
@@ -147,6 +147,9 @@ async fn boot_migrates_legacy_files_into_the_chosen_folder() {
tool_call_id: None,
};
save_artifact_meta(&cfg.workspace_dir, &meta).await.unwrap();
+ // The record lives in the document store now, so the legacy content
+ // directory is created by hand, as an older install left it.
+ std::fs::create_dir_all(cfg.workspace_dir.join("artifacts/legacy")).unwrap();
std::fs::write(
cfg.workspace_dir.join("artifacts/legacy/plan.docx"),
b"plan",
diff --git a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
index fc15401a30..aec45e8c31 100644
--- a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
+++ b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
@@ -96,11 +96,11 @@ async fn files_a_single_generated_artifact() {
// Original staged file is gone (moved).
assert!(!staging.join("stub-0.png").exists());
- // Artifact metadata + file both landed under the artifacts root.
- let artifact_dir = workspace.join("artifacts").join(artifact_id);
- assert!(artifact_dir.join("meta.json").exists());
- let meta_raw = std::fs::read_to_string(artifact_dir.join("meta.json")).unwrap();
- assert!(meta_raw.contains("\"image\""));
+ // The artifact record lives in the document store (no `meta.json`).
+ let meta = crate::agent::artifacts::store::get_artifact(&workspace, artifact_id)
+ .await
+ .unwrap();
+ assert_eq!(meta.kind, ArtifactKind::Image);
}
#[tokio::test]
@@ -130,11 +130,12 @@ async fn files_every_artifact_when_n_greater_than_one() {
for entry in artifacts {
let id = entry["artifact_id"].as_str().expect("artifact_id set");
assert!(ids.insert(id.to_string()), "artifact ids must be unique");
- assert!(workspace
- .join("artifacts")
- .join(id)
- .join("meta.json")
- .exists());
+ assert!(
+ crate::agent::artifacts::store::get_artifact(&workspace, id)
+ .await
+ .is_ok(),
+ "artifact {id} has a record in the document store"
+ );
}
}