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 resolve paths via helper

Steven Enamakel6a0de40533c5
diff --git a/crates/openhuman-core/src/artifacts/production_tests.rs b/crates/openhuman-core/src/artifacts/production_tests.rs
index f48b568bfe..77e92573e6 100644
--- a/crates/openhuman-core/src/artifacts/production_tests.rs
+++ b/crates/openhuman-core/src/artifacts/production_tests.rs
@@ -89,10 +89,10 @@ 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(&id)
- .join("v1.pptx");
- assert_eq!(std::path::Path::new(&file.path), kept.as_path());
+ let expected_key = format!("artifacts/files/{id}/v1.pptx");
+ assert_eq!(file.key, expected_key);
+ let kept = crate::artifacts::tiny_store::stored_file_path(&workspace, &file);
+ assert_eq!(kept, crate::artifacts::tiny_store::version_files_dir(&workspace).join(&id).join("v1.pptx"));
assert_eq!(
files_in(&files),
vec!["quarterly-deck.pptx"],
@@ -120,7 +120,10 @@ 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!");
}