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
fix(ci): key the Spaces Rust slice on the bench files cua-cli embeds (#6412)
injaneityd3434cb8427a
diff --git a/.github/scripts/spaces_rust_slice_inputs.py b/.github/scripts/spaces_rust_slice_inputs.pyindex c74018411c..cee6a0c404 100644--- a/.github/scripts/spaces_rust_slice_inputs.py+++ b/.github/scripts/spaces_rust_slice_inputs.py@@ -309,16 +309,25 @@ def _in_spans(pos: int, spans: list[tuple[int, int]]) -> bool:return any(a <= pos < b for a, b in spans)-def _resolve_concat(arg: str, crate_dir: Path) -> str | None:+def _resolve_concat(arg: str, crate_dir: Path, file_dir: Path) -> str | None:+ """The path a `concat!` names. A macro metavariable (`$p`) in it makes the+ literal before it a prefix, so the read is that whole directory."""parts = []- for literal, env in re.findall(r'"([^"]*)"|(env!\s*\(\s*"[A-Z_]+"\s*\))', arg):+ for literal, env, var in re.findall(+ r'"([^"]*)"|(env!\s*\(\s*"[A-Z_]+"\s*\))|(\$[A-Za-z_]\w*)', arg+ ):+ if var:+ prefix = "".join(parts)+ parts = [prefix if prefix.endswith("/") else os.path.dirname(prefix) or "."]+ breakif env:if "CARGO_MANIFEST_DIR" not in env:return None # OUT_DIR and the like: not a source fileparts.append(str(crate_dir))else:parts.append(literal)- return "".join(parts)+ # Without CARGO_MANIFEST_DIR the path is relative to the including file.+ return os.path.join(file_dir, "".join(parts))def source_reads(crate_dir: Path) -> set[Path]:@@ -346,7 +355,7 @@ def source_reads(crate_dir: Path) -> set[Path]:continuetext = arg.group(1)if text.startswith("concat"):- resolved = _resolve_concat(text, crate_dir)+ resolved = _resolve_concat(text, crate_dir, path.parent)if resolved is None:continuereads.add(Path(os.path.normpath(resolved)))diff --git a/.github/scripts/tests/test_spaces_rust_slice_inputs.py b/.github/scripts/tests/test_spaces_rust_slice_inputs.pyindex 1eb77e8043..250c062ffa 100644--- a/.github/scripts/tests/test_spaces_rust_slice_inputs.py+++ b/.github/scripts/tests/test_spaces_rust_slice_inputs.py@@ -119,6 +119,8 @@ def test_the_files_outside_the_hashed_tree_are_derived_from_the_code(extra):assert "libs/cua-spacesd/VERSION" in extra# cua-agent-setup's build script embeds the skills; the hash drops libs/cua Markdown.assert "libs/cua/skills" in extra+ # cua-cli's embed! macro includes the bench files, READMEs among them.+ assert "libs/cua/bench" in extra# Cargo merges the repository's .cargo/config.toml into every build below it.assert ".cargo" in extra# Read only by unit tests (`#[cfg(test)]`, `#[test]`) or tests/: not in the library.@@ -137,9 +139,10 @@ def test_the_files_outside_the_hashed_tree_are_derived_from_the_code(extra):@needs_tomldef test_nothing_inside_libs_cua_is_left_out_unless_the_build_reads_it(extra):# The skills (embedded by cua-agent-setup) and the proto directory (the- # contract the build compiles) hold Markdown the hash would otherwise drop.+ # contract the build compiles) hold Markdown the hash would otherwise drop,+ # and so do the bench files cua-cli embeds.inside = [p for p in extra if p.startswith("libs/cua/")]- assert inside == ["libs/cua/proto", "libs/cua/skills"]+ assert inside == ["libs/cua/bench", "libs/cua/proto", "libs/cua/skills"]# ------------------------------------------------------------------ the key@@ -306,6 +309,16 @@ def test_a_read_in_ordinary_code_counts_and_one_in_a_test_module_does_not(tmp_paassert reads_of(tmp_path, {"src/lib.rs": src}) == {"a.json", "crate/d.bin"}+def test_a_concat_with_a_macro_variable_reads_the_whole_prefix_directory(tmp_path):+ # cua-cli embeds the bench files this way, Markdown included.+ src = (+ "macro_rules! embed {\n"+ ' ($($p:literal),*) => { &[$(include_str!(concat!("../../bench/", $p))),*] };\n'+ "}\n"+ )+ assert reads_of(tmp_path, {"src/lib.rs": src}) == {"bench"}++def test_text_that_only_looks_like_code_is_not_a_read_or_a_test_boundary(tmp_path):src = ('// include_str!("../../comment.json")\n'