Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
test(cua-driver): prune redundant installer and release-tooling tests (#4107)
Francesco Bonaccice67410815a4
diff --git a/.github/scripts/tests/test_authorized_live_jev_macos_evidence.py b/.github/scripts/tests/test_authorized_live_jev_macos_evidence.pydeleted file mode 100644index 503295da84..0000000000--- a/.github/scripts/tests/test_authorized_live_jev_macos_evidence.py+++ /dev/null@@ -1,11 +0,0 @@-from pathlib import Path---ROOT = Path(__file__).resolve().parents[3]-MACOS_ENTRY = ROOT / ".github/workflows/e2e-rust-macos.yml"---def test_direct_lume_certification_stays_outside_actions() -> None:- text = MACOS_ENTRY.read_text(encoding="utf-8")- assert "run-all.sh --standalone-browser" not in text- assert "authorized-live-jev-macos-evidence.yml" not in textdiff --git a/.github/scripts/tests/test_macos_hosted_e2e_workflow.py b/.github/scripts/tests/test_macos_hosted_e2e_workflow.pyindex f48566d963..b21f8cea4c 100644--- a/.github/scripts/tests/test_macos_hosted_e2e_workflow.py+++ b/.github/scripts/tests/test_macos_hosted_e2e_workflow.py@@ -4,16 +4,184 @@ Maintainers dispatch it for pull request evidence, and the stable Cua Drivertag run calls it as an automatic release gate."""+import json+import os+import shutil+import subprocessfrom pathlib import Path+import pytest+REPO_ROOT = Path(__file__).resolve().parents[3]+PROBE = REPO_ROOT / "scripts/ci/macos/probe-hosted-runner.sh"+HOSTED_RUNNER = REPO_ROOT / "scripts/ci/macos/run-hosted-rust-e2e.sh"+SOURCE_SHA = "a" * 40def read(relative_path: str) -> str:return (REPO_ROOT / relative_path).read_text()+def _write_executable(path: Path, body: str) -> None:+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(f"#!/bin/sh\n{body}\n", encoding="utf-8")+ path.chmod(0o755)+++def _hosted_env(tmp_path: Path, **overrides: str) -> dict[str, str]:+ """A fresh environment that satisfies every hosted-runner identity gate."""+ env = {+ "PATH": os.environ["PATH"],+ "HOME": str(tmp_path / "home"),+ "RUNNER_TEMP": str(tmp_path / "runner-temp"),+ "GITHUB_ACTIONS": "true",+ "CI": "true",+ "GITHUB_EVENT_NAME": "workflow_dispatch",+ "RUNNER_ENVIRONMENT": "github-hosted",+ "RUNNER_OS": "macOS",+ "ImageOS": "macos26",+ "CUA_E2E_SOURCE_SHA": SOURCE_SHA,+ "CUA_E2E_INTERNAL_LANE": "shared",+ }+ env.update(overrides)+ return {key: value for key, value in env.items() if value}+++PROBE_REFUSALS = [+ ({"GITHUB_ACTIONS": ""}, "GITHUB_ACTIONS must be true"),+ ({"RUNNER_ENVIRONMENT": "self-hosted"}, "runner must be GitHub-hosted"),+ ({"CI": ""}, "CI must be true"),+ ({"GITHUB_EVENT_NAME": "pull_request"}, "probe must be manually dispatched or run by a stable cua-driver-rs tag release gate"),+ (+ {"GITHUB_EVENT_NAME": "push", "GITHUB_REF": "refs/heads/main"},+ "probe must be manually dispatched or run by a stable cua-driver-rs tag release gate",+ ),+ (+ {"GITHUB_EVENT_NAME": "push", "GITHUB_REF": "refs/tags/lume-v0.3.0"},+ "probe must be manually dispatched or run by a stable cua-driver-rs tag release gate",+ ),+ ({"CUA_E2E_SOURCE_SHA": "main"}, "source SHA must contain 40 hexadecimal characters"),+ (+ {"SSH_CONNECTION": "192.0.2.1 50000 192.0.2.2 22"},+ "SSH sessions cannot seed or certify hosted TCC state",+ ),+]+++def _run_probe(tmp_path: Path, env: dict[str, str]) -> tuple[subprocess.CompletedProcess[str], Path]:+ artifact_dir = tmp_path / "probe"+ env = {**env, "CUA_MACOS_HOSTED_PROBE_DIR": str(artifact_dir)}+ completed = subprocess.run(+ ["bash", str(PROBE)], capture_output=True, text=True, env=env, check=False+ )+ return completed, artifact_dir+++def _refusal_id(row: tuple[dict[str, str], str]) -> str:+ return ",".join(f"{key}={value or 'unset'}" for key, value in row[0].items())+++ ("overrides", "message"), PROBE_REFUSALS, ids=[_refusal_id(row) for row in PROBE_REFUSALS]+)+def test_hosted_macos_probe_refuses_outside_a_dispatched_hosted_run(+ tmp_path: Path, overrides: dict[str, str], message: str+) -> None:+ completed, artifact_dir = _run_probe(tmp_path, _hosted_env(tmp_path, **overrides))++ assert completed.returncode == 1+ assert completed.stderr.strip() == message+ environment = json.loads((artifact_dir / "environment.json").read_text())+ assert environment["status"] == "failed"+ assert environment["message"] == message+ # Refusal happens before any system inventory or GUI capture.+ assert sorted(path.name for path in artifact_dir.iterdir()) == ["environment.json"]+++ "event",+ [+ {"GITHUB_EVENT_NAME": "workflow_dispatch"},+ {"GITHUB_EVENT_NAME": "push", "GITHUB_REF": "refs/tags/cua-driver-rs-v0.29.0"},+ ],+ ids=["workflow_dispatch", "stable-tag-push"],+)+def test_hosted_macos_probe_identity_gates_pass_for_a_dispatched_hosted_run(+ tmp_path: Path, event: dict[str, str]+) -> None:+ """Control: the refusal rows fail only because of their one override."""+ completed, _ = _run_probe(tmp_path, _hosted_env(tmp_path, **event))++ assert completed.returncode != 0+ for _, message in PROBE_REFUSALS:+ assert message not in completed.stderr+++HOSTED_RUNNER_REFUSALS = [+ ({"GITHUB_ACTIONS": ""}, "requires GitHub Actions"),+ ({"GITHUB_EVENT_NAME": "pull_request"}, "runs only from workflow_dispatch or a stable cua-driver-rs tag release gate"),+ (+ {"GITHUB_EVENT_NAME": "push", "GITHUB_REF": "refs/heads/main"},+ "runs only from workflow_dispatch or a stable cua-driver-rs tag release gate",+ ),+ (+ {"GITHUB_EVENT_NAME": "push", "GITHUB_REF": "refs/tags/lume-v0.3.0"},+ "runs only from workflow_dispatch or a stable cua-driver-rs tag release gate",+ ),+ ({"RUNNER_ENVIRONMENT": "self-hosted"}, "requires a GitHub-hosted runner"),+ ({"RUNNER_OS": "Linux"}, "requires RUNNER_OS=macOS"),+ ({"ImageOS": "macos15"}, "requires the macos-26 runner image"),+ ({"SSH_TTY": "/dev/ttys001"}, "SSH sessions cannot seed or certify hosted TCC state"),+ (+ {"CUA_E2E_INTERNAL_LANE": "all"},+ "CUA_E2E_INTERNAL_LANE must be shared, native, capture, or browser",+ ),+]+++def _run_hosted_runner(+ tmp_path: Path, overrides: dict[str, str]+) -> tuple[subprocess.CompletedProcess[str], Path, Path]:+ """Run a copy whose repository root is tmp_path, with privileged tools recorded."""+ checkout = tmp_path / "checkout"+ script = checkout / "scripts/ci/macos" / HOSTED_RUNNER.name+ script.parent.mkdir(parents=True)+ shutil.copy2(HOSTED_RUNNER, script)+ fake_bin = tmp_path / "bin"+ privileged = tmp_path / "privileged-calls"+ _write_executable(fake_bin / "uname", "echo Darwin")+ for tool in ("security", "sudo", "codesign", "tccutil"):+ _write_executable(fake_bin / tool, f'echo "{tool} $*" >> "{privileged}"')+ env = _hosted_env(tmp_path, **overrides)+ env["PATH"] = f"{fake_bin}:{env['PATH']}"+ completed = subprocess.run(+ ["bash", str(script)], capture_output=True, text=True, env=env, check=False+ )+ return completed, checkout / "artifacts/cua-driver/macos-hosted-bootstrap", privileged+++ os.uname().sysname == "Darwin",+ reason="the refusal path's diagnostics trap reads the real macOS unified log",+)+ ("overrides", "message"),+ HOSTED_RUNNER_REFUSALS,+ ids=[_refusal_id(row) for row in HOSTED_RUNNER_REFUSALS],+)+def test_hosted_macos_runner_refuses_before_touching_signing_state(+ tmp_path: Path, overrides: dict[str, str], message: str+) -> None:+ completed, bootstrap, privileged = _run_hosted_runner(tmp_path, overrides)++ assert completed.returncode == 2+ assert completed.stderr.strip() == f"hosted-macos-e2e: {message}"+ assert (bootstrap / "exit-status.txt").read_text() == "2\n"+ assert not privileged.exists(), privileged.read_text()+ assert not (tmp_path / "runner-temp/cua-driver-hosted-signing.keychain-db").exists()++def test_hosted_macos_probe_is_manual_exact_sha_and_least_privilege() -> None:workflow = read(".github/workflows/e2e-rust-macos.yml")@@ -101,13 +269,8 @@ def test_hosted_macos_probe_fails_closed_before_gui_capture() -> None:probe = read("scripts/ci/macos/probe-hosted-runner.sh")for requirement in (- 'GITHUB_ACTIONS:-}" == true',- 'RUNNER_ENVIRONMENT:-}" == github-hosted',- 'GITHUB_EVENT_NAME:-}" != workflow_dispatch',- '"${GITHUB_EVENT_NAME:-}" == push && "${GITHUB_REF:-}" == refs/tags/cua-driver-rs-v*',"current user must be runner","console user must be runner",- "SSH sessions cannot seed or certify hosted TCC state","csrutil status","System Integrity Protection must be disabled",'launchctl print "gui/${CURRENT_UID}"',@@ -115,7 +278,6 @@ def test_hosted_macos_probe_fails_closed_before_gui_capture() -> None:):assert requirement in probe- assert "trap write_environment EXIT" in probeassert "AXIsProcessTrusted" in read("scripts/ci/macos/verify-hosted-window.swift")assert "CGPreflightScreenCaptureAccess" in read("scripts/ci/macos/verify-hosted-window.swift")@@ -160,11 +322,6 @@ def test_hosted_macos_runner_is_strict_and_uses_the_canonical_matrix() -> None:runner = read("scripts/ci/macos/run-hosted-rust-e2e.sh")for requirement in (- 'GITHUB_ACTIONS:-}" == true',- 'GITHUB_EVENT_NAME:-}" != workflow_dispatch',- '"${GITHUB_EVENT_NAME:-}" == push && "${GITHUB_REF:-}" == refs/tags/cua-driver-rs-v*',- 'RUNNER_ENVIRONMENT:-}" == github-hosted',- 'ImageOS:-}" == macos26','CURRENT_USER}" == runner','CONSOLE_USER}" == runner','MODEL}" == VirtualMac*',@@ -175,7 +332,6 @@ def test_hosted_macos_runner_is_strict_and_uses_the_canonical_matrix() -> None:assert requirement in runnerassert "security create-keychain" in runner- assert "ensure_local_signing_identity" in runnerassert "security add-trusted-cert" in runnerassert runner.index('TRUSTED_IDENTITY="${IDENTITY}"') < runner.index("security add-trusted-cert"@@ -183,25 +339,19 @@ def test_hosted_macos_runner_is_strict_and_uses_the_canonical_matrix() -> None:assert "-p codeSign" in runnerassert "security remove-trusted-cert" in runnerassert "security delete-certificate" in runner- assert "cleanup-attempts.txt" in runner- assert "verify_system_certificate_absent" in runner- assert "verify_code_signing_trust_absent" in runnerassert "security dump-trust-settings -d" in runner- assert "cleanup-trust-settings.txt" in runnerassert "security verify-cert" not in runnerassert "security set-key-partition-list" in runnerassert "set-keychain-settings -lut 21600" in runnerassert "security list-keychains -d user -s" in runnerassert '"${ORIGINAL_KEYCHAINS[@]}"' in runnerassert "run_bounded 30 codesign" in runner- assert "phase.txt" in runnerassert "--require-stable-signing" in runnerassert 'grep -Fq "certificate leaf"' in runnerassert "ScreenCaptureApprovals.plist" in runnerassert 'SCREEN_CAPTURE_CLIENT="com.trycua.driver.local"' in runnerassert "kScreenCaptureApprovalLastAlerted" in runnerassert "kScreenCaptureApprovalLastUsed" in runner- assert "screen-capture-approval.txt" in runnerassert "killall -HUP replayd" in runnerassert "seed-tcc-guest.sh" in runnerassert "--expected-client com.trycua.driver.local" in runner@@ -214,12 +364,7 @@ def test_hosted_macos_runner_is_strict_and_uses_the_canonical_matrix() -> None:assert "trap 'exit 130' INT" in runnerassert "trap 'exit 143' TERM" in runnerassert 'bash "${SCRIPT_DIR}/probe-hosted-runner.sh"' in runner- assert "watch_daemon" in runner- assert "daemon status probe failed; confirming before restart" in runner- assert "The hosted daemon required a watchdog restart during the matrix" in runner- assert "cleanup-status.txt" in runnerassert "permissions grant" not in runner- assert "cleanup-targets.txt" in runnerdef test_hosted_macos_browser_lane_mirrors_the_lume_standalone_browser_matrix() -> None:diff --git a/.github/scripts/tests/test_release_attribution.py b/.github/scripts/tests/test_release_attribution.pyindex 6b781eef5e..d7add6af30 100644--- a/.github/scripts/tests/test_release_attribution.py+++ b/.github/scripts/tests/test_release_attribution.py@@ -15,6 +15,7 @@ from release_attribution import (_change_contributors,build_manifest,changelog_references_change,+ commits_in_range,find_previous_tag,is_perception_only_diff,linked_issue_numbers,@@ -694,6 +695,42 @@ def _commit(root: Path, path: str, content: str, subject: str) -> str:return git(root, "rev-parse", "HEAD")+def test_change_detection_skips_only_excluded_crate_and_companion_commits(tmp_path: Path):+ """Driver nightlies ignore Perception-only changes, even with lockfile companions."""+ driver = "libs/cua-driver"+ perception = "libs/cua-driver/rust/crates/cua-perception"+ lockfile = "libs/cua-driver/rust/Cargo.lock"+ git(tmp_path, "init")+ git(tmp_path, "config", "user.name", "Release Test")+ git(tmp_path, "config", "user.email", "[email protected]")+ _commit(tmp_path, f"{driver}/src.rs", "base\n", "chore: seed fixture")+ git(tmp_path, "tag", "base")++ def change(subject: str, *paths: str) -> None:+ for path in paths:+ target = tmp_path / path+ target.parent.mkdir(parents=True, exist_ok=True)+ target.write_text(f"{subject}\n")+ git(tmp_path, "add", ".")+ git(tmp_path, "commit", "-m", subject)++ change("perception only", f"{perception}/src/lib.rs")+ change("perception with lockfile", f"{perception}/Cargo.toml", lockfile)+ change("perception with driver source", f"{perception}/src/lib.rs", lockfile, f"{driver}/src.rs")+ change("lockfile only", lockfile)+ change("driver only", f"{driver}/src.rs")++ commits = commits_in_range(+ tmp_path, "base", "HEAD", [driver], [perception], [lockfile]+ )++ assert [commit.subject for commit in commits] == [+ "perception with driver source",+ "lockfile only",+ "driver only",+ ]++def test_previous_tag_ignores_a_higher_abandoned_version_tag(tmp_path: Path):git(tmp_path, "init")git(tmp_path, "config", "user.name", "Release Test")diff --git a/.github/scripts/tests/test_release_channels.py b/.github/scripts/tests/test_release_channels.pyindex 937ae1f70d..5451046686 100644--- a/.github/scripts/tests/test_release_channels.py+++ b/.github/scripts/tests/test_release_channels.py@@ -299,6 +299,32 @@ def test_plan_builds_only_for_declared_relevant_changes(monkeypatch: pytest.Monkassert plan["attributionBaseTag"] == plan["previousNightlyTag"]+def _record_change_detection(monkeypatch: pytest.MonkeyPatch) -> list[tuple]:+ """Record change-detection calls and report no Driver-owned commits.++ Whether a commit is Perception-only is owned by commits_in_range and tested+ against a real repository in test_release_attribution.py; these plan tests+ prove the registry's exclusions reach it and that an empty result skips.+ """+ calls: list[tuple] = []++ def commits_in_range(_root, previous, source, paths, excluded, companions):+ calls.append((previous, source, paths, excluded, companions))+ return []++ monkeypatch.setattr(release_channels.release_attribution, "commits_in_range", commits_in_range)+ return calls+++def _assert_driver_change_detection_excludes_perception(call: tuple) -> None:+ _, _, paths, excluded, companions = call+ assert "libs/cua-driver" in paths+ assert "libs/cua-driver/rust/crates/cua-perception" in excluded+ assert {"libs/cua-driver/rust/Cargo.toml", "libs/cua-driver/rust/Cargo.lock"} <= set(+ companions+ )++def test_driver_plan_ignores_perception_only_changes(monkeypatch: pytest.MonkeyPatch):previous_sha = "b" * 40source_sha = "c" * 40@@ -311,17 +337,7 @@ def test_driver_plan_ignores_perception_only_changes(monkeypatch: pytest.MonkeyPraise AssertionError((command, args))monkeypatch.setattr(release_channels, "_git", fake_git)- monkeypatch.setattr(- release_channels.release_attribution,- "commits_in_range",- lambda _root, _previous, _source, paths, excluded, companions: (- []- if "libs/cua-driver" in paths- and "libs/cua-driver/rust/crates/cua-perception" in excluded- and "libs/cua-driver/rust/Cargo.toml" in companions- else [object()]- ),- )+ calls = _record_change_detection(monkeypatch)plan = plan_nightly("cua-driver-rs",source_sha,@@ -339,6 +355,9 @@ def test_driver_plan_ignores_perception_only_changes(monkeypatch: pytest.MonkeyP)assert plan["shouldBuild"] is Falseassert plan["reason"] == "component-unchanged"+ assert len(calls) == 1+ assert calls[0][:2] == ("nightly-cua-driver-rs-v0.19.4-nightly.20260811.41", source_sha)+ _assert_driver_change_detection_excludes_perception(calls[0])def test_first_driver_nightly_ignores_perception_only_changes(@@ -358,13 +377,7 @@ def test_first_driver_nightly_ignores_perception_only_changes(raise AssertionError((command, args))monkeypatch.setattr(release_channels, "_git", fake_git)- monkeypatch.setattr(- release_channels.release_attribution,- "commits_in_range",- lambda _root, previous, _source, _paths, _excluded, _companions: (- [] if previous == driver_tag else [object()]- ),- )+ calls = _record_change_detection(monkeypatch)plan = plan_nightly("cua-driver-rs",source_sha,@@ -376,6 +389,10 @@ def test_first_driver_nightly_ignores_perception_only_changes()assert plan["shouldBuild"] is Falseassert plan["reason"] == "component-unchanged"+ # With no earlier nightly, change detection starts at the current stable tag.+ assert len(calls) == 1+ assert calls[0][:2] == (driver_tag, source_sha)+ _assert_driver_change_detection_excludes_perception(calls[0])def test_plan_holds_before_build_for_unresolved_attribution(diff --git a/.github/scripts/tests/test_verify_cua_driver_release_archives.py b/.github/scripts/tests/test_verify_cua_driver_release_archives.pyindex f73473cf76..5bf00181ce 100644--- a/.github/scripts/tests/test_verify_cua_driver_release_archives.py+++ b/.github/scripts/tests/test_verify_cua_driver_release_archives.py@@ -144,26 +144,28 @@ def test_non_executable_unix_binary_fails_closed(tmp_path: Path) -> None:@pytest.mark.parametrize(- ("archive_suffix", "member"),+ ("archive_suffix", "member", "reason"),(- ("linux-x86_64-binary.tar.gz", "cua-perception"),- ("darwin-universal.tar.gz", "models/detector.onnx"),- ("windows-x86_64.zip", "onnxruntime.dll"),- ("windows-arm64-binary.zip", "signed-catalog.json"),+ ("linux-x86_64-binary.tar.gz", "cua-perception", "cua-perception worker"),+ ("darwin-universal.tar.gz", "models/detector.onnx", "model directory"),+ ("linux-arm64-binary.tar.gz", "detector.onnx", "model payload"),+ ("windows-x86_64.zip", "onnxruntime.dll", "ONNX Runtime"),+ ("windows-arm64-binary.zip", "signed-catalog.json", "extension catalog"),),)def test_optional_perception_payload_fails_closed(- tmp_path: Path, archive_suffix: str, member: str+ tmp_path: Path, archive_suffix: str, member: str, reason: str) -> None:contracts = _write_valid_release(tmp_path)target = next(contract for contract in contracts if contract.filename.endswith(archive_suffix))_rewrite_with_extra_member(tmp_path / target.filename, target, member)- with pytest.raises(- ContractError,- match=rf"{target.filename} contains (?:forbidden optional perception payload .*|unexpected member)",- ):+ # The payload guard, not the generic unexpected-member check, must reject it.+ with pytest.raises(ContractError) as error:verify_release_archives(tmp_path, VERSION)+ assert str(error.value) == (+ f"{target.filename} contains forbidden optional perception payload ({reason}): {member}"+ )def test_agpl_notice_content_fails_closed(tmp_path: Path) -> None:diff --git a/libs/cua-driver/scripts/tests/test_install_local.py b/libs/cua-driver/scripts/tests/test_install_local.pyindex 9733d03fec..bc5505d172 100644--- a/libs/cua-driver/scripts/tests/test_install_local.py+++ b/libs/cua-driver/scripts/tests/test_install_local.py@@ -12,6 +12,8 @@ INSTALL_LOCAL = Path(__file__).resolve().parents[1] / "_install-local-rust.sh"LOCAL_SIGNING = INSTALL_LOCAL.with_name("_local-signing.sh")DISPATCHER = INSTALL_LOCAL.with_name("install-local.sh")WINDOWS_INSTALL_LOCAL = INSTALL_LOCAL.with_name("install-local.ps1")+POST_INSTALL_HINTS = INSTALL_LOCAL.with_name("post-install-hints.txt")+MIGRATION_WARNING = "Existing MCP clients configured for 'cua-driver' will not use this local build."SKILL_PACK = INSTALL_LOCAL.parents[1] / "rust/Skills/cua-driver"@@ -31,6 +33,19 @@ def test_local_installers_stage_the_canonical_skill_pack() -> None:}+def test_windows_local_install_reports_missing_release_cli_without_aliasing_it() -> None:+ """Windows twin of the Unix migration note asserted by the real install run below."""+ installer = WINDOWS_INSTALL_LOCAL.read_text(encoding="utf-8-sig")++ hints = installer.index("$hintsRaw -replace")+ warning = installer.index("if (-not (Test-Path -LiteralPath $releaseBinary -PathType Leaf))")+ assert hints < warning+ assert MIGRATION_WARNING in installer[warning:]+ assert "$installedBinary mcp-config --client codex" in installer[warning:]+ assert "irm https://cua.ai/driver/install.ps1 | iex" in installer[warning:]+ assert "New-Item -ItemType SymbolicLink" not in installer[warning:]++def _write_executable(path: Path, body: str) -> None:path.parent.mkdir(parents=True, exist_ok=True)path.write_text(f"#!/bin/sh\n{body}", encoding="utf-8")@@ -117,6 +132,7 @@ def test_installer_stages_binary_from_custom_cargo_target(rust_dir.mkdir()shutil.copy2(INSTALL_LOCAL, scripts_dir / INSTALL_LOCAL.name)shutil.copy2(LOCAL_SIGNING, scripts_dir / LOCAL_SIGNING.name)+ shutil.copy2(POST_INSTALL_HINTS, scripts_dir / POST_INSTALL_HINTS.name)wayland_helper = fixture_root / "wayland-helper/winrects@cua"wayland_helper.mkdir(parents=True)@@ -183,11 +199,13 @@ esaccwd=fixture_root,env=env,text=True,- capture_output=True,+ stdout=subprocess.PIPE,+ stderr=subprocess.STDOUT,check=False,)- assert result.returncode == 0, result.stdout + result.stderr+ output = result.stdout+ assert result.returncode == 0, outputassert (custom_target / "release/cua-driver").read_text() == "fresh custom target\n"assert (custom_target / "release/cua-cursor-theme"@@ -202,6 +220,18 @@ esacassert (installed_helper / "metadata.json").read_text() == '{"version":5}\n'assert (installed_helper / "extension.js").read_text() == "// semantic cursor v5\n"+ # No published CLI exists here, so the installer explains the migration+ # after the shared hints instead of aliasing the local build to it.+ release_bin = install_bin / "cua-driver"+ assert not release_bin.exists() and not release_bin.is_symlink()+ hints = output.index(f"{install_bin}/cua-driver-local list-tools")+ note = output.index(f"the published cua-driver CLI is not installed at {release_bin}")+ assert hints < note+ migration = output[note:]+ assert MIGRATION_WARNING in migration+ assert f"{install_bin}/cua-driver-local mcp-config --client codex" in migration+ assert "https://cua.ai/driver/install.sh" in migration+def _linux_fixture(tmp_path: Path) -> tuple[Path, Path, dict[str, str]]:"""Stage a minimal Linux install-local fixture: (scripts_dir, fake_bin, env)."""diff --git a/libs/cua-driver/scripts/tests/test_install_local_migration.py b/libs/cua-driver/scripts/tests/test_install_local_migration.pydeleted file mode 100644index e8cf3e2d85..0000000000--- a/libs/cua-driver/scripts/tests/test_install_local_migration.py+++ /dev/null@@ -1,55 +0,0 @@-from __future__ import annotations--from pathlib import Path--REPO_ROOT = Path(__file__).resolve().parents[4]-SCRIPTS = REPO_ROOT / "libs/cua-driver/scripts"---def test_unix_local_install_reports_missing_release_cli_without_aliasing_it() -> None:- installer = (SCRIPTS / "_install-local-rust.sh").read_text()-- warning = installer.index('if [ ! -e "$RELEASE_BIN" ]; then')- assert installer.index('RELEASE_BIN="$BIN_DIR/cua-driver"') < warning- assert installer.index('INSTALLED_BIN="$BIN_DIR/cua-driver-local"') < warning- assert (- "Existing MCP clients configured for 'cua-driver' will not use this local build."- in installer- )- assert "$INSTALLED_BIN mcp-config --client codex" in installer- assert "https://cua.ai/driver/install.sh" in installer- assert 'ln -sf "$INSTALLED_BIN" "$RELEASE_BIN"' not in installer- assert 'ln -s "$INSTALLED_BIN" "$RELEASE_BIN"' not in installer---def test_windows_local_install_reports_missing_release_cli_without_aliasing_it() -> None:- installer = (SCRIPTS / "install-local.ps1").read_text(encoding="utf-8-sig")-- warning = installer.index("if (-not (Test-Path -LiteralPath $releaseBinary -PathType Leaf))")- assert (- installer.index(- "$releaseBinary = Join-Path $env:LOCALAPPDATA "- '"Programs\\Cua\\cua-driver\\bin\\cua-driver.exe"'- )- < warning- )- assert installer.index("$installedBinary = Join-Path $VisibleBinDir $BinaryName") < warning- assert (- "Existing MCP clients configured for 'cua-driver' will not use this local build."- in installer- )- assert "$installedBinary mcp-config --client codex" in installer- assert "irm https://cua.ai/driver/install.ps1 | iex" in installer- assert "New-Item -ItemType SymbolicLink" not in installer[warning:]---def test_migration_warning_runs_after_shared_post_install_hints() -> None:- unix = (SCRIPTS / "_install-local-rust.sh").read_text()- windows = (SCRIPTS / "install-local.ps1").read_text(encoding="utf-8-sig")-- assert unix.index('sed "s|{{BINARY}}|$INSTALLED_BIN|g" "$HINTS_TXT"') < unix.index(- 'if [ ! -e "$RELEASE_BIN" ]; then'- )- assert windows.index("$hintsRaw -replace") < windows.index(- "if (-not (Test-Path -LiteralPath $releaseBinary -PathType Leaf))"- )diff --git a/libs/cua-driver/scripts/tests/test_install_version_fallback.py b/libs/cua-driver/scripts/tests/test_install_version_fallback.pyindex f23530484f..dd21c2e0a6 100644--- a/libs/cua-driver/scripts/tests/test_install_version_fallback.py+++ b/libs/cua-driver/scripts/tests/test_install_version_fallback.py@@ -119,22 +119,6 @@ def _powershell_download_server(thread.join()-def test_windows_download_failure_is_recoverable_rather_than_fatal() -> None:- """Get-ReleaseZip must report failure by returning, not by exiting.-- An `exit 1` inside the download helper makes any retry unreachable, which- is precisely how the original defect became unrecoverable.- """- source = _windows_source()- body = source[- source.index("function Get-ReleaseZip") : source.index("function Get-ReleaseAsset")- ]-- assert "Missing = $true" in body- assert "ErrorMessage = $_.Exception.Message" in body- assert "exit 1" not in body--def test_windows_installer_falls_back_when_baked_release_is_unpublished() -> None:source = _windows_source()@@ -207,19 +191,6 @@ def test_windows_api_resolver_avoids_the_automatic_matches_variable() -> None:assert not re.search(r"\$matches\b", code)-def test_windows_api_resolver_accepts_published_stable_tags_marked_prerelease() -> None:- """Cua Driver releases use GitHub's prerelease flag despite stable x.y.z tags."""- source = _windows_source()- body = source[- source.index("function Get-LatestVersionFromApi") : source.index(- "function Resolve-Version"- )- ]- assert "if ($_.draft) { return $false }" in body- assert "(-not $_.prerelease)" not in body- assert "[0-9]+\\.[0-9]+\\.[0-9]+" in body--@requires_powershell@pytest.mark.parametrize(("scenario", "missing", "attempts", "has_error"),@@ -326,61 +297,6 @@ Get-LatestVersionFromApi# ---------- Unix -----------------------------------------------------------def test_unix_installer_falls_back_when_baked_release_is_unpublished() -> None:- source = _unix_source()-- assert 'VERSION_SOURCE="baked"' in source-- fallback = source.index('download_release_tarball "$VERSION" || DOWNLOAD_STATUS=$?')- guard = source.index(- 'if [[ "$VERSION_SOURCE" != "baked" || "$DOWNLOAD_STATUS" != "44" ]]; then',- fallback,- )- api_call = source.index('API_VERSION="$(resolve_latest_version_from_api)"', guard)- adopt = source.index('VERSION="$API_VERSION"', api_call)- retry = source.index('download_release_tarball "$VERSION" || DOWNLOAD_STATUS=$?', adopt)- assert fallback < guard < api_call < adopt < retry---def test_unix_installer_does_not_fall_back_for_an_explicit_version_pin() -> None:- source = _unix_source()-- assert 'VERSION_SOURCE="pin"' in source- # The non-baked route exits before reaching the API recovery below it,- # including when its requested asset is a confirmed 404.- guard = source.index(- 'if [[ "$VERSION_SOURCE" != "baked" || "$DOWNLOAD_STATUS" != "44" ]]; then'- )- assert source.index("exit 1", guard) < source.index("resolve_latest_version_from_api", guard)---def test_unix_installer_recomputes_the_tarball_after_a_fallback() -> None:- """Every release-derived name must be computed after VERSION settles."""- source = _unix_source()-- assert source.index('TARBALL="$(release_tarball_name "$VERSION")"') < source.index(- 'tar -xzf "$TMP_DIR/$TARBALL"'- )- adopt = source.index('VERSION="$API_VERSION"')- retag = source.index('TAG="${TAG_PREFIX}${VERSION}"', adopt)- archive = source.index('TARBALL="$(release_tarball_name "$VERSION")"', retag)- stage = source.index('STAGE="cua-driver-rs-${VERSION}-darwin-universal"', archive)- assert adopt < retag < archive < stage---def test_unix_api_resolver_queries_bounded_full_pages() -> None:- """The repo interleaves lume/Python/Swift releases with these.-- A short page can contain no cua-driver-rs-v* tag at all and make a healthy- repo look empty — which would turn the new fallback into a dead end.- """- source = _unix_source()- assert "per_page=100" in source- assert "page=$page" in source- assert "page<=10" in source- assert "per_page=40" not in source--def _extract_shell_function(source: str, name: str) -> str:match = re.search(rf"^{re.escape(name)}\(\) \{{.*?^\}}", source, re.MULTILINE | re.DOTALL)assert match, f"could not locate shell function {name}()"@@ -547,56 +463,87 @@ def test_unix_api_resolver_rejects_drafts_but_accepts_stable_prereleases(assert resolved == "1.20.3"-@requires_posix_bash-def test_unix_api_resolver_paginates_and_sends_token_header(tmp_path: Path) -> None:+def _release_page(tags: list[str], filler: int) -> str:+ rows = [f"lume-v1.0.{i}" for i in range(filler)] + tags+ return json.dumps([{"tag_name": tag, "draft": False, "prerelease": True} for tag in rows], indent=2)+++def _run_paged_resolver(tmp_path: Path, pages: list[str]) -> tuple[str, list[str]]:+ """Run the real resolver against numbered release pages served by a curl shim."""calls = tmp_path / "calls"- filler = ",\n".join(- f' {{\n "tag_name": "lume-v1.0.{i}",\n "draft": false\n }}'- for i in range(100)- )- page_one = tmp_path / "page-1.json"- page_two = tmp_path / "page-2.json"- page_one.write_text(f"[\n{filler}\n]", encoding="utf-8")- page_two.write_text(- (- '[\n {\n "tag_name": "cua-driver-rs-v1.20.3",\n'- ' "draft": false,\n "prerelease": true\n }\n]'- ),- encoding="utf-8",- )+ cases = []+ for number, page in enumerate(pages, start=1):+ page_file = tmp_path / f"page-{number}.json"+ page_file.write_text(page, encoding="utf-8")+ cases.append(f'*"&page={number}") cat "{page_file.as_posix()}" ;;')script = tmp_path / "run-pages.sh"script.write_text(textwrap.dedent(- f"""\+ """\set -euo pipefailREPO="trycua/cua"TAG_PREFIX="cua-driver-rs-v"GH_TOKEN="test-token"curl() {{- printf '%s\\n' "$*" >> "{calls.as_posix()}"+ printf '%s\\n' "$*" >> "{calls}"case "$*" in- *"&page=1"*) cat "{page_one.as_posix()}" ;;- *"&page=2"*) cat "{page_two.as_posix()}" ;;+ {cases}*) return 99 ;;esac}}- {_extract_shell_function(_unix_source(), "github_api_curl")}- {_extract_shell_function(_unix_source(), "extract_published_release_versions")}- {_extract_shell_function(_unix_source(), "resolve_latest_version_from_api")}+ {github_api_curl}+ {published_versions}+ {resolver}resolve_latest_version_from_api"""+ ).format(+ calls=calls.as_posix(),+ cases="\n ".join(cases),+ github_api_curl=_extract_shell_function(_unix_source(), "github_api_curl"),+ published_versions=_extract_shell_function(+ _unix_source(), "extract_published_release_versions"+ ),+ resolver=_extract_shell_function(_unix_source(), "resolve_latest_version_from_api"),),encoding="utf-8",)result = subprocess.run(["bash", script.as_posix()], capture_output=True, text=True, check=True)+ return result.stdout, calls.read_text(encoding="utf-8").splitlines()- assert result.stdout == "1.20.3"- call_lines = calls.read_text(encoding="utf-8").splitlines()- assert len(call_lines) == 2- assert all("Authorization: Bearer test-token" in line for line in call_lines)- assert all("page=3" not in line for line in call_lines)++@requires_posix_bash+def test_unix_api_resolver_paginates_full_pages_and_sends_token_header(+ tmp_path: Path,+) -> None:+ """The repo interleaves lume/Python/Swift releases with these.++ A short page can contain no cua-driver-rs-v* tag at all and make a healthy+ repo look empty, which would turn the fallback into a dead end.+ """+ resolved, calls = _run_paged_resolver(+ tmp_path,+ [_release_page([], filler=100), _release_page(["cua-driver-rs-v1.20.3"], filler=0)],+ )++ assert resolved == "1.20.3"+ assert len(calls) == 2+ assert all("per_page=100&" in line for line in calls)+ assert all("Authorization: Bearer test-token" in line for line in calls)+++@requires_posix_bash+def test_unix_api_resolver_stops_after_ten_full_pages(tmp_path: Path) -> None:+ pages = [_release_page(["cua-driver-rs-v1.0.0"], filler=99)]+ pages += [_release_page([], filler=100) for _ in range(9)]+ pages.append(_release_page(["cua-driver-rs-v9.9.9"], filler=99))++ resolved, calls = _run_paged_resolver(tmp_path, pages)++ assert resolved == "1.0.0"+ assert len(calls) == 10+ assert not any("&page=11" in line for line in calls)def _run_download(tmp_path: Path, scenario: str, token_env: str = "") -> tuple[int, list[str], str]:@@ -769,7 +716,7 @@ def _run_fallback_flow("""Execute the installer's real post-download fallback control flow."""source = _unix_source()start = source.index("DOWNLOAD_STATUS=0\n")- end = source.index('TARBALL="$(release_tarball_name "$VERSION")"', start)+ end = source.index('\nlog "extracting"', start)flow = source[start:end]statuses = " ".join(str(status) for status in download_statuses)calls = tmp_path / "flow-calls"@@ -797,8 +744,9 @@ def _run_fallback_flow(printf 'api\\n' >> "{calls.as_posix()}"printf '1.2.2'}}+ {_extract_shell_function(source, "release_tarball_name")}{flow}- printf 'resolved:%s:%s\\n' "$VERSION" "$TAG"+ printf 'resolved:%s:%s:%s\\n' "$VERSION" "$TAG" "$TARBALL""""),encoding="utf-8",@@ -815,7 +763,10 @@ def test_unix_baked_404_falls_back_and_adopts_downloaded_version(tmp_path: Path))assert result.returncode == 0assert calls == ["download:1.2.3", "api", "download:1.2.2"]- assert result.stdout == "resolved:1.2.2:cua-driver-rs-v1.2.2\n"+ # Every release-derived name, including the archive, follows the adopted version.+ assert result.stdout == (+ "resolved:1.2.2:cua-driver-rs-v1.2.2:cua-driver-rs-1.2.2-linux-x86_64-binary.tar.gz\n"+ )assert "temporary publish lag" in result.stderrdiff --git a/libs/cua-driver/scripts/tests/test_macos_lume_runner.py b/libs/cua-driver/scripts/tests/test_macos_lume_runner.pyindex eabcf824c9..b844046108 100644--- a/libs/cua-driver/scripts/tests/test_macos_lume_runner.py+++ b/libs/cua-driver/scripts/tests/test_macos_lume_runner.py@@ -219,27 +219,15 @@ def _guest_seed_assignment(name: str) -> str:return match.group("body")-def test_tcc_guest_seed_grants_both_driver_permissions() -> None:- text = SEED_TCC_GUEST.read_text(encoding="utf-8")- sql_body = _guest_seed_assignment("SQL")- assert re.search(- r"\('kTCCServiceAccessibility','\$\{CLIENT_SQL\}',\$\{CLIENT_TYPE\},2,2,1,",- sql_body,- )- assert re.search(- r"\('kTCCServiceScreenCapture','\$\{CLIENT_SQL\}',\$\{CLIENT_TYPE\},2,2,1,",- sql_body,- )- assert "auth_value" in sql_body- assert "csreq" in sql_body- assert "allowed" not in sql_body- assert "auth_value=2" in text- assert "com.trycua.driver.local" in text--def test_tcc_guest_seed_sql_executes_against_modern_tcc_schema(tmp_path: Path) -> None:sql_body = _guest_seed_assignment("SQL")verify_sql = _guest_seed_assignment("VERIFY_SQL")+ # The seed targets the local developer build unless told otherwise.+ assert re.search(+ r'^EXPECTED_CLIENT="\$\{CUA_TCC_EXPECTED_CLIENT:-com\.trycua\.driver\.local\}"$',+ SEED_TCC_GUEST.read_text(encoding="utf-8"),+ re.MULTILINE,+ )client = "com.trycua.driver.local"client_type = "0"csreq_hex = "01020304"@@ -282,8 +270,12 @@ def test_tcc_guest_seed_sql_executes_against_modern_tcc_schema(tmp_path: Path) -ORDER BY service""").fetchall()+ # Verification counts only allowed grants, not rows that merely exist.+ conn.execute("UPDATE access SET auth_value=0 WHERE service='kTCCServiceScreenCapture'")+ denied_count = conn.execute(verify_sql).fetchone()[0]assert row_count == 2+ assert denied_count == 1assert rows == [("kTCCServiceAccessibility",@@ -316,14 +308,6 @@ def test_tcc_guest_seed_requires_certificate_backed_requirement_by_default() ->assert "is not signed with a certificate-backed identity" in text-def test_tcc_host_seed_accepts_multiple_vms() -> None:- text = SEED_TCC.read_text(encoding="utf-8")- assert 'VMS+=("$1")' in text- assert 'for vm in "${VMS[@]}"; do' in text- assert "seed-tcc-guest.sh" in text- assert "CUA_TCC_READ_SUDO_PASSWORD=1" in text--@pytest.mark.parametrize("document",[HARNESS_GUIDE, PUBLIC_LUME_TEST_GUIDE],@@ -432,26 +416,21 @@ def test_target_dir_is_owned_by_source_sha_and_run(tmp_path: Path) -> None:assert other.stdout.strip() == str(tmp_path / "cargo-target" / SHA_B / "run-1")-def test_target_dir_never_lands_in_the_workspace(tmp_path: Path) -> None:+def test_default_target_dir_is_a_user_cache_outside_the_workspace(tmp_path: Path) -> None:completed = _run(RUN_ALL,f'resolve_cargo_target_dir "{SHA_A}" "run-1"',- env={"CUA_E2E_CARGO_TARGET_ROOT": str(tmp_path / "cargo-target")},+ # An empty override takes the runner's default, like an unset one.+ env={"CUA_E2E_CARGO_TARGET_ROOT": "", "HOME": str(tmp_path)},)+ assert completed.returncode == 0, completed.stderrresolved = Path(completed.stdout.strip())- assert resolved.is_absolute()+ assert resolved == (+ tmp_path / "Library/Caches/cua-driver-e2e/cargo-target" / SHA_A / "run-1"+ )assert REPO_ROOT not in resolved.parents-def test_consecutive_same_sha_runs_get_distinct_namespaces(tmp_path: Path) -> None:- env = {"CUA_E2E_CARGO_TARGET_ROOT": str(tmp_path / "cargo-target")}- first = _run(RUN_ALL, f'resolve_cargo_target_dir "{SHA_A}" "run-1"', env=env)- second = _run(RUN_ALL, f'resolve_cargo_target_dir "{SHA_A}" "run-2"', env=env)- assert first.returncode == 0, first.stderr- assert second.returncode == 0, second.stderr- assert first.stdout != second.stdout--def test_relative_target_root_is_refused() -> None:completed = _run(RUN_ALL,@@ -1071,15 +1050,6 @@ wait "$child_pid"pytest.fail(f"timed-out child process {child_pid} is still alive")-def test_bounded_command_requires_python_and_uses_process_group_kills() -> None:- text = RUN_ALL.read_text(encoding="utf-8")- function = text.split("run_bounded_command() {", 1)[1].split("\n}\n", 1)[0]- assert "command -v python3" in function- assert "subprocess.Popen(sys.argv[3:], start_new_session=True)" in function- assert function.count("os.killpg(process.pid") == 2- assert "osascript python3 security xcrun" in text--def test_required_keychains_keep_terminal_prompt_fallback() -> None:text = RUN_ALL.read_text(encoding="utf-8")function = text.split("prepare_keychain() {", 1)[1].split("\n}\n", 1)[0]diff --git a/libs/cua-driver/scripts/tests/test_uninstall_daemon_stop.py b/libs/cua-driver/scripts/tests/test_uninstall_daemon_stop.pyindex 6d59e50937..8306705324 100644--- a/libs/cua-driver/scripts/tests/test_uninstall_daemon_stop.py+++ b/libs/cua-driver/scripts/tests/test_uninstall_daemon_stop.py@@ -99,18 +99,25 @@ stop_release_daemonself.assertEqual(signals.read_text(), "TERM")def test_reused_pid_is_not_signalled(self) -> None:+ """A pid whose process generation changed after capture gets no signal."""helper = self.home / "cua-driver"executable(helper, "exit 1")+ generations = self.root / "generations"+ signals = self.root / "signals"result = self.shell(self.setup(helper)- + """-daemon_wait_for_exit() { return 1; }-daemon_signal_if_current() { return 1; }-kill() { return 99; }+ + f"""+daemon_wait_for_exit() {{ return 1; }}+daemon_process_generation() {{+ if [[ -f "{generations}" ]]; then printf new; else : > "{generations}"; printf old; fi+}}+kill() {{ printf '%s\\n' "$*" >> "{signals}"; }}stop_release_daemon""")self.assertEqual(result.returncode, 0, result.stderr)+ self.assertTrue(generations.exists(), "the stop path never captured a generation")+ self.assertFalse(signals.exists(), signals.read_text() if signals.exists() else "")def test_missing_helper_fails_before_signal(self) -> None:result = self.shell(self.setup(None) + "stop_release_daemon")