Skip to content

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

test(artifacts): assert stored file keys and resolved paths

Steven Enamakel83530e8967d9
diff --git a/crates/openhuman-core/src/artifacts/production_tests.rs b/crates/openhuman-core/src/artifacts/production_tests.rs
index f48b568bfe..10899c16f3 100644
--- a/crates/openhuman-core/src/artifacts/production_tests.rs
+++ b/crates/openhuman-core/src/artifacts/production_tests.rs
@@ -90,9 +90,14 @@ async fn a_new_artifact_shares_one_id_and_one_file_between_card_and_record() {
// The version holds its own copy; the files folder shows the newest.
let file = record.latest().unwrap().file.clone().unwrap();
let kept = crate::artifacts::tiny_store::version_files_dir(&workspace)
+ .join("artifacts/files")
.join(&id)
.join("v1.pptx");
- assert_eq!(std::path::Path::new(&file.path), kept.as_path());
+ assert_eq!(file.key, format!("artifacts/files/{id}/v1.pptx"));
+ assert_eq!(
+ crate::artifacts::tiny_store::stored_file_path(&workspace, &file),
+ kept
+ );
assert_eq!(
files_in(&files),
vec!["quarterly-deck.pptx"],
@@ -120,7 +125,12 @@ async fn a_revision_reuses_the_id_and_file_and_keeps_the_history() {
b"deck-v2!"
);
// Each version still holds what it was.
- let bytes_of = |n: u32| std::fs::read(&record.version(n).unwrap().file.clone().unwrap().path);
+ let bytes_of = |n: u32| {
+ let file = record.version(n).unwrap().file.clone().unwrap();
+ std::fs::read(crate::artifacts::tiny_store::stored_file_path(
+ &workspace, &file,
+ ))
+ };
assert_eq!(bytes_of(1).unwrap(), b"deck-v1");
assert_eq!(bytes_of(2).unwrap(), b"deck-v2!");
}