Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

test(cua-driver): preserve foreground pixel route evidence (#3884)

lorenzozane02b599b7ef4a
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs
index 54eab02f37..646f07bd20 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/action_record.rs
@@ -1891,6 +1891,34 @@ mod tests {
assert_eq!(public.route, cua_driver_contract::ActionRoute::GlobalInput);
}
+ #[test]
+ fn foreground_cgevent_path_is_preserved_when_effect_is_unverifiable() {
+ let record = ActionExecutionRecord::from_legacy(
+ "click",
+ &serde_json::json!({"delivery_mode": "foreground"}),
+ &serde_json::json!({
+ "path": "cgevent_fg",
+ "verified": false,
+ "effect": "unverifiable",
+ }),
+ )
+ .expect("foreground CGEvent result should normalize");
+
+ assert_eq!(record.transport, ActionTransport::MacosCgEventHid);
+ assert_eq!(record.actual_delivery, Some(ActualDelivery::Foreground));
+
+ let public = record.public_result().expect("public ActionResult");
+ assert_eq!(
+ public.effect,
+ cua_driver_contract::ActionEffect::Unverifiable
+ );
+ assert_eq!(public.route, cua_driver_contract::ActionRoute::GlobalInput);
+ assert_eq!(
+ public.delivery.map(|delivery| delivery.mode),
+ Some(cua_driver_contract::ActionDeliveryMode::Foreground)
+ );
+ }
+
#[test]
fn producer_emitted_delivery_wins_over_requested_delivery() {
let record = ActionExecutionRecord::from_legacy(