Skip to content

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

test(flows): update flow test assertions for preflight rejection

Steven Enamakel595d1438aa83
diff --git a/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs b/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs
index 56b1b3ffe5..ba957a2336 100644
--- a/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs
@@ -223,28 +223,17 @@ async fn flows_run_fails_cleanly_without_invoking_engine_when_inference_not_read
"error must surface the specific reason (signed out): {err}"
);
- // The run row settled `failed` with that same message, and the engine
- // never ran (no persisted steps) — this is the "no pointless work" half
- // of the contract, not just "the RPC call returned an error".
+ // Provider readiness is a host preflight before the module's StartRun
+ // admission boundary, so rejection must not create a module-owned run row
+ // or stamp the saved workflow as executed.
let runs = flows_list_runs(&config, &created.value.id, 1)
.await
.unwrap()
.value;
- let run = runs.first().expect("a run row must exist");
- assert_eq!(run.status, "failed");
- assert!(
- run.steps.is_empty(),
- "the engine must never have executed a step: {:?}",
- run.steps
- );
- let run_error = run
- .error
- .as_deref()
- .expect("a failed run must carry an error message");
- assert!(
- run_error.to_ascii_lowercase().contains("ai provider"),
- "the persisted run error must explain the AI-provider problem: {run_error}"
- );
+ assert!(runs.is_empty(), "preflight rejection must not admit a run");
+ let reloaded = flows_get(&config, &created.value.id).await.unwrap();
+ assert!(reloaded.value.last_run_at.is_none());
+ assert!(reloaded.value.last_status.is_none());
// `SignedOutTestGuard` restores the prior flag on drop at the end of this
// scope — no other test observes this override.
diff --git a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
index a898e21aef..889599fba0 100644
--- a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
@@ -404,7 +404,7 @@ async fn combine_trail_off_fallback_returns_fallback_alone_for_genuine_silence()
}
#[tokio::test]
-async fn boot_sweep_logs_catalog_registration_failure_and_continues_boot() {
+async fn boot_sweep_logs_storage_open_failure_and_continues_boot() {
let tmp = TempDir::new().unwrap();
let file_path = tmp.path().join("not_a_dir");
std::fs::write(&file_path, b"blocking file").unwrap();
@@ -445,15 +445,17 @@ async fn boot_sweep_logs_catalog_registration_failure_and_continues_boot() {
.finish();
let _subscriber_guard = tracing::subscriber::set_default(subscriber);
- // Execute the failing sweep path to exercise the real warning branch.
+ // Registration is lazy and does not open the workspace backend. The
+ // module's BootSweep reaches the scoped callback, whose backend open must
+ // fail against this file-as-directory path while boot continues.
let ctx = crate::core::runtime::DispatchCtx::ambient();
let swept = crate::flows::recovery::sweep_orphaned_runs_on_boot(&ctx, &config).await;
assert_eq!(swept, 0);
let warning = String::from_utf8(capture.0.lock().unwrap().clone()).unwrap();
assert!(
- warning.contains("create the storage directory"),
- "the sweep warning must preserve the operation context, got {warning:?}"
+ warning.contains("boot sweep failed"),
+ "the storage-open failure must be reported by the sweep, got {warning:?}"
);
assert!(
warning.contains(&file_path.display().to_string()),