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.

ci(cua-driver): execute complete Windows core tests (#3596)

Francesco Bonacci4b6d3b9f074d
diff --git a/.github/workflows/ci-rust-windows.yml b/.github/workflows/ci-rust-windows.yml
index f9dc3f170d..ab2ca7e5db 100644
--- a/.github/workflows/ci-rust-windows.yml
+++ b/.github/workflows/ci-rust-windows.yml
@@ -64,6 +64,9 @@ jobs:
# Compile every Rust target without executing desktop-dependent integration
# tests; interactive behavior belongs in e2e-rust-windows.yml.
run: cargo test -p cua-driver -p cua-driver-core -p cua-driver-sdk -p cua-driver-testkit -p cursor-overlay -p cursor-theme-cli -p platform-windows -p cua-driver-uia --all-targets --no-run --locked
+ - name: Run complete desktop-independent core tests
+ working-directory: libs/cua-driver/rust
+ run: cargo test -p cua-driver-core --lib --locked
- name: Run deferred text publication regressions
working-directory: libs/cua-driver/rust
run: |
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs
index e572f48542..1ce408ffc6 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/protocol.rs
@@ -357,7 +357,7 @@ fn agent_instructions() -> String {
} else if cfg!(target_os = "windows") {
(
"UIA (UI Automation)",
- "WINDOWS.md (UIA tree, UWP / ApplicationFrameHost hosting, Session 0 isolation)",
+ "WINDOWS.md (UIA tree, UWP/ApplicationFrameHost hosting, Session 0 isolation)",
)
} else {
(
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs
index b9405d0340..76fd8b26bf 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs
@@ -3004,6 +3004,18 @@ mod runtime_isolation_tests {
Arc::new(registry)
}
+ // Use the same canonical spelling as manifest loading, including Windows'
+ // drive and extended-length prefix. This is an identity fixture only.
+ fn fixture_executable() -> String {
+ std::env::current_exe()
+ .unwrap()
+ .canonicalize()
+ .unwrap()
+ .to_str()
+ .unwrap()
+ .to_owned()
+ }
+
fn attested_registry(
name: &str,
provider: Option<Arc<dyn ProtectedConsentProvider>>,
@@ -3017,7 +3029,7 @@ mod runtime_isolation_tests {
"fingerprint": {
"pid": 424242,
"start_time": 7,
- "executable": "/synthetic/fixture"
+ "executable": fixture_executable()
}
}),
"get_window_state" => serde_json::json!({
@@ -3027,7 +3039,7 @@ mod runtime_isolation_tests {
"fingerprint": {
"pid": 424242,
"start_time": 7,
- "executable": "/synthetic/fixture"
+ "executable": fixture_executable()
}
}),
_ => serde_json::json!({
@@ -3244,7 +3256,7 @@ mod runtime_isolation_tests {
async fn bounded_observation_uses_only_the_manifest_without_a_protected_host() {
let hits = Arc::new(AtomicUsize::new(0));
let registry = attested_registry("get_window_state", None, hits.clone(), false);
- let context = bounded_context(
+ let context = bounded_context(&format!(
r#"
version: 2
mode: bounded
@@ -3254,12 +3266,13 @@ allow:
tools: [get_window_state]
resources:
apps:
- - executable: /synthetic/fixture
+ - executable: {executable}
launch: false
windows: all
terminate: deny
"#,
- );
+ executable = serde_json::to_string(&fixture_executable()).unwrap()
+ ));
let result = registry
.invoke_with_context(
"get_window_state",
@@ -3279,15 +3292,18 @@ resources:
let registry = attested_registry("get_window_state", None, allowed_hits.clone(), false);
let allowed = manifest_context(
mode,
- r#"
+ &format!(
+ r#"
version: 3
allow:
tools: [get_window_state]
resources:
apps:
- - executable: /synthetic/fixture
+ - executable: {executable}
windows: all
"#,
+ executable = serde_json::to_string(&fixture_executable()).unwrap()
+ ),
);
let result = registry
.invoke_with_context(
@@ -3303,15 +3319,22 @@ resources:
let registry = attested_registry("get_window_state", None, denied_hits.clone(), false);
let denied = manifest_context(
mode,
- r#"
+ &format!(
+ r#"
version: 3
allow:
tools: [get_window_state]
resources:
apps:
- - executable: /another/application
+ - executable: {executable}
windows: all
"#,
+ executable = serde_json::to_string(
+ &std::path::Path::new(&fixture_executable())
+ .with_file_name("another-application.exe")
+ )
+ .unwrap()
+ ),
);
let result = registry
.invoke_with_context(
@@ -3927,7 +3950,7 @@ resources:
crate::browser::ProcessFingerprint {
pid: 424242,
start_time: Some(7),
- executable: Some("/synthetic/fixture".to_owned()),
+ executable: Some(fixture_executable()),
},
);
@@ -3955,7 +3978,7 @@ resources:
crate::browser::ProcessFingerprint {
pid: 424242,
start_time: Some(7),
- executable: Some("/synthetic/fixture".to_owned()),
+ executable: Some(fixture_executable()),
},
);
@@ -3985,7 +4008,7 @@ resources:
crate::browser::ProcessFingerprint {
pid: 424242,
start_time: Some(7),
- executable: Some("/synthetic/fixture".to_owned()),
+ executable: Some(fixture_executable()),
},
);
@@ -4088,7 +4111,7 @@ resources:
crate::browser::ProcessFingerprint {
pid: 424242,
start_time: Some(7),
- executable: Some("/synthetic/fixture".to_owned()),
+ executable: Some(fixture_executable()),
},
);