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.

fix(sandbox): manage package releases with Release Please (#3675)

Francesco Bonaccif880ac42540d
diff --git a/.github/scripts/merge_release_please_manifests.py b/.github/scripts/merge_release_please_manifests.py
index a1fbf6e5e2..8b3bc5ab7f 100644
--- a/.github/scripts/merge_release_please_manifests.py
+++ b/.github/scripts/merge_release_please_manifests.py
@@ -12,6 +12,7 @@ from typing import Any
COMPONENT_PATHS = {
"cua-driver-rs": "libs/cua-driver",
"lume": "libs/lume",
+ "sandbox": "libs/python/cua-sandbox",
}
diff --git a/.github/scripts/resolve_release_please_request.py b/.github/scripts/resolve_release_please_request.py
index 919374eada..397dd204ea 100644
--- a/.github/scripts/resolve_release_please_request.py
+++ b/.github/scripts/resolve_release_please_request.py
@@ -13,6 +13,7 @@ from typing import Any
COMPONENT_PATHS = {
"cua-driver-rs": "libs/cua-driver",
"lume": "libs/lume",
+ "sandbox": "libs/python/cua-sandbox",
}
SEMVER = re.compile(r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$")
BUMP_TYPES = {"automatic", "patch", "minor", "major"}
diff --git a/.github/scripts/resolve_sandbox_release.py b/.github/scripts/resolve_sandbox_release.py
new file mode 100644
index 0000000000..4610bd196c
--- /dev/null
+++ b/.github/scripts/resolve_sandbox_release.py
@@ -0,0 +1,136 @@
+"""Validate the exact published Sandbox release and its Python distributions."""
+
+import email.parser
+import json
+import os
+from pathlib import Path
+import re
+import subprocess
+import sys
+import tarfile
+import tomllib
+import zipfile
+
+
+PACKAGE_PATH = "libs/python/cua-sandbox"
+STABLE_TAG = re.compile(r"sandbox-v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)")
+
+
+def version_from_tag(tag):
+ if not STABLE_TAG.fullmatch(tag):
+ raise ValueError("Expected a stable sandbox-vX.Y.Z release tag")
+ return tag.removeprefix("sandbox-v")
+
+
+def validate_release(tag, release):
+ version = version_from_tag(tag)
+ if (
+ release.get("tag_name") != tag
+ or release.get("draft") is not False
+ or release.get("prerelease") is not False
+ or not release.get("published_at")
+ ):
+ raise ValueError("The exact Sandbox release must be published, non-draft and stable")
+ return version
+
+
+def validate_versions(version, manifest, project):
+ if manifest.get(PACKAGE_PATH) != version:
+ raise ValueError("Release manifest version does not match the Sandbox tag")
+ if project.get("name") != "cua-sandbox" or project.get("version") != version:
+ raise ValueError("Sandbox package name/version does not match the release")
+
+
+def command(*args):
+ return subprocess.check_output(args, text=True).strip()
+
+
+def validate_source_versions(version, authority, runtime, lock):
+ if authority.strip() != version:
+ raise ValueError("Sandbox VERSION does not match the release")
+ runtime_versions = re.findall(r'^__version__\s*=\s*"([^"]+)"', runtime, re.MULTILINE)
+ if runtime_versions != [version]:
+ raise ValueError("Sandbox runtime version does not match the release")
+ packages = [entry for entry in lock.get("package", []) if entry.get("name") == "cua-sandbox"]
+ if (
+ len(packages) != 1
+ or packages[0].get("version") != version
+ or packages[0].get("source") != {"editable": "."}
+ ):
+ raise ValueError("Sandbox uv.lock editable root does not match the release")
+
+
+def resolve(tag, repository):
+ version_from_tag(tag)
+ release = json.loads(command("gh", "api", f"repos/{repository}/releases/tags/{tag}"))
+ version = validate_release(tag, release)
+ shallow = command("git", "rev-parse", "--is-shallow-repository") == "true"
+ command(
+ "git",
+ "fetch",
+ "--no-tags",
+ *(["--unshallow"] if shallow else []),
+ "origin",
+ "+refs/heads/main:refs/remotes/origin/main",
+ f"+refs/tags/{tag}:refs/tags/{tag}",
+ )
+ sha = command("git", "rev-parse", f"refs/tags/{tag}^{{commit}}")
+ if not re.fullmatch(r"[0-9a-f]{40}", sha):
+ raise ValueError("Release tag did not resolve to a commit SHA")
+ command("git", "merge-base", "--is-ancestor", sha, "refs/remotes/origin/main")
+ manifest = json.loads(command("git", "show", f"{sha}:.release-please-manifest.json"))
+ project = tomllib.loads(command("git", "show", f"{sha}:{PACKAGE_PATH}/pyproject.toml"))
+ validate_versions(version, manifest, project["project"])
+ validate_source_versions(
+ version,
+ command("git", "show", f"{sha}:{PACKAGE_PATH}/VERSION"),
+ command("git", "show", f"{sha}:{PACKAGE_PATH}/cua_sandbox/__init__.py"),
+ tomllib.loads(command("git", "show", f"{sha}:{PACKAGE_PATH}/uv.lock")),
+ )
+ return version, sha
+
+
+def validate_metadata(raw, version):
+ metadata = email.parser.BytesParser().parsebytes(raw)
+ names, versions = metadata.get_all("Name", []), metadata.get_all("Version", [])
+ if len(names) != 1 or re.sub(r"[-_.]+", "-", names[0]).lower() != "cua-sandbox":
+ raise ValueError("Distribution metadata must identify cua-sandbox")
+ if versions != [version]:
+ raise ValueError("Distribution metadata version does not match the release")
+
+
+def validate_artifacts(directory, version):
+ version_from_tag(f"sandbox-v{version}")
+ files = list(Path(directory).iterdir())
+ wheels = [path for path in files if path.name.endswith(".whl")]
+ sdists = [path for path in files if path.name.endswith(".tar.gz")]
+ if len(files) != 2 or len(wheels) != 1 or len(sdists) != 1:
+ raise ValueError("Expected exactly one wheel and one source distribution")
+ with zipfile.ZipFile(wheels[0]) as wheel:
+ entries = [name for name in wheel.namelist() if name.endswith(".dist-info/METADATA")]
+ if len(entries) != 1:
+ raise ValueError("Wheel must contain exactly one package metadata file")
+ validate_metadata(wheel.read(entries[0]), version)
+ with tarfile.open(sdists[0], "r:gz") as sdist:
+ entries = [
+ entry
+ for entry in sdist.getmembers()
+ if len(entry.name.split("/")) == 2
+ and entry.name.endswith("/PKG-INFO")
+ and entry.isfile()
+ ]
+ if len(entries) != 1:
+ raise ValueError("Source distribution must contain one root PKG-INFO")
+ with sdist.extractfile(entries[0]) as metadata:
+ validate_metadata(metadata.read(), version)
+
+
+if __name__ == "__main__":
+ if sys.argv[1:] == ["resolve"]:
+ version, sha = resolve(os.environ["RELEASE_TAG"], os.environ["GITHUB_REPOSITORY"])
+ with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
+ output.write(f"version={version}\nsha={sha}\n")
+ elif len(sys.argv) == 3 and sys.argv[1] == "artifacts":
+ validate_artifacts(sys.argv[2], os.environ["RELEASE_VERSION"])
+ else:
+ raise SystemExit("Usage: resolve_sandbox_release.py resolve | artifacts DIST_DIRECTORY")
diff --git a/.github/scripts/tests/release_please_sandbox_preview.cjs b/.github/scripts/tests/release_please_sandbox_preview.cjs
new file mode 100644
index 0000000000..adab4b07a5
--- /dev/null
+++ b/.github/scripts/tests/release_please_sandbox_preview.cjs
@@ -0,0 +1,72 @@
+// Offline: exercise the pinned Release Please engine without a GitHub client.
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const path = require('node:path');
+const { buildStrategy } = require('release-please/build/src/factory');
+const { parseConventionalCommits } = require('release-please/build/src/commit');
+const { TagName } = require('release-please/build/src/util/tag-name');
+
+const root = path.resolve(__dirname, '../../..');
+const config = JSON.parse(fs.readFileSync(path.join(root, 'release-please-config.json')));
+const manifest = JSON.parse(fs.readFileSync(path.join(root, '.release-please-manifest.json')));
+const packagePath = 'libs/python/cua-sandbox';
+const options = Object.fromEntries(
+ Object.entries({ ...config, ...config.packages[packagePath] })
+ .map(([key, value]) => [key.replace(/-([a-z])/g, (_, c) => c.toUpperCase()), value])
+);
+
+async function preview(message, expectedVersion) {
+ const strategy = await buildStrategy({
+ ...options,
+ path: packagePath,
+ targetBranch: 'main',
+ github: { repository: { owner: 'example', repo: 'repo', defaultBranch: 'main' } },
+ });
+ const release = await strategy.buildReleasePullRequest(parseConventionalCommits([
+ { sha: 'a'.repeat(40), message, files: [`${packagePath}/cua_sandbox/sandbox.py`] },
+ ]), {
+ tag: TagName.parse(`sandbox-v${manifest[packagePath]}`),
+ sha: 'b'.repeat(40),
+ notes: '',
+ });
+ if (expectedVersion === null) {
+ assert.equal(release, undefined);
+ return;
+ }
+ assert.equal(release.version.toString(), expectedVersion);
+ assert.match(release.headRefName, /components--sandbox$/);
+ assert.match(release.title.toString(), /sandbox/);
+ const updates = Object.fromEntries(release.updates.map(update => [
+ update.path,
+ update.updater.updateContent(fs.readFileSync(path.join(root, update.path), 'utf8')),
+ ]));
+ assert.deepEqual(Object.keys(updates).sort(), [
+ `${packagePath}/CHANGELOG.md`, `${packagePath}/VERSION`,
+ `${packagePath}/cua_sandbox/__init__.py`, `${packagePath}/pyproject.toml`,
+ `${packagePath}/uv.lock`,
+ ].sort());
+ assert.equal(updates[`${packagePath}/VERSION`].trim(), expectedVersion);
+ assert.ok(updates[`${packagePath}/pyproject.toml`].includes(`version = "${expectedVersion}"`));
+ assert.ok(updates[`${packagePath}/cua_sandbox/__init__.py`].includes(`__version__ = "${expectedVersion}"`));
+ assert.ok(updates[`${packagePath}/CHANGELOG.md`].includes(`sandbox-v${expectedVersion}`));
+ const originalLock = fs.readFileSync(path.join(root, packagePath, 'uv.lock'), 'utf8');
+ // Release Please's TOML parser wraps scalars in { value, start, end }.
+ // Exercise the filter against that real representation and preserve all dependencies.
+ assert.equal(updates[`${packagePath}/uv.lock`], originalLock.replace(
+ /(\[\[package\]\]\nname = "cua-sandbox"\nversion = ")[^"]+("\n)/,
+ (_, prefix, suffix) => `${prefix}${expectedVersion}${suffix}`,
+ ));
+ console.log(JSON.stringify({ message, title: release.title.toString(), version: expectedVersion,
+ tag: `sandbox-v${expectedVersion}`, files: Object.keys(updates) }));
+}
+
+async function main() {
+ const [major, minor, patch] = manifest[packagePath].split('.').map(Number);
+ await preview('fix(sandbox): correct connection cleanup', `${major}.${minor}.${patch + 1}`);
+ await preview('feat(sandbox): add typed desktop access', `${major}.${minor + 1}.0`);
+ await preview('feat(sandbox)!: change connection contract',
+ major === 0 ? `0.${minor + 1}.0` : `${major + 1}.0.0`);
+ await preview('docs(sandbox): clarify setup instructions', null);
+}
+
+main().catch(error => { console.error(error); process.exitCode = 1; });
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.py
index 489126811e..e9a21486e4 100644
--- a/.github/scripts/tests/test_cua_driver_release_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py
@@ -309,7 +309,7 @@ fi
def test_release_please_exposes_targeted_bump_dropdowns(self) -> None:
workflow = self.read(".github/workflows/release-please.yml")
- for option in ("automatic", "cua-driver-rs", "lume"):
+ for option in ("automatic", "cua-driver-rs", "lume", "sandbox"):
self.assertIn(f" - {option}\n", workflow)
for bump in ("patch", "minor", "major"):
self.assertIn(f" - {bump}\n", workflow)
@@ -342,7 +342,7 @@ fi
def test_legacy_release_routes_exclude_driver_and_lume(self) -> None:
workflow = self.read(".github/workflows/release-bump-version.yml")
self.assertIn('name: "Legacy packages: Bump Version"', workflow)
- self.assertIn("Cua Driver and Lume use Release Please", workflow)
+ self.assertIn("Cua Driver, Lume, and Sandbox use Release Please", workflow)
self.assertNotIn(" - cua-driver-rs\n", workflow)
self.assertNotIn(" - lume\n", workflow)
self.assertNotIn("gh api -X DELETE", workflow)
diff --git a/.github/scripts/tests/test_cua_sandbox_release_wiring.py b/.github/scripts/tests/test_cua_sandbox_release_wiring.py
index b9c6a64767..d136c13098 100644
--- a/.github/scripts/tests/test_cua_sandbox_release_wiring.py
+++ b/.github/scripts/tests/test_cua_sandbox_release_wiring.py
@@ -1,8 +1,7 @@
-"""Regression tests for cua-sandbox release-bump wiring."""
+"""Regression tests for cua-sandbox Release Please ownership."""
-import configparser
+import json
from pathlib import Path
-import tomllib
import unittest
@@ -11,15 +10,62 @@ SANDBOX_ROOT = REPO_ROOT / "libs/python/cua-sandbox"
class TestCuaSandboxReleaseWiring(unittest.TestCase):
- """Keep the legacy bump configuration synchronized with package metadata."""
+ """Keep Sandbox version sources owned by one release system."""
- def test_bump_config_tracks_the_current_package_version(self) -> None:
- config = configparser.ConfigParser()
- config.read(SANDBOX_ROOT / ".bumpversion.cfg")
- with (SANDBOX_ROOT / "pyproject.toml").open("rb") as pyproject_file:
- project = tomllib.load(pyproject_file)["project"]
+ def test_release_please_owns_sandbox_version_sources(self) -> None:
+ config = json.loads((REPO_ROOT / "release-please-config.json").read_text())
+ package = config["packages"]["libs/python/cua-sandbox"]
+ self.assertEqual(package["release-type"], "simple")
+ self.assertEqual(package["component"], "sandbox")
+ self.assertEqual(package["version-file"], "VERSION")
+ self.assertEqual(package["changelog-path"], "CHANGELOG.md")
+ self.assertIn(
+ {"type": "toml", "path": "pyproject.toml", "jsonpath": "$.project.version"},
+ package["extra-files"],
+ )
+ self.assertIn(
+ {"type": "generic", "path": "cua_sandbox/__init__.py"},
+ package["extra-files"],
+ )
+ self.assertIn(
+ {"type": "toml", "path": "uv.lock", "jsonpath": "$.package[?(@.name.value=='cua-sandbox')].version"},
+ package["extra-files"],
+ )
+ self.assertRegex(
+ (SANDBOX_ROOT / "cua_sandbox/__init__.py").read_text(),
+ r'(?m)^__version__ = "[^"]+" # x-release-please-version$',
+ )
- self.assertEqual(config["bumpversion"]["current_version"], project["version"])
+ def test_legacy_bump_config_is_removed(self) -> None:
+ self.assertFalse((SANDBOX_ROOT / ".bumpversion.cfg").exists())
+
+ def test_legacy_workflows_cannot_bump_sandbox(self) -> None:
+ workflow = (REPO_ROOT / ".github/workflows/release-bump-version.yml").read_text()
+ self.assertNotIn(" - pypi/sandbox\n", workflow)
+ self.assertNotIn('"pypi/sandbox")', workflow)
+ self.assertNotIn("id: sandbox_version", workflow)
+ self.assertIn(" - pypi/sandbox-apps\n", workflow)
+ auto_release = (REPO_ROOT / ".github/workflows/release-on-merge.yml").read_text()
+ self.assertNotIn('["libs/python/cua-sandbox/"]', auto_release)
+
+ def test_release_branch_sync_recognizes_sandbox_and_preserves_manifest(self) -> None:
+ workflow = (REPO_ROOT / ".github/workflows/release-please.yml").read_text()
+ self.assertIn(" - sandbox\n", workflow)
+ self.assertIn('.files | any(.path == "libs/python/cua-sandbox/VERSION")', workflow)
+ self.assertIn('COMPONENT_ARGS+=(--component sandbox)', workflow)
+ self.assertIn('elif [[ "$LUME" == "true" ]]', workflow)
+ self.assertIn("--product sandbox", workflow)
+ self.assertIn('"$BRANCH" != release-please--branches--*', workflow)
+ self.assertIn('echo "Skipping non-release PR #$number; no branch code will run"\n continue', workflow)
+
+ def test_metadata_ci_covers_sandbox_and_offline_engine_preview(self) -> None:
+ metadata = (REPO_ROOT / ".github/workflows/ci-release-metadata.yml").read_text()
+ self.assertIn("libs/python/cua-sandbox/*)", metadata)
+ self.assertIn("--tag-prefix sandbox-v", metadata)
+ ci = (REPO_ROOT / ".github/workflows/ci-test-scripts.yml").read_text()
+ self.assertIn('".github/workflows/cd-py-sandbox.yml"', ci)
+ self.assertIn("release_please_sandbox_preview.cjs", ci)
+ self.assertIn("--ignore-scripts", ci)
if __name__ == "__main__":
diff --git a/.github/scripts/tests/test_merge_release_please_manifests.py b/.github/scripts/tests/test_merge_release_please_manifests.py
index 30c3300509..72e1b97df1 100644
--- a/.github/scripts/tests/test_merge_release_please_manifests.py
+++ b/.github/scripts/tests/test_merge_release_please_manifests.py
@@ -17,6 +17,23 @@ SPEC.loader.exec_module(MODULE)
class TestMergeReleasePleaseManifests(unittest.TestCase):
+ def test_sandbox_release_preserves_other_components_and_new_manifest_entries(self) -> None:
+ current = {
+ "libs/cua-driver": "0.25.0",
+ "libs/lume": "0.5.3",
+ "libs/python/cua-sandbox": "0.4.3",
+ "future/component": "1.0.0",
+ }
+ stale = {
+ "libs/cua-driver": "0.24.0",
+ "libs/lume": "0.5.2",
+ "libs/python/cua-sandbox": "0.5.0",
+ }
+ self.assertEqual(
+ MODULE.merge_component_versions(current, stale, ["sandbox"]),
+ {**current, "libs/python/cua-sandbox": "0.5.0"},
+ )
+
def test_lume_release_keeps_newer_driver_version_from_main(self) -> None:
main_manifest = {
"libs/cua-driver": "0.11.0",
diff --git a/.github/scripts/tests/test_resolve_release_please_request.py b/.github/scripts/tests/test_resolve_release_please_request.py
index 1d78010afc..fd45eeb422 100644
--- a/.github/scripts/tests/test_resolve_release_please_request.py
+++ b/.github/scripts/tests/test_resolve_release_please_request.py
@@ -17,20 +17,29 @@ class TestResolveReleasePleaseRequest(unittest.TestCase):
self.manifest = {
"libs/cua-driver": "0.9.0",
"libs/lume": "0.4.7",
+ "libs/python/cua-sandbox": "0.4.3",
}
def test_resolves_each_component_path(self) -> None:
driver = MODULE.resolve_request(self.manifest, "cua-driver-rs", "automatic")
lume = MODULE.resolve_request(self.manifest, "lume", "automatic")
+ sandbox = MODULE.resolve_request(self.manifest, "sandbox", "automatic")
self.assertEqual(driver["path"], "libs/cua-driver")
self.assertEqual(lume["path"], "libs/lume")
+ self.assertEqual(sandbox["path"], "libs/python/cua-sandbox")
+ self.assertEqual(sandbox["current_version"], "0.4.3")
+ self.assertIsNone(sandbox["release_as"])
self.assertIsNone(driver["release_as"])
def test_calculates_patch_minor_and_major_versions(self) -> None:
self.assertEqual(MODULE.bump_version("0.9.0", "patch"), "0.9.1")
self.assertEqual(MODULE.bump_version("0.9.0", "minor"), "0.10.0")
self.assertEqual(MODULE.bump_version("0.9.0", "major"), "1.0.0")
+ self.assertEqual(
+ MODULE.resolve_request(self.manifest, "sandbox", "minor")["release_as"],
+ "0.5.0",
+ )
def test_rejects_unknown_components_and_bumps(self) -> None:
with self.assertRaisesRegex(ValueError, "unsupported component"):
diff --git a/.github/scripts/tests/test_sandbox_publisher.py b/.github/scripts/tests/test_sandbox_publisher.py
new file mode 100644
index 0000000000..eae6f5cbc3
--- /dev/null
+++ b/.github/scripts/tests/test_sandbox_publisher.py
@@ -0,0 +1,235 @@
+"""Offline release-resolution and distribution checks; never upload packages."""
+
+import importlib.util
+import io
+import json
+from pathlib import Path
+import subprocess
+import tarfile
+import tempfile
+import unittest
+from unittest.mock import patch
+import zipfile
+
+
+ROOT = Path(__file__).resolve().parents[3]
+SPEC = importlib.util.spec_from_file_location(
+ "sandbox_publisher", ROOT / ".github/scripts/resolve_sandbox_release.py"
+)
+publisher = importlib.util.module_from_spec(SPEC)
+SPEC.loader.exec_module(publisher)
+TAG = "sandbox-v1.2.3"
+SHA = "a" * 40
+RELEASE = {
+ "tag_name": TAG,
+ "draft": False,
+ "prerelease": False,
+ "published_at": "2026-09-09T00:00:00Z",
+}
+
+
+class SandboxPublisherTests(unittest.TestCase):
+ def test_stable_tag_only(self):
+ self.assertEqual(publisher.version_from_tag(TAG), "1.2.3")
+ for tag in [
+ "1.2.3",
+ "sandbox-v1.2.3-rc.1",
+ "sandbox-v1.2.3+meta",
+ "sandbox-v01.2.3",
+ "sandbox-v1.2.3\n",
+ "sandbox-v1.2.3junk",
+ "cua-driver-rs-v1.2.3",
+ "sandbox-v$(echo bad)",
+ ]:
+ with self.subTest(tag=tag), self.assertRaises(ValueError):
+ publisher.version_from_tag(tag)
+
+ def test_published_matching_release_required(self):
+ self.assertEqual(publisher.validate_release(TAG, RELEASE), "1.2.3")
+ for field, value in [
+ ("draft", True),
+ ("prerelease", True),
+ ("tag_name", "sandbox-v1.2.4"),
+ ("published_at", None),
+ ("draft", None),
+ ("prerelease", None),
+ ]:
+ with self.subTest(field=field, value=value), self.assertRaises(ValueError):
+ publisher.validate_release(TAG, {**RELEASE, field: value})
+
+ def test_versions_match(self):
+ manifest = {publisher.PACKAGE_PATH: "1.2.3"}
+ project = {"name": "cua-sandbox", "version": "1.2.3"}
+ publisher.validate_versions("1.2.3", manifest, project)
+ for bad_manifest, bad_project in [
+ ({}, project),
+ ({publisher.PACKAGE_PATH: "1.2.2"}, project),
+ (manifest, {**project, "version": "1.2.4"}),
+ (manifest, {**project, "name": "another-package"}),
+ ]:
+ with self.subTest(manifest=bad_manifest, project=bad_project):
+ with self.assertRaises(ValueError):
+ publisher.validate_versions("1.2.3", bad_manifest, bad_project)
+
+ def resolve_command(self, *args):
+ if args[:2] == ("gh", "api"):
+ return json.dumps(RELEASE)
+ if args == ("git", "rev-parse", "--is-shallow-repository"):
+ return "true"
+ if args[:2] == ("git", "fetch") or args[:2] == ("git", "merge-base"):
+ return ""
+ if args == ("git", "rev-parse", f"refs/tags/{TAG}^{{commit}}"):
+ return SHA
+ if args == ("git", "show", f"{SHA}:.release-please-manifest.json"):
+ return json.dumps({publisher.PACKAGE_PATH: "1.2.3"})
+ if args == ("git", "show", f"{SHA}:{publisher.PACKAGE_PATH}/pyproject.toml"):
+ return '[project]\nname = "cua-sandbox"\nversion = "1.2.3"\n'
+ if args == ("git", "show", f"{SHA}:{publisher.PACKAGE_PATH}/VERSION"):
+ return "1.2.3"
+ if args == ("git", "show", f"{SHA}:{publisher.PACKAGE_PATH}/cua_sandbox/__init__.py"):
+ return '__version__ = "1.2.3" # x-release-please-version\n'
+ if args == ("git", "show", f"{SHA}:{publisher.PACKAGE_PATH}/uv.lock"):
+ return '[[package]]\nname = "cua-sandbox"\nversion = "1.2.3"\nsource = { editable = "." }\n'
+ self.fail(f"Unexpected command: {args}")
+
+ def test_all_source_versions_must_match(self):
+ lock = {
+ "package": [{"name": "cua-sandbox", "version": "1.2.3", "source": {"editable": "."}}]
+ }
+ runtime = '__version__ = "1.2.3"'
+ publisher.validate_source_versions("1.2.3", "1.2.3\n", runtime, lock)
+ for authority, source, locked in [
+ ("1.2.2", runtime, lock),
+ ("1.2.3", '__version__ = "1.2.2"', lock),
+ ("1.2.3", "", lock),
+ ("1.2.3", runtime, {"package": []}),
+ ("1.2.3", runtime, {"package": lock["package"] * 2}),
+ ("1.2.3", runtime, {"package": [{**lock["package"][0], "version": "1.2.2"}]}),
+ ]:
+ with self.subTest(authority=authority, runtime=source, lock=locked):
+ with self.assertRaises(ValueError):
+ publisher.validate_source_versions("1.2.3", authority, source, locked)
+
+ def test_resolves_peeled_tag_and_reads_versions_at_sha(self):
+ with patch.object(publisher, "command", side_effect=self.resolve_command) as command:
+ self.assertEqual(publisher.resolve(TAG, "example/repository"), ("1.2.3", SHA))
+ command.assert_any_call(
+ "git", "merge-base", "--is-ancestor", SHA, "refs/remotes/origin/main"
+ )
+ command.assert_any_call(
+ "git",
+ "fetch",
+ "--no-tags",
+ "--unshallow",
+ "origin",
+ "+refs/heads/main:refs/remotes/origin/main",
+ f"+refs/tags/{TAG}:refs/tags/{TAG}",
+ )
+
+ def test_non_shallow_repository(self):
+ def command(*args):
+ if args == ("git", "rev-parse", "--is-shallow-repository"):
+ return "false"
+ return self.resolve_command(*args)
+
+ with patch.object(publisher, "command", side_effect=command) as mock:
+ publisher.resolve(TAG, "example/repository")
+ mock.assert_any_call(
+ "git",
+ "fetch",
+ "--no-tags",
+ "origin",
+ "+refs/heads/main:refs/remotes/origin/main",
+ f"+refs/tags/{TAG}:refs/tags/{TAG}",
+ )
+
+ def test_invalid_tag_does_not_run_commands(self):
+ with patch.object(publisher, "command") as command, self.assertRaises(ValueError):
+ publisher.resolve("sandbox-v1.2.3; echo bad", "example/repository")
+ command.assert_not_called()
+
+ def test_missing_release_fails(self):
+ with patch.object(publisher, "command", side_effect=subprocess.CalledProcessError(1, "gh")):
+ with self.assertRaises(subprocess.CalledProcessError):
+ publisher.resolve(TAG, "example/repository")
+
+ def test_non_main_commit_fails_before_reading_source(self):
+ def command(*args):
+ if args[:2] == ("git", "merge-base"):
+ raise subprocess.CalledProcessError(1, args)
+ return self.resolve_command(*args)
+
+ with patch.object(publisher, "command", side_effect=command) as mock:
+ with self.assertRaises(subprocess.CalledProcessError):
+ publisher.resolve(TAG, "example/repository")
+ self.assertFalse(any(call.args[:2] == ("git", "show") for call in mock.call_args_list))
+
+ def test_metadata_requires_exact_name_and_version(self):
+ publisher.validate_metadata(b"Name: cua_sandbox\nVersion: 1.2.3\n", "1.2.3")
+ for raw in [
+ b"Name: other\nVersion: 1.2.3\n",
+ b"Name: cua-sandbox\nVersion: 1.2.4\n",
+ b"Name: cua-sandbox\n",
+ b"Name: cua-sandbox\nName: other\nVersion: 1.2.3\n",
+ b"Name: cua-sandbox\nVersion: 1.2.3\nVersion: 1.2.3\n",
+ ]:
+ with self.subTest(raw=raw), self.assertRaises(ValueError):
+ publisher.validate_metadata(raw, "1.2.3")
+
+ def make_artifacts(self, directory, wheel_metadata=None, sdist_metadata=None):
+ raw = b"Name: cua-sandbox\nVersion: 1.2.3\n"
+ with zipfile.ZipFile(directory / "cua_sandbox-1.2.3-py3-none-any.whl", "w") as wheel:
+ wheel.writestr(
+ "cua_sandbox-1.2.3.dist-info/METADATA",
+ raw if wheel_metadata is None else wheel_metadata,
+ )
+ with tarfile.open(directory / "cua_sandbox-1.2.3.tar.gz", "w:gz") as sdist:
+ data = raw if sdist_metadata is None else sdist_metadata
+ entry = tarfile.TarInfo("cua_sandbox-1.2.3/PKG-INFO")
+ entry.size = len(data)
+ sdist.addfile(entry, io.BytesIO(data))
+
+ def test_artifact_pair(self):
+ with tempfile.TemporaryDirectory() as directory:
+ self.make_artifacts(Path(directory))
+ publisher.validate_artifacts(directory, "1.2.3")
+
+ def test_each_artifact_metadata_is_checked(self):
+ for field in ["wheel_metadata", "sdist_metadata"]:
+ with self.subTest(field=field), tempfile.TemporaryDirectory() as directory:
+ self.make_artifacts(Path(directory), **{field: b"Name: other\nVersion: 1.2.3\n"})
+ with self.assertRaises(ValueError):
+ publisher.validate_artifacts(directory, "1.2.3")
+
+ def test_missing_or_extra_artifacts_fail(self):
+ with tempfile.TemporaryDirectory() as directory:
+ with self.assertRaises(ValueError):
+ publisher.validate_artifacts(directory, "1.2.3")
+ self.make_artifacts(Path(directory))
+ (Path(directory) / "unexpected.txt").touch()
+ with self.assertRaises(ValueError):
+ publisher.validate_artifacts(directory, "1.2.3")
+
+ def test_workflow_contract(self):
+ workflow = (ROOT / ".github/workflows/cd-py-sandbox.yml").read_text()
+ self.assertIn("types: [published]", workflow)
+ self.assertIn("ref: ${{ steps.release.outputs.sha }}", workflow)
+ self.assertIn("python -m twine check --strict", workflow)
+ self.assertIn("contents: read", workflow)
+ for forbidden in [
+ "workflow_call:",
+ "py-reusable-publish.yml",
+ "create-release:",
+ "--skip-existing",
+ "--clobber",
+ "contents: write",
+ ]:
+ self.assertNotIn(forbidden, workflow)
+ self.assertEqual(workflow.count("secrets.PYPI_TOKEN"), 1)
+ self.assertLess(
+ workflow.index("Verify distribution metadata"), workflow.index("secrets.PYPI_TOKEN")
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_validate_release_versions.py b/.github/scripts/tests/test_validate_release_versions.py
index 505e0724cf..e56dc1aca4 100644
--- a/.github/scripts/tests/test_validate_release_versions.py
+++ b/.github/scripts/tests/test_validate_release_versions.py
@@ -1,10 +1,11 @@
+import json
from pathlib import Path
import re
import shutil
import pytest
-from validate_release_versions import VersionError, validate
+from validate_release_versions import VersionError, main, validate
REPO_ROOT = Path(__file__).resolve().parents[3]
@@ -15,6 +16,10 @@ def copy_release_sources(destination: Path) -> None:
(destination / config).parent.mkdir(parents=True, exist_ok=True)
shutil.copy(REPO_ROOT / config, destination / config)
shutil.copy(REPO_ROOT / ".release-please-manifest.json", destination)
+ for filename in ("VERSION", "pyproject.toml", "uv.lock", "cua_sandbox/__init__.py"):
+ relative = Path("libs/python/cua-sandbox") / filename
+ (destination / relative).parent.mkdir(parents=True, exist_ok=True)
+ shutil.copy(REPO_ROOT / relative, destination / relative)
release_state = ".github/release-state/cua-driver-rs-published-version"
(destination / release_state).parent.mkdir(parents=True, exist_ok=True)
shutil.copy(REPO_ROOT / release_state, destination / release_state)
@@ -36,6 +41,33 @@ def test_current_release_versions_agree():
validate(REPO_ROOT, "all")
+def test_sandbox_product_cli_accepts_current_versions():
+ assert main(["--repo-root", str(REPO_ROOT), "--product", "sandbox"]) == 0
+
+
[email protected]("product", ["sandbox", "all"])
+ "source",
+ ["VERSION", "pyproject.toml", "uv.lock", "cua_sandbox/__init__.py", ".release-please-manifest.json"],
+)
+def test_sandbox_version_drift_fails(tmp_path: Path, product: str, source: str):
+ copy_release_sources(tmp_path)
+ base = tmp_path / "libs/python/cua-sandbox"
+ current = (base / "VERSION").read_text().strip()
+ if source == ".release-please-manifest.json":
+ path = tmp_path / source
+ manifest = json.loads(path.read_text())
+ manifest["libs/python/cua-sandbox"] = "9.9.9"
+ path.write_text(json.dumps(manifest))
+ else:
+ path = base / source
+ path.write_text(path.read_text().replace(current, "9.9.9"))
+
+ expected = "Sandbox expects 9.9.9" if source == "VERSION" else f"{source}=9.9.9"
+ with pytest.raises(VersionError, match=re.escape(expected)):
+ validate(tmp_path, product)
+
+
def test_version_drift_fails_with_the_source_name(tmp_path: Path):
copy_release_sources(tmp_path)
path = tmp_path / "libs/lume/src/Main.swift"
diff --git a/.github/scripts/validate_release_versions.py b/.github/scripts/validate_release_versions.py
index cd46d5ffc7..cb8f0e22dc 100644
--- a/.github/scripts/validate_release_versions.py
+++ b/.github/scripts/validate_release_versions.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-"""Verify that checked-in Driver and Lume release versions agree."""
+"""Verify that checked-in Driver, Lume, and Sandbox release versions agree."""
from __future__ import annotations
@@ -135,6 +135,24 @@ def lume_versions(root: Path) -> tuple[str, dict[str, str]]:
}
+def sandbox_versions(root: Path) -> tuple[str, dict[str, str]]:
+ base = root / "libs/python/cua-sandbox"
+ expected = (base / "VERSION").read_text().strip()
+ project = tomllib.loads((base / "pyproject.toml").read_text())
+ lock = tomllib.loads((base / "uv.lock").read_text())
+ packages = [entry for entry in lock["package"] if entry["name"] == "cua-sandbox"]
+ if len(packages) != 1 or packages[0].get("source") != {"editable": "."}:
+ raise VersionError("Sandbox uv.lock must contain exactly one editable root package")
+ stable_version_tuple(expected)
+ return expected, {
+ "pyproject.toml": str(project["project"]["version"]),
+ "uv.lock": str(packages[0]["version"]),
+ "cua_sandbox/__init__.py": read_match(
+ base / "cua_sandbox/__init__.py", r'^__version__\s*=\s*"([^"]+)"'
+ ),
+ }
+
+
def validate(root: Path, product: str) -> None:
manifest = json.loads((root / ".release-please-manifest.json").read_text())
if product in {"all", "driver"}:
@@ -153,12 +171,16 @@ def validate(root: Path, product: str) -> None:
expected, values = lume_versions(root)
values[".release-please-manifest.json"] = str(manifest["libs/lume"])
require_equal("Lume", expected, values)
+ if product in {"all", "sandbox"}:
+ expected, values = sandbox_versions(root)
+ values[".release-please-manifest.json"] = str(manifest["libs/python/cua-sandbox"])
+ require_equal("Sandbox", expected, values)
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--repo-root", type=Path, default=Path.cwd())
- parser.add_argument("--product", choices=("all", "driver", "lume"), default="all")
+ parser.add_argument("--product", choices=("all", "driver", "lume", "sandbox"), default="all")
args = parser.parse_args(argv)
try:
validate(args.repo_root.resolve(), args.product)
diff --git a/.github/workflows/cd-py-sandbox.yml b/.github/workflows/cd-py-sandbox.yml
index 98ad1fd527..5dfb526557 100644
--- a/.github/workflows/cd-py-sandbox.yml
+++ b/.github/workflows/cd-py-sandbox.yml
@@ -1,69 +1,67 @@
name: "CD: cua-sandbox (PyPI)"
on:
- push:
- tags:
- - "sandbox-v*"
+ release:
+ types: [published]
workflow_dispatch:
inputs:
- version:
- description: "Version to publish (without v prefix)"
- required: true
- default: "0.1.0"
- workflow_call:
- inputs:
- version:
- description: "Version to publish"
+ tag:
+ description: "Published stable Release Please Sandbox tag (sandbox-vX.Y.Z)"
required: true
type: string
permissions:
- contents: write
+ contents: read
+
+concurrency:
+ group: sandbox-pypi-${{ github.event.release.tag_name || inputs.tag }}
+ cancel-in-progress: false
jobs:
- prepare:
- runs-on: macos-latest
- outputs:
- version: ${{ steps.get-version.outputs.version }}
+ publish:
+ if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'sandbox-v')
+ runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ persist-credentials: false
- - name: Determine version
- id: get-version
- run: |
- if [ -n "${{ inputs.version }}" ]; then
- VERSION=${{ inputs.version }}
- elif [ "${{ github.event_name }}" == "push" ]; then
- if [[ "${{ github.ref }}" =~ ^refs/tags/sandbox-v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
- VERSION=${BASH_REMATCH[1]}
- else
- echo "Invalid tag format for sandbox"
- exit 1
- fi
- elif [ -n "${{ github.event.inputs.version }}" ]; then
- VERSION=${{ github.event.inputs.version }}
- else
- echo "ERROR: No version found!"
- exit 1
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
+ - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
+ with:
+ python-version: "3.12"
- publish:
- needs: prepare
- uses: ./.github/workflows/py-reusable-publish.yml
- with:
- package_name: "sandbox"
- package_dir: "libs/python/cua-sandbox"
- version: ${{ needs.prepare.outputs.version }}
- base_package_name: "cua-sandbox"
- secrets:
- PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
+ - name: Resolve published release and verify source versions
+ id: release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
+ run: python .github/scripts/resolve_sandbox_release.py resolve
+
+ - name: Check out immutable release source
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ ref: ${{ steps.release.outputs.sha }}
+ path: release-source
+ persist-credentials: false
+
+ - name: Install build tools
+ run: python -m pip install build twine
+
+ - name: Build released package
+ working-directory: release-source/libs/python/cua-sandbox
+ run: python -m build
+
+ - name: Verify distribution metadata
+ env:
+ RELEASE_VERSION: ${{ steps.release.outputs.version }}
+ run: |
+ python .github/scripts/resolve_sandbox_release.py artifacts release-source/libs/python/cua-sandbox/dist
+ python -m twine check --strict release-source/libs/python/cua-sandbox/dist/*
- create-release:
- needs: [prepare, publish]
- uses: ./.github/workflows/release-github-reusable.yml
- with:
- tag_name: "sandbox-v${{ needs.prepare.outputs.version }}"
- release_name: "cua-sandbox v${{ needs.prepare.outputs.version }}"
- module_path: "libs/python/cua-sandbox"
- body: ""
+ - name: Publish to PyPI
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
+ TWINE_NON_INTERACTIVE: "1"
+ # Existing distributions fail explicitly; never overwrite or skip them.
+ run: python -m twine upload release-source/libs/python/cua-sandbox/dist/*
diff --git a/.github/workflows/ci-release-metadata.yml b/.github/workflows/ci-release-metadata.yml
index 61b5a37989..2eb49159b2 100644
--- a/.github/workflows/ci-release-metadata.yml
+++ b/.github/workflows/ci-release-metadata.yml
@@ -49,7 +49,7 @@ jobs:
PRODUCT_CHANGED=false
while IFS= read -r path; do
case "$path" in
- libs/lume/*)
+ libs/lume/*|libs/python/cua-sandbox/*)
PRODUCT_CHANGED=true
;;
libs/cua-driver/docs/*|libs/cua-driver/python/*|libs/cua-driver/tests/*)
@@ -129,3 +129,18 @@ jobs:
--changelog libs/lume/CHANGELOG.md \
--output /tmp/lume-release-manifest.json
fi
+ if grep -qx 'libs/python/cua-sandbox/VERSION' <<<"$CHANGED"; then
+ VERSION=$(tr -d '[:space:]' < libs/python/cua-sandbox/VERSION)
+ python3 .github/scripts/release_attribution.py collect \
+ --repository "${{ github.repository }}" \
+ --product sandbox \
+ --display-name "Cua Sandbox" \
+ --version "$VERSION" \
+ --tag "sandbox-v$VERSION" \
+ --tag-prefix sandbox-v \
+ --ref "$HEAD_SHA" \
+ --sha "$HEAD_SHA" \
+ --path libs/python/cua-sandbox \
+ --changelog libs/python/cua-sandbox/CHANGELOG.md \
+ --output /tmp/sandbox-release-manifest.json
+ fi
diff --git a/.github/workflows/ci-test-scripts.yml b/.github/workflows/ci-test-scripts.yml
index b9f83d39f3..e4ef2c489e 100644
--- a/.github/workflows/ci-test-scripts.yml
+++ b/.github/workflows/ci-test-scripts.yml
@@ -10,6 +10,7 @@ on:
- ".github/releases/**"
- ".github/workflows/cd-rust-cua-driver.yml"
- ".github/workflows/cd-py-cua-driver.yml"
+ - ".github/workflows/cd-py-sandbox.yml"
- ".github/workflows/ci-cua-driver-installer-compat.yml"
- ".github/workflows/ci-release-metadata.yml"
- ".github/workflows/cd-swift-lume.yml"
@@ -21,6 +22,10 @@ on:
- ".github/workflows/release-on-merge.yml"
- ".release-please-manifest.json"
- "release-please-config.json"
+ - "libs/python/cua-sandbox/VERSION"
+ - "libs/python/cua-sandbox/pyproject.toml"
+ - "libs/python/cua-sandbox/uv.lock"
+ - "libs/python/cua-sandbox/cua_sandbox/__init__.py"
- ".github/workflows/ci-test-scripts.yml"
- ".github/workflows/periodic-cua-sandbox-live.yml"
- ".github/workflows/ci-contributor-attribution.yml"
@@ -58,5 +63,21 @@ jobs:
- name: Test Cua Driver uninstall scripts
run: python -m pytest libs/cua-driver/scripts/tests/ -v
+ - uses: actions/setup-node@v4
+ with:
+ node-version: "22"
+
+ - name: Preview Sandbox releases offline
+ env:
+ NPM_CONFIG_IGNORE_SCRIPTS: "true"
+ run: |
+ set -euo pipefail
+ EXPECTED_INTEGRITY='sha512-dB7HsFUpAvU1Wj9RGCINUz8Zi2qQDZiGbDEEVnJ7baNfJmk5XdYhuUFL6RcuDGjReGhp1gzY8Tc2g7vHlM4zpg=='
+ test "$(npm view [email protected] dist.integrity)" = "$EXPECTED_INTEGRITY"
+ npm install --prefix "$RUNNER_TEMP/sandbox-release-preview" \
+ --ignore-scripts --no-audit --no-fund [email protected]
+ NODE_PATH="$RUNNER_TEMP/sandbox-release-preview/node_modules" \
+ node .github/scripts/tests/release_please_sandbox_preview.cjs
+
- name: Validate historical release backfill
run: python3 .github/scripts/release_backfill.py validate
diff --git a/.github/workflows/release-bump-version.yml b/.github/workflows/release-bump-version.yml
index ecfd55a7a3..eb929b053c 100644
--- a/.github/workflows/release-bump-version.yml
+++ b/.github/workflows/release-bump-version.yml
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
service:
- description: "Legacy package (Cua Driver and Lume use Release Please)"
+ description: "Legacy package (Cua Driver, Lume, and Sandbox use Release Please)"
required: true
type: choice
options:
@@ -19,7 +19,6 @@ on:
- pypi/cloud
- pypi/core
- pypi/mcp-server
- - pypi/sandbox
- pypi/sandbox-apps
- pypi/som
- pypi/train
@@ -127,10 +126,6 @@ jobs:
echo "directory=libs/python/mcp-server" >> $GITHUB_OUTPUT
echo "type=python" >> $GITHUB_OUTPUT
;;
- "pypi/sandbox")
- echo "directory=libs/python/cua-sandbox" >> $GITHUB_OUTPUT
- echo "type=python" >> $GITHUB_OUTPUT
- ;;
"pypi/sandbox-apps")
echo "directory=libs/python/cua-sandbox-apps" >> $GITHUB_OUTPUT
echo "type=python" >> $GITHUB_OUTPUT
@@ -361,15 +356,6 @@ jobs:
echo "MCP-server version: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- - name: Capture bumped sandbox version
- if: ${{ inputs.service == 'pypi/sandbox' }}
- id: sandbox_version
- run: |
- cd libs/python/cua-sandbox
- VERSION=$(python -c "import tomllib; from pathlib import Path; data = tomllib.loads(Path('pyproject.toml').read_text()); print(data['project']['version'])")
- echo "Sandbox version: $VERSION"
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
-
- name: Capture bumped sandbox-apps version
if: ${{ inputs.service == 'pypi/sandbox-apps' }}
id: sandbox_apps_version
diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml
index a76d5760a3..70d50263bf 100644
--- a/.github/workflows/release-on-merge.yml
+++ b/.github/workflows/release-on-merge.yml
@@ -89,7 +89,6 @@ jobs:
["libs/python/cua-cli/"]="pypi/cli"
["libs/python/cua-auto/"]="pypi/auto"
["libs/python/agent/"]="pypi/agent"
- ["libs/python/cua-sandbox/"]="pypi/sandbox"
["libs/python/computer/"]="pypi/computer"
["libs/python/cua-cloud/"]="pypi/cloud"
["libs/python/core/"]="pypi/core"
diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml
index 7deb361485..ef9e6ea9cd 100644
--- a/.github/workflows/release-please.yml
+++ b/.github/workflows/release-please.yml
@@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
component:
- description: "Component to prepare (automatic checks both)"
+ description: "Component to prepare (automatic checks all components)"
required: true
type: choice
default: automatic
@@ -15,6 +15,7 @@ on:
- automatic
- cua-driver-rs
- lume
+ - sandbox
bump:
description: "Version bump for the selected component"
required: true
@@ -58,7 +59,7 @@ jobs:
inputs.component == 'automatic' &&
inputs.bump != 'automatic'
run: |
- echo "::error::Select cua-driver-rs or lume when forcing a bump type."
+ echo "::error::Select cua-driver-rs, lume, or sandbox when forcing a bump type."
exit 1
- name: Reject manifest tags outside main history
@@ -133,15 +134,17 @@ jobs:
'.files | any(.path == "libs/cua-driver/rust/VERSION")')
LUME=$(echo "$PR" | jq -r \
'.files | any(.path == "libs/lume/VERSION")')
- if [[ "$DRIVER" != "true" && "$LUME" != "true" ]]; then
+ SANDBOX=$(echo "$PR" | jq -r \
+ '.files | any(.path == "libs/python/cua-sandbox/VERSION")')
+ if [[ "$DRIVER" != "true" && "$LUME" != "true" && "$SANDBOX" != "true" ]]; then
continue
fi
OWNER=$(echo "$PR" | jq -r '.headRepositoryOwner.login')
BRANCH=$(echo "$PR" | jq -r '.headRefName')
if [[ "$OWNER" != "${GITHUB_REPOSITORY%/*}" || "$BRANCH" != release-please--branches--* ]]; then
- echo "Refusing to run release-branch code from $OWNER:$BRANCH"
- exit 1
+ echo "Skipping non-release PR #$number; no branch code will run"
+ continue
fi
# Release Please can update an existing branch that predates the
@@ -176,6 +179,9 @@ jobs:
if [[ "$LUME" == "true" ]]; then
COMPONENT_ARGS+=(--component lume)
fi
+ if [[ "$SANDBOX" == "true" ]]; then
+ COMPONENT_ARGS+=(--component sandbox)
+ fi
python3 .github/scripts/merge_release_please_manifests.py \
--main "$RUNNER_TEMP/main-release-manifest.json" \
--release "$RUNNER_TEMP/branch-release-manifest.json" \
@@ -197,12 +203,15 @@ jobs:
git add libs/cua-driver/rust/Cargo.lock \
docs/content/docs/reference/cua-driver
COMMIT_MESSAGE="chore(cua-driver-rs): synchronize generated release files"
- else
+ elif [[ "$LUME" == "true" ]]; then
python3 .github/scripts/sync_lume_release_docs.py
python3 .github/scripts/validate_release_versions.py --product lume
git add docs/content/docs/reference/lume/cli-reference.mdx \
docs/content/docs/reference/lume/http-api.mdx
COMMIT_MESSAGE="chore(lume): synchronize release documentation"
+ else
+ python3 .github/scripts/validate_release_versions.py --product sandbox
+ COMMIT_MESSAGE="chore(sandbox): synchronize release metadata"
fi
if git diff --cached --quiet; then
echo "Generated files already match release PR #$number"
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 1f67196f51..329a120de7 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,4 +1,5 @@
{
"libs/cua-driver": "0.24.0",
- "libs/lume": "0.5.3"
+ "libs/lume": "0.5.3",
+ "libs/python/cua-sandbox": "0.4.3"
}
diff --git a/AGENTS.md b/AGENTS.md
index f4bf1b20f5..5c18ebf53f 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -141,13 +141,13 @@ at the time. They do not override the current commands and authority defined in
## Pull request titles and component releases
Pull requests are squash-merged, so the pull request title becomes the commit
-subject on `main`. Release Please uses that subject to decide whether Cua Driver
-or Lume receives a release. Treat the live pull request title as release
+subject on `main`. Release Please uses that subject to decide whether Cua Driver,
+Lume, or Sandbox receives a release. Treat the live pull request title as release
metadata, not as a cosmetic summary.
-- Use `fix(cua-driver): ...` or `fix(lume): ...` for user-visible corrections
+- Use `fix(cua-driver): ...`, `fix(lume): ...`, or `fix(sandbox): ...` for user-visible corrections
that require a patch release.
-- Use `feat(cua-driver): ...` or `feat(lume): ...` for new capabilities that
+- Use `feat(cua-driver): ...`, `feat(lume): ...`, or `feat(sandbox): ...` for new capabilities that
require a minor release. Add `!` before `:` for a breaking release.
- `perf` and `revert` also produce releases. `test`, `docs`, `chore`, `ci`,
`build`, `refactor`, and `style` do not.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0972abefac..c266c47a24 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -98,10 +98,32 @@ change. `perf` and `revert` also produce releases.
Use `docs`, `test`, `ci`, `chore`, `build`, `refactor`, or `style` only when the
pull request has no user-facing release entry. A pull request that adds tests
while changing production behavior must be titled for the production change,
-not the tests. If release-tracked Cua Driver or Lume files changed but the work
+not the tests. If release-tracked Cua Driver, Lume, or Sandbox files changed but the work
is intentionally non-releasing, add the `no-release` label. The
`CI: Release metadata` check enforces this contract before squash merge.
+### Sandbox releases
+
+Sandbox uses Release Please, with independent `sandbox-vX.Y.Z` tags. Use
+`fix(sandbox): ...` for a correction and `feat(sandbox): ...` for a capability.
+Release Please prepares a separate release PR from changes since the previous
+Sandbox tag. While Sandbox is pre-1.0, breaking changes advance the minor version.
+
+The release PR updates `libs/python/cua-sandbox/VERSION`, the package and runtime
+versions, the root package version in `uv.lock`, the release manifest, and
+`CHANGELOG.md`. Maintainers review the version
+and changelog before merging. Publishing the resulting GitHub release triggers
+the PyPI workflow, which builds the exact tagged commit, not moving `main`.
+
+To request a specific bump, use **Release: Prepare component releases** with
+component `sandbox` and the desired bump type. This prepares a release PR; it
+does not publish the package. The **CD: cua-sandbox (PyPI)** manual workflow is
+only a retry for an existing published stable Release Please-managed Sandbox
+release. Legacy tags without a Sandbox release-manifest entry cannot be retried
+through this workflow. The legacy
+`pypi/sandbox` bump workflow and `release:pypi/sandbox` auto-release label no
+longer manage this package. Sandbox Apps remains on its separate legacy path.
+
## Preserve Contributor Authorship
Keep the original author when external code or design ships in Cua. Merge the
diff --git a/libs/python/cua-sandbox/.bumpversion.cfg b/libs/python/cua-sandbox/.bumpversion.cfg
deleted file mode 100644
index 97702fd042..0000000000
--- a/libs/python/cua-sandbox/.bumpversion.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-[bumpversion]
-current_version = 0.4.3
-commit = True
-tag = True
-tag_name = sandbox-v{new_version}
-message = Bump cua-sandbox to v{new_version}
-
-[bumpversion:file:pyproject.toml]
-search = version = "{current_version}"
-replace = version = "{new_version}"
diff --git a/libs/python/cua-sandbox/CHANGELOG.md b/libs/python/cua-sandbox/CHANGELOG.md
new file mode 100644
index 0000000000..29d65a329c
--- /dev/null
+++ b/libs/python/cua-sandbox/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+Release Please maintains entries for releases after the migration from
+`sandbox-v0.4.3`. Earlier releases remain available in the repository's GitHub
+release history.
diff --git a/libs/python/cua-sandbox/VERSION b/libs/python/cua-sandbox/VERSION
new file mode 100644
index 0000000000..17b2ccd9bf
--- /dev/null
+++ b/libs/python/cua-sandbox/VERSION
@@ -0,0 +1 @@
+0.4.3
diff --git a/libs/python/cua-sandbox/cua_sandbox/__init__.py b/libs/python/cua-sandbox/cua_sandbox/__init__.py
index f69c263bc4..1e6536fe22 100644
--- a/libs/python/cua-sandbox/cua_sandbox/__init__.py
+++ b/libs/python/cua-sandbox/cua_sandbox/__init__.py
@@ -16,7 +16,7 @@ Usage::
await host.mouse.click(100, 200)
"""
-__version__ = "0.1.0"
+__version__ = "0.4.3" # x-release-please-version
from cua_sandbox._auth import login, whoami
from cua_sandbox._config import configure
diff --git a/release-please-config.json b/release-please-config.json
index ead6ef14cb..dae490aa94 100644
--- a/release-please-config.json
+++ b/release-please-config.json
@@ -54,6 +54,30 @@
}
]
},
+ "libs/python/cua-sandbox": {
+ "release-type": "simple",
+ "component": "sandbox",
+ "package-name": "cua-sandbox",
+ "bump-minor-pre-major": true,
+ "version-file": "VERSION",
+ "changelog-path": "CHANGELOG.md",
+ "extra-files": [
+ {
+ "type": "toml",
+ "path": "pyproject.toml",
+ "jsonpath": "$.project.version"
+ },
+ {
+ "type": "generic",
+ "path": "cua_sandbox/__init__.py"
+ },
+ {
+ "type": "toml",
+ "path": "uv.lock",
+ "jsonpath": "$.package[?(@.name.value=='cua-sandbox')].version"
+ }
+ ]
+ },
"libs/lume": {
"release-type": "simple",
"component": "lume",