Skip to content

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

test(resolution): add test for faulted ready module settling as failed

Steven Enamakeld942c8ff3dc9
diff --git a/crates/openhuman-core/src/modules/resolution_tests.rs b/crates/openhuman-core/src/modules/resolution_tests.rs
index 66a2810129..8a01155c9f 100644
--- a/crates/openhuman-core/src/modules/resolution_tests.rs
+++ b/crates/openhuman-core/src/modules/resolution_tests.rs
@@ -113,3 +113,23 @@ fn test_hooks_plant_and_remove_a_slot() {
table.reset_for_test("m");
assert_eq!(table.peek("m"), ResolutionState::Unresolved);
}
+
+#[test]
+fn a_ready_module_that_faults_settles_as_failed() {
+ let table = ResolutionTable::default();
+ // Nothing resolved yet: a fault report has nothing to downgrade.
+ table.mark_faulted("m", "refused".into());
+ assert_eq!(table.peek("m"), ResolutionState::Unresolved);
+
+ let (sender, _receiver) = run_claim(&table, "m");
+ table.mark_faulted("m", "refused".into());
+ assert_eq!(table.peek("m"), ResolutionState::Loading);
+
+ table.complete("m", Resolution::Ready, sender);
+ table.mark_faulted("m", "configuration refused".into());
+ assert_eq!(
+ table.peek("m"),
+ ResolutionState::Failed("configuration refused".into())
+ );
+ assert!(matches!(table.claim("m"), Claim::Done(Resolution::Failed(_))));
+}