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/cutover_tests.rs,crates/openhuman-core/src/cron/

Steven Enamakel0b4d9704aa97
diff --git a/crates/openhuman-core/src/cron/cutover_tests.rs b/crates/openhuman-core/src/cron/cutover_tests.rs
index 65b5da3e06..d69759a5f8 100644
--- a/crates/openhuman-core/src/cron/cutover_tests.rs
+++ b/crates/openhuman-core/src/cron/cutover_tests.rs
@@ -54,7 +54,7 @@ async fn a_seeded_system_job_fires_through_the_module_and_records_its_handler()
.into_iter()
.find(|job| system_jobs::system_job_name(job) == Some(BACKGROUND_JOB))
.expect("the memory background job is seeded");
- store::force_next_run_for_test(
+ store::tests::force_next_run_for_test(
&config,
&job.id,
chrono::Utc::now() - chrono::Duration::seconds(1),
@@ -111,7 +111,7 @@ async fn a_flow_schedule_row_is_answered_by_the_flow_handler_on_a_tick() {
},
)
.unwrap();
- store::force_next_run_for_test(
+ store::tests::force_next_run_for_test(
&config,
&row.id,
chrono::Utc::now() - chrono::Duration::seconds(1),
diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
index 604e53b6a9..d903a547e6 100644
--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
@@ -60,7 +60,7 @@ fn due_system_job(config: &Config, name: &str) -> CronJob {
}
fn force_due(config: &Config, job_id: &str) {
- crate::cron::store::force_next_run_for_test(
+ crate::cron::store::tests::force_next_run_for_test(
config,
job_id,
Utc::now() - ChronoDuration::seconds(1),
@@ -207,7 +207,9 @@ fn only_one_scheduler_loop_holds_the_slot() {
async fn an_upgraded_job_with_a_side_table_policy_keeps_firing_with_it() {
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp).await;
- let legacy = crate::cron::store::legacy_db_path(&config);
+ let legacy = crate::storage::import::tinyflows::legacy_jobs_db(
+ &crate::core::runtime::agent_scope_dir(&config),
+ );
std::fs::create_dir_all(legacy.parent().unwrap()).unwrap();
std::fs::copy(
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
index 0306180363..97db2c8176 100644
--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
@@ -355,7 +355,7 @@ async fn cron_agent_job_uses_agent_definition_tool_scope() {
/// Runs `job_id` once through the schedule runtime (claim, execute, deliver,
/// record, complete) the way a poll would find it: due now, never retried.
async fn run_through_scheduler(config: &Config, job_id: &str) {
- crate::cron::store::force_next_run_for_test(
+ crate::cron::store::tests::force_next_run_for_test(
config,
job_id,
Utc::now() - ChronoDuration::seconds(1),
@@ -417,7 +417,7 @@ async fn scheduler_flow_runs_active_hours_job_and_reschedules_inside_window() {
"echo active-hours-fired",
)
.unwrap();
- crate::cron::store::force_next_run_for_test(
+ crate::cron::store::tests::force_next_run_for_test(
&config,
&job.id,
Utc::now() - ChronoDuration::seconds(1),
@@ -537,7 +537,14 @@ async fn an_at_job_without_the_delete_flag_runs_once_and_is_never_due_again() {
assert_eq!(updated.last_status.as_deref(), Some("ok"));
// It is never due again — even at a time past its `at` instant.
- let due = cron::due_jobs(&config, at + ChronoDuration::minutes(1)).unwrap();
+ let due = crate::cron::client::store::<Vec<CronJob>>(
+ &config,
+ tinyflows_bus::schedule::StoreOperation::Due {
+ now: at + ChronoDuration::minutes(1),
+ },
+ )
+ .await
+ .unwrap();
assert!(
!due.iter().any(|j| j.id == job.id),
"disabled At job must not be re-selected by due_jobs"
diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rs
index c9f8ce9958..afa33a6313 100644
--- a/crates/openhuman-core/src/cron/store_tests.rs
+++ b/crates/openhuman-core/src/cron/store_tests.rs
@@ -100,18 +100,6 @@ fn jobs_live_in_the_workspace_default_database() {
assert!(tmp.path().join("workspace/storage/storage.db").is_file());
}
-#[test]
-fn due_jobs_batch_size_follows_scheduler_max_tasks() {
- let tmp = TempDir::new().unwrap();
- let mut config = test_config(&tmp);
- config.scheduler.max_tasks = 2;
- for i in 0..3 {
- add_job(&config, "* * * * *", &format!("echo due-{i}")).unwrap();
- }
- let far_future = Utc::now() + ChronoDuration::days(365);
- assert_eq!(due_jobs(&config, far_future).unwrap().len(), 2);
-}
-
#[test]
fn run_history_cap_follows_cron_max_run_history() {
let tmp = TempDir::new().unwrap();
@@ -287,7 +275,9 @@ fn legacy_fixture() -> std::path::PathBuf {
fn a_legacy_jobs_db_is_imported_by_the_storage_importer_and_left_untouched() {
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp);
- let legacy = legacy_db_path(&config);
+ let legacy = crate::storage::import::tinyflows::legacy_jobs_db(
+ &crate::core::runtime::agent_scope_dir(&config),
+ );
std::fs::create_dir_all(legacy.parent().unwrap()).unwrap();
std::fs::copy(legacy_fixture(), &legacy).unwrap();
let before = std::fs::read(&legacy).unwrap();