Skip to content

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

fix(test): update approval gate tests to reflect new validation logic

Steven Enamakel556bd64223ae
diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rs
index 8a5799d871..a742d3a5d8 100644
--- a/crates/openhuman-core/src/security/approval/gate_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs
@@ -203,6 +203,24 @@ async fn find_flow_gate_notification(
}
}
+/// Drain `rx` until an `ApprovalDecided` for `expected_request_id` arrives.
+/// Mirrors [`find_flow_approval_requested`]'s filter-not-first-match
+/// discipline for the same process-wide-bus reason.
+async fn find_approval_decided(
+ rx: &mut tinybus::events::EventReceiver<crate::core::events::DomainEvent>,
+ expected_request_id: &str,
+) -> crate::core::events::DomainEvent {
+ loop {
+ match rx.recv().await {
+ Some(
+ ev @ crate::core::events::DomainEvent::ApprovalDecided { ref request_id, .. },
+ ) if request_id == expected_request_id => return ev,
+ Some(_) => continue,
+ None => panic!("the bus closed before the expected event arrived"),
+ }
+ }
+}
+
#[path = "gate_core_flow_tests.rs"]
mod core_flow_tests;
#[path = "gate_origin_intercept_tests.rs"]