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(release): scope Cua Driver attribution to the real release range (#4086)

Francesco Bonaccie1824be198d8
diff --git a/.github/scripts/release_attribution.py b/.github/scripts/release_attribution.py
index 41184ae21a..01414f0646 100644
--- a/.github/scripts/release_attribution.py
+++ b/.github/scripts/release_attribution.py
@@ -70,6 +70,8 @@ NOREPLY_RE = re.compile(
re.IGNORECASE,
)
RELEASING_TYPES = {"feat", "fix", "perf", "revert"}
+STABLE_VERSION_RE = re.compile(r"^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$")
+NO_RELEASE_LABEL = "no-release"
PERCEPTION_OWNED_PATHS = (
".github/releases/cua-perception",
"libs/cua-driver/rust/crates/cua-perception",
@@ -200,9 +202,31 @@ def resolve_tag_sha(repo_root: Path, tag: str) -> str:
return run_git(repo_root, "rev-list", "-n", "1", tag).strip()
+def _stable_version_key(tag: str, tag_prefix: str) -> tuple[int, int, int] | None:
+ if not tag.startswith(tag_prefix):
+ return None
+ match = STABLE_VERSION_RE.match(tag[len(tag_prefix) :])
+ if not match:
+ return None
+ major, minor, patch = (int(part) for part in match.groups())
+ return major, minor, patch
+
+
def find_previous_tag(repo_root: Path, current_tag: str, tag_prefix: str) -> str | None:
+ """Return the newest tag whose version precedes the current release.
+
+ A higher version tag, such as an abandoned Release Please tag, is never a
+ valid base: selecting it would silently drop real changes from the range.
+ """
tags = run_git(repo_root, "tag", "--list", f"{tag_prefix}*", "--sort=-v:refname").splitlines()
- return next((tag for tag in tags if tag and tag != current_tag), None)
+ current_key = _stable_version_key(current_tag, tag_prefix)
+ for tag in tags:
+ if not tag or tag == current_tag:
+ continue
+ tag_key = _stable_version_key(tag, tag_prefix)
+ if current_key is None or (tag_key is not None and tag_key < current_key):
+ return tag
+ return None
def commits_in_range(
@@ -249,6 +273,27 @@ def commits_in_range(
return records
+def is_release_metadata_only_commit(
+ repo_root: Path,
+ commit_sha: str,
+ paths: Sequence[str],
+ exclude_paths: Sequence[str],
+ metadata_paths: Sequence[str],
+) -> bool:
+ """Return whether a commit's in-scope diff touches only release metadata files."""
+ if not metadata_paths:
+ return False
+ pathspecs = [*paths, *(f":(exclude){path}" for path in exclude_paths)]
+ changed_files = [
+ file
+ for file in run_git(
+ repo_root, "show", "--format=", "--name-only", commit_sha, "--", *pathspecs
+ ).splitlines()
+ if file
+ ]
+ return bool(changed_files) and all(file in metadata_paths for file in changed_files)
+
+
def parse_conventional_line(line: str) -> ConventionalEntry | None:
match = CONVENTIONAL_RE.match(line.strip())
if not match:
@@ -944,6 +989,7 @@ def build_manifest(
release_ref: str | None = None,
exclude_paths: Sequence[str] = (),
exclude_companion_paths: Sequence[str] = (),
+ release_metadata_paths: Sequence[str] = (),
asset_dir: Path | None = None,
channel: str = "stable",
) -> dict[str, Any]:
@@ -990,6 +1036,17 @@ def build_manifest(
pull_body = str(pull.get("body") or "")
if not subject_is_included and not OVERRIDE_RE.search(pull_body):
continue
+ # A maintainer-labeled release-control pull request that only edits
+ # version or changelog metadata is part of preparing this release, not
+ # a product change the changelog must cite. Product diffs stay required.
+ if (
+ channel == "stable"
+ and NO_RELEASE_LABEL in {str(label.get("name")) for label in pull.get("labels") or []}
+ and is_release_metadata_only_commit(
+ repo_root, commit.sha, paths, exclude_paths, release_metadata_paths
+ )
+ ):
+ continue
pull_number = int(pull["number"])
pull_commits[pull_number].add(commit.sha)
entries = release_entries(
@@ -1264,6 +1321,7 @@ def collect_command(args: argparse.Namespace) -> None:
release_ref=args.ref,
exclude_paths=args.exclude_path,
exclude_companion_paths=args.exclude_companion_path,
+ release_metadata_paths=args.release_metadata_path,
asset_dir=args.asset_dir.resolve() if args.asset_dir else None,
channel=args.channel,
)
@@ -1378,6 +1436,12 @@ def build_parser() -> argparse.ArgumentParser:
collect.add_argument("--path", action="append", required=True)
collect.add_argument("--exclude-path", action="append", default=[])
collect.add_argument("--exclude-companion-path", action="append", default=[])
+ collect.add_argument(
+ "--release-metadata-path",
+ action="append",
+ default=[],
+ help="version or changelog file a no-release release-control PR may edit",
+ )
collect.add_argument("--changelog", type=Path, required=True)
collect.add_argument(
"--config", type=Path, default=Path(".github/release-attribution-config.json")
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.py
index 2169e144aa..24c16fbf41 100644
--- a/.github/scripts/tests/test_cua_driver_release_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py
@@ -738,10 +738,18 @@ fi
):
self.assertIn("needs: release-attribution-preflight", block)
- # Keep the publication-time guard as defense in depth.
+ # Keep the publication-time guard as defense in depth, and run it with
+ # the same release-control tooling as the preflight so both agree.
self.assertEqual(
- workflow.count("python3 .github/scripts/release_attribution.py collect"),
- 1,
+ workflow.count(
+ "python3 release-control/.github/scripts/release_attribution.py collect"
+ ),
+ 2,
+ )
+ self.assertNotIn("python3 .github/scripts/release_attribution.py", workflow)
+ self.assertEqual(
+ workflow.count("--release-metadata-path libs/cua-driver/rust/CHANGELOG.md"),
+ 2,
)
def test_driver_windows_release_signs_every_pe_binary_before_packaging(self) -> None:
diff --git a/.github/scripts/tests/test_release_attribution.py b/.github/scripts/tests/test_release_attribution.py
index 344a442c76..6b781eef5e 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,
+ find_previous_tag,
is_perception_only_diff,
linked_issue_numbers,
login_from_email,
@@ -682,3 +683,123 @@ def test_pr_3266_squash_coauthor_resolves_through_verified_identity_override():
{"login": "0xjohnnydev", "role": "author", "external": True},
{"login": "0xjohnnydev", "role": "coauthor", "external": True},
]
+
+
+def _commit(root: Path, path: str, content: str, subject: str) -> str:
+ target = root / path
+ target.parent.mkdir(parents=True, exist_ok=True)
+ target.write_text(content)
+ git(root, "add", ".")
+ git(root, "commit", "-m", subject)
+ return git(root, "rev-parse", "HEAD")
+
+
+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")
+ git(tmp_path, "config", "user.email", "[email protected]")
+ _commit(tmp_path, "seed.txt", "seed\n", "chore: seed fixture")
+ for tag in ("cua-driver-rs-v0.9.9", "cua-driver-rs-v0.10.0", "cua-driver-rs-v0.11.0"):
+ git(tmp_path, "tag", tag)
+
+ assert find_previous_tag(tmp_path, "cua-driver-rs-v0.10.1", "cua-driver-rs-v") == (
+ "cua-driver-rs-v0.10.0"
+ )
+ assert find_previous_tag(tmp_path, "cua-driver-rs-v0.11.0", "cua-driver-rs-v") == (
+ "cua-driver-rs-v0.10.0"
+ )
+ assert find_previous_tag(tmp_path, "cua-driver-rs-v0.9.9", "cua-driver-rs-v") is None
+
+
+class LabeledPullsGitHub:
+ """Resolve each commit to one internal pull request with the given labels."""
+
+ def __init__(self, pulls_by_sha: dict[str, tuple[int, list[str]]]) -> None:
+ self.pulls_by_sha = pulls_by_sha
+ self.by_number = {number: labels for number, labels in pulls_by_sha.values()}
+
+ def pulls_for_commit(self, repository: str, commit_sha: str):
+ number, _ = self.pulls_by_sha[commit_sha]
+ return [{"number": number, "merge_commit_sha": commit_sha, "merged_at": "now"}]
+
+ def pull(self, repository: str, number: int):
+ return {
+ "number": number,
+ "user": {"login": "maintainer"},
+ "author_association": "MEMBER",
+ "body": "",
+ "labels": [{"name": label} for label in self.by_number[number]],
+ }
+
+
+def test_no_release_metadata_only_pulls_are_not_required_changelog_entries(tmp_path: Path):
+ git(tmp_path, "init")
+ git(tmp_path, "config", "user.name", "Release Test")
+ git(tmp_path, "config", "user.email", "[email protected]")
+ changelog = "libs/cua-driver/rust/CHANGELOG.md"
+ version = "libs/cua-driver/rust/VERSION"
+ _commit(tmp_path, version, "0.8.1\n", "chore: seed fixture")
+ git(tmp_path, "tag", "cua-driver-rs-v0.8.1")
+ product = _commit(
+ tmp_path, "libs/cua-driver/rust/driver.txt", "fixed\n", "fix(driver): keep focus"
+ )
+ metadata = _commit(
+ tmp_path,
+ changelog,
+ "## [0.8.2] (2026-07-16)\n\n* **driver:** keep focus (#12)\n",
+ "fix(cua-driver): release 0.8.2 metadata",
+ )
+ _commit(tmp_path, version, "0.8.2\n", "fix(cua-driver): align release version")
+ unlabeled = git(tmp_path, "rev-parse", "HEAD")
+ config = {
+ "bots": [],
+ "coauthorOverrides": {},
+ "ignoredCoauthorEmails": [],
+ "identityOverrides": {},
+ "internalHandles": ["maintainer"],
+ "optOutHandles": [],
+ }
+
+ def manifest(pulls: dict[str, tuple[int, list[str]]], metadata_paths=(changelog, version)):
+ return build_manifest(
+ repo_root=tmp_path,
+ repository="trycua/cua",
+ product="cua-driver-rs",
+ display_name="Cua Driver",
+ version="0.8.2",
+ tag="cua-driver-rs-v0.8.2",
+ previous_tag="cua-driver-rs-v0.8.1",
+ release_ref="HEAD",
+ expected_sha=unlabeled,
+ paths=("libs/cua-driver",),
+ changelog_path=tmp_path / changelog,
+ attribution_config=config,
+ github=LabeledPullsGitHub(pulls),
+ release_metadata_paths=metadata_paths,
+ )
+
+ # An unlabeled metadata pull request remains a required releasing entry.
+ with pytest.raises(ReleaseError, match=r"missing pull requests: \[13, 14\]"):
+ manifest({product: (12, []), metadata: (13, []), unlabeled: (14, [])})
+
+ # Without declared metadata paths the label alone never removes attribution.
+ with pytest.raises(ReleaseError, match=r"missing pull requests: \[13, 14\]"):
+ manifest(
+ {product: (12, []), metadata: (13, ["no-release"]), unlabeled: (14, ["no-release"])},
+ metadata_paths=(),
+ )
+
+ result = manifest(
+ {product: (12, []), metadata: (13, ["no-release"]), unlabeled: (14, ["no-release"])}
+ )
+ assert [change["pr"] for change in result["changes"]] == [12]
+
+ # A no-release label cannot hide a product diff from attribution.
+ result = manifest(
+ {
+ product: (12, ["no-release"]),
+ metadata: (13, ["no-release"]),
+ unlabeled: (14, ["no-release"]),
+ }
+ )
+ assert [change["pr"] for change in result["changes"]] == [12]
diff --git a/.github/workflows/cd-rust-cua-driver.yml b/.github/workflows/cd-rust-cua-driver.yml
index ed8f638aa4..17a2d06839 100644
--- a/.github/workflows/cd-rust-cua-driver.yml
+++ b/.github/workflows/cd-rust-cua-driver.yml
@@ -134,6 +134,13 @@ jobs:
--exclude-path libs/cua-driver/experiments/cua-perception-inference \
--exclude-companion-path libs/cua-driver/rust/Cargo.toml \
--exclude-companion-path libs/cua-driver/rust/Cargo.lock \
+ --release-metadata-path libs/cua-driver/rust/CHANGELOG.md \
+ --release-metadata-path libs/cua-driver/rust/VERSION \
+ --release-metadata-path libs/cua-driver/rust/Cargo.toml \
+ --release-metadata-path libs/cua-driver/rust/Cargo.lock \
+ --release-metadata-path libs/cua-driver/rust/Skills/cua-driver/SKILL.md \
+ --release-metadata-path libs/cua-driver/typescript/package.json \
+ --release-metadata-path libs/cua-driver/typescript/package-lock.json \
--changelog libs/cua-driver/rust/CHANGELOG.md \
--output "$RUNNER_TEMP/cua-driver-release-manifest.json"
@@ -1240,7 +1247,8 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p release-metadata
- python3 .github/scripts/release_attribution.py collect \
+ python3 release-control/.github/scripts/release_attribution.py collect \
+ --repo-root "$GITHUB_WORKSPACE" \
--repository "${{ github.repository }}" \
--product cua-driver-rs \
--display-name "Cua Driver" \
@@ -1257,13 +1265,20 @@ jobs:
--exclude-path libs/cua-driver/experiments/cua-perception-inference \
--exclude-companion-path libs/cua-driver/rust/Cargo.toml \
--exclude-companion-path libs/cua-driver/rust/Cargo.lock \
+ --release-metadata-path libs/cua-driver/rust/CHANGELOG.md \
+ --release-metadata-path libs/cua-driver/rust/VERSION \
+ --release-metadata-path libs/cua-driver/rust/Cargo.toml \
+ --release-metadata-path libs/cua-driver/rust/Cargo.lock \
+ --release-metadata-path libs/cua-driver/rust/Skills/cua-driver/SKILL.md \
+ --release-metadata-path libs/cua-driver/typescript/package.json \
+ --release-metadata-path libs/cua-driver/typescript/package-lock.json \
--changelog libs/cua-driver/rust/CHANGELOG.md \
--asset-dir release-upload \
--output release-metadata/release-manifest.json
- name: Render release body and announcement draft
run: |
- python3 .github/scripts/release_attribution.py render \
+ python3 release-control/.github/scripts/release_attribution.py render \
--manifest release-metadata/release-manifest.json \
--body release-metadata/release-body.md \
--social release-metadata/release-social.txt \
diff --git a/.github/workflows/ci-release-metadata.yml b/.github/workflows/ci-release-metadata.yml
index a87922a4c9..d74a8ff6bb 100644
--- a/.github/workflows/ci-release-metadata.yml
+++ b/.github/workflows/ci-release-metadata.yml
@@ -153,6 +153,13 @@ jobs:
--exclude-path libs/cua-driver/experiments/cua-perception-inference \
--exclude-companion-path libs/cua-driver/rust/Cargo.toml \
--exclude-companion-path libs/cua-driver/rust/Cargo.lock \
+ --release-metadata-path libs/cua-driver/rust/CHANGELOG.md \
+ --release-metadata-path libs/cua-driver/rust/VERSION \
+ --release-metadata-path libs/cua-driver/rust/Cargo.toml \
+ --release-metadata-path libs/cua-driver/rust/Cargo.lock \
+ --release-metadata-path libs/cua-driver/rust/Skills/cua-driver/SKILL.md \
+ --release-metadata-path libs/cua-driver/typescript/package.json \
+ --release-metadata-path libs/cua-driver/typescript/package-lock.json \
--changelog libs/cua-driver/rust/CHANGELOG.md \
--output /tmp/cua-driver-release-manifest.json
fi
diff --git a/libs/cua-driver/rust/CHANGELOG.md b/libs/cua-driver/rust/CHANGELOG.md
index 7aa722c3ae..bb3a840859 100644
--- a/libs/cua-driver/rust/CHANGELOG.md
+++ b/libs/cua-driver/rust/CHANGELOG.md
@@ -19,15 +19,13 @@
### Bug Fixes
* **cua-driver:** correlate Chromium profile window titles ([#4030](https://github.com/trycua/cua/issues/4030)) ([210efbc](https://github.com/trycua/cua/commit/210efbceb46bf1acb0f66985a098262445d91e93)), closes [#4029](https://github.com/trycua/cua/issues/4029)
-* **cua-driver:** complete release metadata and contributor attribution ([#4077](https://github.com/trycua/cua/pull/4077)).
-* **cua-driver:** complete the 0.28.3 changelog attribution ([#4078](https://github.com/trycua/cua/pull/4078)).
-* **cua-driver:** finalize release attribution control ([#4080](https://github.com/trycua/cua/pull/4080)).
* **cua-driver:** expose referenced MCP skill resources ([#4028](https://github.com/trycua/cua/issues/4028)) ([4eb8ab5](https://github.com/trycua/cua/commit/4eb8ab51e71b241316136805fe6191b7e2914e35))
* **cua-driver:** hint foreground escalation on unavailable UIA clicks ([#3888](https://github.com/trycua/cua/issues/3888)) ([2f52f65](https://github.com/trycua/cua/commit/2f52f65acee92bebff6c0c4ca0877aacb9fa5b6b))
* **cua-driver:** make skill workflows match runtime contracts ([#3719](https://github.com/trycua/cua/issues/3719)) ([6863ab6](https://github.com/trycua/cua/commit/6863ab6f11649f362d8c34401e19a46fe2a39a35))
* **cua-driver:** preserve observed X11 click identities ([#3864](https://github.com/trycua/cua/issues/3864)) ([27062ed](https://github.com/trycua/cua/commit/27062ed04a36a5aa1969fa44f58349d16f0bdc13))
* **cua-driver:** report daemon_running accurately from socket liveness ([#4019](https://github.com/trycua/cua/issues/4019)) ([27a318c](https://github.com/trycua/cua/commit/27a318c3a616f9ff19d24fe2acca7517c5f8fa7b))
* **cua-driver:** report surviving local install on uninstall ([#3021](https://github.com/trycua/cua/issues/3021)) ([625118a](https://github.com/trycua/cua/commit/625118a9076e51da2f57b6a5d475972030197443))
+* **cua-driver:** rotate the perception extension signing key ([#4072](https://github.com/trycua/cua/issues/4072)) ([cf07615](https://github.com/trycua/cua/commit/cf0761552675c6fb020d5950ca7003c9a7e40997))
* **cua-driver:** stabilize Hyprland agent input ([f6be600](https://github.com/trycua/cua/commit/f6be60087b8d1bb3d0a822ea11736761b8b8ace0))
## [0.28.2](https://github.com/trycua/cua/compare/cua-driver-rs-v0.28.1...cua-driver-rs-v0.28.2) (2026-09-15)