Skip to content

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

chore: files changed crates/openhuman-core/src/cron/policy_tests.rs,crates/openhuman-core/src/storag

Steven Enamakel7155ce6c1824
diff --git a/crates/openhuman-core/src/cron/policy_tests.rs b/crates/openhuman-core/src/cron/policy_tests.rs
index 0c993751eb..de39797ca0 100644
--- a/crates/openhuman-core/src/cron/policy_tests.rs
+++ b/crates/openhuman-core/src/cron/policy_tests.rs
@@ -148,3 +148,18 @@ fn clearing_the_policy_of_a_missing_job_is_not_an_error() {
let config = config(&tmp);
clear_policy(&config, "no-such-job").unwrap();
}
+
+#[test]
+fn only_the_stores_own_missing_job_message_counts_as_missing() {
+ assert!(is_missing(
+ &anyhow::anyhow!("Cron job 'j1' not found"),
+ "j1"
+ ));
+ assert!(!is_missing(
+ &anyhow::anyhow!("Cron job 'j2' not found"),
+ "j1"
+ ));
+ // A backend failure that merely mentions "not found" must fail closed.
+ let backend = anyhow::anyhow!("collection not found").context("cron store: backend failed");
+ assert!(!is_missing(&backend, "j1"));
+}
diff --git a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
index 7a73ddab98..4885f42022 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
@@ -382,3 +382,28 @@ fn a_corrupt_legacy_file_fails_without_a_marker_and_is_retried() {
let retried = import_cron(&backend, &Scope::local(), &config, dir.path(), "").unwrap();
assert_eq!(written(retried), 7);
}
+
+#[test]
+fn a_run_that_skipped_records_leaves_no_marker_so_it_is_retried() {
+ let dir = TempDir::new().unwrap();
+ let backend = backend();
+ let skipped = marked(&backend, dir.path(), "skipdomain", || Ok(Some((3, 2, 1)))).unwrap();
+ assert_eq!(
+ skipped,
+ Outcome::Imported {
+ found: 3,
+ written: 2
+ }
+ );
+ // No marker: the next boot runs the body again instead of `AlreadyDone`.
+ let again = marked(&backend, dir.path(), "skipdomain", || Ok(Some((3, 3, 0)))).unwrap();
+ assert_eq!(
+ again,
+ Outcome::Imported {
+ found: 3,
+ written: 3
+ }
+ );
+ let done = marked(&backend, dir.path(), "skipdomain", || Ok(Some((3, 3, 0)))).unwrap();
+ assert_eq!(done, Outcome::AlreadyDone);
+}