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
ci: make contributor attribution best effort everywhere (#5919)
cua-agents[bot]bf9e377f1323
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.mdindex fefe188ffb..9c419652c5 100644--- a/.github/CONTRIBUTING.md+++ b/.github/CONTRIBUTING.md@@ -172,12 +172,15 @@ Prefer a commit email linked to the contributor's GitHub account, especially aGitHub no-reply address. This also applies to the pull request author's owncommits: GitHub may turn an unlinked commit author into a `Co-authored-by`trailer during squash merge. If preserved authorship uses an email GitHub cannot-resolve, add the verified email-to-login entry to-`.github/release-attribution-config.json` in the same pull request. The-contributor-attribution check provides the exact `identityOverrides` JSON when-one explicitly referenced source pull request proves a unique mapping; it never-guesses from a name or email. Attribution preservation and resolvability must-land together. Preserve human coauthor trailers during rebases and squash+resolve, you can add the verified email-to-login entry to+`.github/release-attribution-config.json`. This is optional: attribution is+best effort and never blocks a pull request or a release. The+contributor-attribution check is informational: it always passes and reports+what it could not resolve as a warning (with the exact `identityOverrides` JSON+when one explicitly referenced source pull request proves a unique mapping). It+never guesses from a name or email. Identities that stay unresolved are credited+by display name, without an @-mention, in the release notes and listed in one+rolling maintainer issue. Preserve human coauthor trailers during rebases and squashmerges. Honor public credit opt-out requests and keep security-reportattribution private until the report can be disclosed.diff --git a/.github/release-manifest.schema.json b/.github/release-manifest.schema.jsonindex bdfa7ea0d0..64682f38a6 100644--- a/.github/release-manifest.schema.json+++ b/.github/release-manifest.schema.json@@ -80,6 +80,19 @@"type": "array","items": { "$ref": "#/$defs/releaseContributor" }},+ "unresolvedIdentities": {+ "type": "array",+ "items": {+ "type": "object",+ "additionalProperties": false,+ "required": ["sha", "name", "email"],+ "properties": {+ "sha": { "type": "string" },+ "name": { "type": "string" },+ "email": { "type": "string" }+ }+ }+ },"assets": {"type": "array","items": {@@ -123,7 +136,8 @@"properties": {"login": { "type": "string", "minLength": 1 },"role": { "enum": ["author", "coauthor", "reporter"] },- "external": { "type": "boolean" }+ "external": { "type": "boolean" },+ "mention": { "type": "boolean" }}},"releaseContributor": {@@ -138,7 +152,8 @@"minItems": 1,"uniqueItems": true},- "external": { "type": "boolean" }+ "external": { "type": "boolean" },+ "mention": { "type": "boolean" }}}}diff --git a/.github/releases/README.md b/.github/releases/README.mdindex ef15cc2bc3..42271e6669 100644--- a/.github/releases/README.md+++ b/.github/releases/README.md@@ -165,14 +165,24 @@ The first nightly is bounded by the component's current stable tag; laternightlies are bounded by the previous published nightly. A component thereforeneeds a reachable stable tag before its nightly channel is enabled.-Before starting platform builds, the nightly planner scans that exact range for-unresolved human coauthors. Unresolved attribution never holds a nightly: the-build continues, the plan carries `attributionWarning=true`, and the planner-writes a step summary and creates or refreshes one component-specific-maintainer issue. Nightly notes omit the unresolved coauthor. Stable releases-stay strict: `release_attribution.py` fails the manifest until the identity-resolves through a linked GitHub email or a verified `identityOverrides` entry;-never use wildcard or human-email ignores to clear it.+Attribution is best effort everywhere: it never fails a pull request check, a+nightly or a stable release. `release_attribution.py` resolves each identity+automatically, in this order: the pull request author login from the API; the+trusted `coauthorOverrides` and `identityOverrides`; a GitHub noreply email;+the merging maintainer's squash trailer; the commits API `author.login` and+`committer.login` of the pull request's commits (which covers every email+GitHub has linked); and a GitHub search by public email. Whatever is still+unresolved is credited by display name, without an @-mention, in the release+notes and the manifest's `unresolvedIdentities`, and is added (deduplicated by+email) to one rolling maintainer issue titled "Contributor attribution:+unresolved identities". Stable and nightly runs publish regardless.++The nightly planner still scans its range up front, sets+`attributionWarning=true`, writes a step summary and refreshes that same+rolling issue; the build continues. To credit someone by handle, link their+email to GitHub or add a verified `identityOverrides` entry (resolved entries+drop off the issue on the next refresh); never use wildcard or human-email+ignores.## Persistent consumer selectiondiff --git a/.github/scripts/release_attribution.py b/.github/scripts/release_attribution.pyindex 510923ff6c..08f0fa5dd9 100644--- a/.github/scripts/release_attribution.py+++ b/.github/scripts/release_attribution.py@@ -21,7 +21,7 @@ import reimport subprocessimport sysimport textwrap-from typing import Any, Iterable, Mapping, Sequence+from typing import Any, Callable, Iterable, Mapping, Sequencefrom urllib.error import HTTPErrorfrom urllib.parse import quotefrom urllib.request import Request, urlopen@@ -151,6 +151,53 @@ class GitHubClient:detail = error.read().decode("utf-8", errors="replace")raise ReleaseError(f"GitHub API GET {path} failed: {error.code} {detail}") from error+ def send(self, method: str, path: str, payload: Mapping[str, Any]) -> Any:+ request = Request(+ f"{self.api_url}/{path.lstrip('/')}",+ data=json.dumps(payload).encode(),+ method=method,+ headers={+ "Accept": "application/vnd.github+json",+ "Authorization": f"Bearer {self.token}",+ "Content-Type": "application/json",+ "User-Agent": "trycua-release-attribution",+ "X-GitHub-Api-Version": "2022-11-28",+ },+ )+ try:+ with urlopen(request, timeout=30) as response:+ return json.load(response)+ except HTTPError as error:+ detail = error.read().decode("utf-8", errors="replace")+ raise ReleaseError(+ f"GitHub API {method} {path} failed: {error.code} {detail}"+ ) from error++ def login_for_email(self, email: str) -> str | None:+ """The one GitHub account whose public profile email is ``email``, if any."""+ key = email.strip().lower()+ if not key or "@" not in key:+ return None+ cache = self.__dict__.setdefault("_email_logins", {})+ if key not in cache:+ login = None+ try:+ payload = self.get(f"search/users?q={quote(key + ' in:email', safe='')}&per_page=2")+ items = list(payload.get("items") or [])+ if (+ not payload.get("incomplete_results")+ and len(items) == 1+ and items[0].get("type") == "User"+ ):+ # Trust the match only when the profile's public email is exactly this one.+ profile = self.get(f"users/{quote(str(items[0].get('login') or ''), safe='')}")+ if str(profile.get("email") or "").strip().lower() == key:+ login = str(profile.get("login") or "") or None+ except (ReleaseError, OSError, ValueError, AttributeError):+ login = None+ cache[key] = login+ return cache[key]+def pulls_for_commit(self, repository: str, commit_sha: str) -> list[dict[str, Any]]:return list(self.get(f"repos/{repository}/commits/{commit_sha}/pulls?per_page=100"))@@ -445,6 +492,48 @@ def login_from_email(email: str, overrides: Mapping[str, str]) -> str | None:return match.group("login") if match else None+def lookup_email_login(github: Any, email: str) -> str | None:+ """Best-effort GitHub account lookup by public email; never raises."""+ lookup = getattr(github, "login_for_email", None)+ if lookup is None:+ return None+ try:+ return lookup(email) or None+ except (ReleaseError, OSError, ValueError):+ return None+++def pull_commit_email_logins(github: Any, repository: str, number: int) -> dict[str, str]:+ """Map each commit email GitHub links to an account, from the commits API.++ Uses ``author.login`` for the author email and ``committer.login`` for the+ committer email of every commit in the pull request. Best effort.+ """+ fetch = getattr(github, "pull_commits", None)+ if fetch is None or not number:+ return {}+ try:+ commits = fetch(repository, number)+ except (ReleaseError, OSError, ValueError):+ return {}+ logins: dict[str, str] = {}+ for item in commits:+ commit = item.get("commit") or {}+ for role in ("author", "committer"):+ email = str((commit.get(role) or {}).get("email") or "").strip().lower()+ login = str((item.get(role) or {}).get("login") or "").strip()+ if email and login:+ logins.setdefault(email, login)+ return logins+++def display_name_credit(name: str) -> str:+ """A safe plain-text display name: never an @-mention, no markup."""+ cleaned = re.sub(r"[\r\n\t]+", " ", name)+ cleaned = re.sub(r"[@<>\[\]`*|\\]", "", cleaned)+ return re.sub(r"\s+", " ", cleaned).strip()[:80]++def is_bot(login: str, configured_bots: set[str]) -> bool:lowered = login.lower()return lowered.endswith("[bot]") or lowered in configured_bots@@ -588,6 +677,7 @@ def validate_pr_attribution(linked_loginor coauthor_overrides.get(f"{name.strip()} <{email}>".lower())or login_from_email(email, base_overrides)+ or lookup_email_login(github, email))return login or None@@ -873,21 +963,30 @@ def merge_contributors(items: Iterable[Mapping[str, Any]]) -> list[dict[str, Anyby_login: dict[str, dict[str, Any]] = {}for item in items:login = str(item["login"])- key = login.lower()+ mention = bool(item.get("mention", True))+ key = login.lower() if mention else f"name:{login.lower()}"existing = by_login.setdefault(key,- {"login": login, "roles": set(), "external": bool(item.get("external", True))},+ {+ "login": login,+ "roles": set(),+ "external": bool(item.get("external", True)),+ "mention": mention,+ },)existing["roles"].add(str(item["role"]))existing["external"] = existing["external"] and bool(item.get("external", True))- return [- {+ merged = []+ for item in by_login.values():+ row = {"login": item["login"],"roles": sorted(item["roles"], key=lambda role: ROLE_ORDER.get(role, 99)),"external": item["external"],}- for item in sorted(by_login.values(), key=lambda value: value["login"].lower())- ]+ if not item["mention"]:+ row["mention"] = False+ merged.append(row)+ return sorted(merged, key=lambda value: (value.get("mention") is False, value["login"].lower()))def asset_checksums(asset_dir: Path | None) -> list[dict[str, Any]]:@@ -963,9 +1062,17 @@ def _change_contributors(github: GitHubClient,repository: str,config: Mapping[str, Any],- *,- strict_coauthors: bool = True,+ unresolved: list[dict[str, str]] | None = None,) -> tuple[list[dict[str, Any]], list[int], bool]:+ """Credit everyone behind one change; attribution is best effort and never raises.++ A trailer resolves, in order, through ``coauthorOverrides``/``identityOverrides``+ or a noreply email, the merging maintainer's squash trailer, the commits API+ ``author.login``/``committer.login`` of the pull request's commits, and a+ GitHub search by public email. Whatever stays unresolved is credited by+ display name without an @-mention and appended to ``unresolved`` for the+ rolling maintainer issue.+ """bots = {str(item).lower() for item in config.get("bots", [])}overrides = {str(email).lower(): str(login)@@ -981,6 +1088,7 @@ def _change_contributors(internal = {str(item).lower() for item in config.get("internalHandles", [])}opt_out = {str(item).lower() for item in config.get("optOutHandles", [])}items: list[dict[str, Any]] = []+ pull_logins: dict[str, str] | None = Noneauthor_login = str((pull.get("user") or {}).get("login") or "")if author_login and not is_bot(author_login, bots) and author_login.lower() not in opt_out:@@ -1002,15 +1110,27 @@ def _change_contributors(login = merging_maintainer_squash_coauthor(pull, match.group("name"), github, repository, internal)- if not login and not strict_coauthors:- # Nightly notes only: the planner already warned maintainers.- continueif not login:- raise ReleaseError(- f"commit {commit.sha} has unresolved human coauthor {email}; "- "link that email to GitHub, amend the commit with a recognized email, "- "or add a verified identityOverrides entry"- )+ if pull_logins is None:+ pull_logins = pull_commit_email_logins(+ github, repository, int(pull.get("number") or 0)+ )+ login = pull_logins.get(email) or lookup_email_login(github, email)+ if not login:+ display = display_name_credit(match.group("name"))+ if unresolved is not None:+ unresolved.append(+ {+ "sha": commit.sha,+ "name": match.group("name").strip() or "unknown",+ "email": email,+ }+ )+ if display and display.lower() != "unknown":+ items.append(+ {"login": display, "role": "coauthor", "external": True, "mention": False}+ )+ continueif is_bot(login, bots) or login.lower() in opt_out:continueitems.append(contributor(login, "coauthor", login.lower() not in internal))@@ -1050,9 +1170,13 @@ def _change_contributors(def _dedupe_change_contributors(items: Iterable[Mapping[str, Any]]) -> list[dict[str, Any]]:- unique: dict[tuple[str, str], dict[str, Any]] = {}+ unique: dict[tuple[str, str, str], dict[str, Any]] = {}for item in items:- key = (str(item["login"]).lower(), str(item["role"]))+ key = (+ str(item["login"]).lower(),+ str(item["role"]),+ str(item.get("mention", True)),+ )unique[key] = dict(item)return sorted(unique.values(),@@ -1130,6 +1254,7 @@ def build_manifest(pull_commits: dict[int, set[str]] = defaultdict(set)all_contributors: list[dict[str, Any]] = []visual_requested = False+ unresolved_identities: list[dict[str, str]] = []for commit in commits_in_range(repo_root,@@ -1187,7 +1312,7 @@ def build_manifest(github,repository,attribution_config,- strict_coauthors=channel == "stable",+ unresolved=unresolved_identities,)except ReleaseError as error:raise ReleaseError(f"pull request #{pull_number}: {error}") from error@@ -1267,9 +1392,18 @@ def build_manifest(}if channel == "nightly":manifest["channel"] = "nightly"+ deduped = _dedupe_identities(unresolved_identities)+ if deduped:+ manifest["unresolvedIdentities"] = dedupedreturn manifest+def credit(item: Mapping[str, Any]) -> str:+ """``@login`` for a resolved account, the plain display name otherwise."""+ login = str(item["login"])+ return f"@{login}" if item.get("mention", True) else login++def format_change_thanks(change: Mapping[str, Any]) -> str:external: dict[str, Mapping[str, Any]] = {}reporters: dict[str, Mapping[str, Any]] = {}@@ -1277,7 +1411,7 @@ def format_change_thanks(change: Mapping[str, Any]) -> str:if not item.get("external"):continuelogin = str(item["login"])- key = login.lower()+ key = login.lower() if item.get("mention", True) else f"name:{login.lower()}"if item.get("role") in {"author", "coauthor"}:external.setdefault(key, item)elif item.get("role") == "reporter":@@ -1287,9 +1421,9 @@ def format_change_thanks(change: Mapping[str, Any]) -> str:parts: list[str] = []if external:- parts.append("Thanks " + ", ".join(f"@{item['login']}" for item in external.values()))+ parts.append("Thanks " + ", ".join(credit(item) for item in external.values()))if reporters:- parts.append("reported by " + ", ".join(f"@{item['login']}" for item in reporters.values()))+ parts.append("reported by " + ", ".join(credit(item) for item in reporters.values()))return "; ".join(parts)@@ -1345,7 +1479,7 @@ def render_body(manifest: Mapping[str, Any], footer: str = "") -> str:if external:lines.append("Thanks to "- + ", ".join(f"@{item['login']}" for item in external)+ + ", ".join(credit(item) for item in external)+ " for contributing to this release.")else:@@ -1421,6 +1555,122 @@ def render_card_alt_text(manifest: Mapping[str, Any]) -> str:)+def _dedupe_identities(items: Iterable[Mapping[str, str]]) -> list[dict[str, str]]:+ unique: dict[str, dict[str, str]] = {}+ for item in items:+ email = str(item.get("email") or "").strip().lower()+ if email:+ unique.setdefault(+ email,+ {+ "sha": str(item.get("sha") or ""),+ "name": str(item.get("name") or "unknown"),+ "email": email,+ },+ )+ return sorted(unique.values(), key=lambda value: value["email"])+++UNRESOLVED_ISSUE_TITLE = "Contributor attribution: unresolved identities"+UNRESOLVED_ENTRY_RE = re.compile(r"^- `(?P<email>[^`\s]+)`: (?P<rest>.+)$")+UNRESOLVED_ISSUE_INTRO = (+ "Contributor attribution is best effort and never blocks a pull request, nightly or "+ "stable release. These commit identities could not be linked to a GitHub account, so "+ "release notes credit them by display name without an @-mention.\n\n"+ "To credit one by handle, link the email to the GitHub account or add a verified "+ "`identityOverrides` entry in `.github/release-attribution-config.json` (no wildcard or "+ "human-email ignores). Resolved entries drop off this list on the next refresh.\n\n"+ "Unresolved identities:\n"+)+++def merge_unresolved_issue_body(+ existing_body: str,+ identities: Sequence[Mapping[str, str]],+ config: Mapping[str, Any],+ source: str,+ resolves: Callable[[str], str | None] | None = None,+) -> str:+ """The rolling issue body: deduplicated by email, minus identities now resolved.++ ``resolves`` re-checks every stored email (for example through a GitHub+ lookup); overrides, coauthor overrides and noreply emails always apply.+ """+ overrides = _normalized_map(config, "identityOverrides")+ coauthor_emails = {+ key.rsplit("<", 1)[-1].rstrip(">").strip()+ for key in _normalized_map(config, "coauthorOverrides")+ }+ entries: dict[str, str] = {}+ for line in existing_body.splitlines():+ match = UNRESOLVED_ENTRY_RE.match(line.strip())+ if match:+ entries[match.group("email").lower()] = match.group("rest")+ for item in identities:+ email = str(item["email"]).strip().lower()+ name = display_name_credit(str(item.get("name") or "unknown")) or "unknown"+ entries.setdefault(email, f"{name} (commit `{item.get('sha', '')}`, {source})")+ lines = [+ f"- `{email}`: {rest}"+ for email, rest in sorted(entries.items())+ if login_from_email(email, overrides) is None+ and email not in coauthor_emails+ and not (resolves and resolves(email))+ ]+ return UNRESOLVED_ISSUE_INTRO + ("\n".join(lines) if lines else "_None right now._") + "\n"+++def report_unresolved_identities(+ github: GitHubClient,+ repository: str,+ identities: Sequence[Mapping[str, str]],+ config: Mapping[str, Any],+ source: str,+) -> int | None:+ """Create or refresh the one rolling maintainer issue. Best effort, never raises."""+ try:+ pending = [+ item+ for item in _dedupe_identities(identities)+ if not lookup_email_login(github, item["email"])+ ]+ found = github.get(+ "search/issues?q="+ + quote(f'repo:{repository} is:issue is:open in:title "{UNRESOLVED_ISSUE_TITLE}"')+ + "&per_page=20"+ )+ existing = next(+ (+ issue+ for issue in found.get("items") or []+ if issue.get("title") == UNRESOLVED_ISSUE_TITLE+ ),+ None,+ )+ if not existing and not pending:+ return None+ body = merge_unresolved_issue_body(+ str((existing or {}).get("body") or ""),+ pending,+ config,+ source,+ resolves=lambda email: lookup_email_login(github, email),+ )+ if existing:+ if body != str(existing.get("body") or ""):+ github.send("PATCH", f"repos/{repository}/issues/{existing['number']}", {"body": body})+ return int(existing["number"])+ created = github.send(+ "POST",+ f"repos/{repository}/issues",+ {"title": UNRESOLVED_ISSUE_TITLE, "body": body},+ )+ return int(created["number"])+ except Exception as error: # noqa: BLE001 - reporting must never fail a release+ print(f"::warning::could not update the unresolved attribution issue: {error}")+ return None++def write_json(path: Path, value: Mapping[str, Any]) -> None:path.parent.mkdir(parents=True, exist_ok=True)path.write_text(json.dumps(value, indent=2, sort_keys=True) + "\n")@@ -1455,6 +1705,25 @@ def collect_command(args: argparse.Namespace) -> None:)write_json(args.output, manifest)print(f"wrote {args.output} with {len(manifest['changes'])} changes")+ unresolved = manifest.get("unresolvedIdentities") or []+ if unresolved:+ print(+ f"::warning::{len(unresolved)} contributor identities could not be linked to "+ "GitHub; they are credited by display name without an @-mention"+ )+ if args.report_issue:+ # Also refreshes the rolling issue when nothing is unresolved, so resolved entries drop off.+ report_unresolved_identities(client, args.repository, unresolved, config, args.tag)++++def report_unresolved_command(args: argparse.Namespace) -> None:+ identities = json.loads(args.identities.read_text())+ config = json.loads(args.config.read_text())+ client = GitHubClient(+ os.environ.get("GH_TOKEN", ""), os.environ.get("GITHUB_API_URL", "https://api.github.com")+ )+ report_unresolved_identities(client, args.repository, identities, config, args.source)def validate_pr_command(args: argparse.Namespace) -> None:@@ -1506,6 +1775,33 @@ def validate_pr_command(args: argparse.Namespace) -> None:print(f"contributor attribution is merge-ready for pull request #{number}")+def report_pr_attribution(args: argparse.Namespace) -> None:+ """Run the PR attribution validation as information only.++ Attribution is best effort: every finding, and any error while checking,+ becomes a warning annotation and step summary. The check always passes so+ the required ``contributor-attribution`` status never blocks a merge.+ """+ try:+ validate_pr_command(args)+ return+ except Exception as error: # noqa: BLE001 - informational check must never fail+ message = str(error)+ warning = (+ "Contributor attribution warning (informational, this check still passes). "+ "Unresolved contributors are credited by display name without an @-mention in release "+ "notes. To credit by handle, use a GitHub-linked or noreply commit email, or add a "+ "verified `identityOverrides` entry.\n" + message+ )+ for line in message.splitlines() or [message]:+ print(f"::warning title=Contributor attribution::{line}")+ print(warning)+ summary = os.environ.get("GITHUB_STEP_SUMMARY")+ if summary:+ with open(summary, "a", encoding="utf-8") as handle:+ handle.write(f"### Contributor attribution (informational)\n\n{warning}\n")++def render_command(args: argparse.Namespace) -> None:manifest = json.loads(args.manifest.read_text())if manifest.get("schemaVersion") != 1:@@ -1572,6 +1868,19 @@ def build_parser() -> argparse.ArgumentParser:collect.add_argument("--asset-dir", type=Path)collect.add_argument("--channel", choices=("stable", "nightly"), default="stable")collect.add_argument("--output", type=Path, required=True)+ collect.add_argument(+ "--report-issue",+ action="store_true",+ help="record unresolved identities in the rolling maintainer issue (best effort)",+ )++ report = subparsers.add_parser("report-unresolved")+ report.add_argument("--repository", required=True)+ report.add_argument("--identities", type=Path, required=True, help="JSON list of identities")+ report.add_argument("--source", default="nightly")+ report.add_argument(+ "--config", type=Path, default=Path(".github/release-attribution-config.json")+ )render = subparsers.add_parser("render")render.add_argument("--manifest", type=Path, required=True)@@ -1599,9 +1908,11 @@ def main(argv: Sequence[str] | None = None) -> int:elif args.command == "classify-perception-diff":print("true" if is_perception_only_diff(args.path) else "false")elif args.command == "validate-pr":- validate_pr_command(args)+ report_pr_attribution(args)elif args.command == "collect":collect_command(args)+ elif args.command == "report-unresolved":+ report_unresolved_command(args)elif args.command == "render":render_command(args)else:diff --git a/.github/scripts/release_notes.py b/.github/scripts/release_notes.pyindex 970f30e923..05edba6606 100644--- a/.github/scripts/release_notes.py+++ b/.github/scripts/release_notes.py@@ -170,6 +170,13 @@ def render(manifest = _build(plan, repo_root, repository, tag, previous, sha, attribution, client, ref)finally:release_attribution.changelog_references_change = cites_every_change+ unresolved = manifest.get("unresolvedIdentities") or []+ if unresolved:+ print(f"::warning::{len(unresolved)} contributor identities are credited by display name")+ # Also refreshes the rolling issue when nothing is unresolved, so resolved entries drop off.+ release_attribution.report_unresolved_identities(+ client, repository, unresolved, attribution, tag+ )body = release_attribution.render_body(manifest, install_footer(plan["component"], plan["version"]))if len(body.encode()) > 125_000:raise ReleaseError("rendered GitHub release body exceeds 125,000 bytes")diff --git a/.github/scripts/tests/test_nightly_release_wiring.py b/.github/scripts/tests/test_nightly_release_wiring.pyindex 5c04800760..49f6fb7488 100644--- a/.github/scripts/tests/test_nightly_release_wiring.py+++ b/.github/scripts/tests/test_nightly_release_wiring.py@@ -130,11 +130,9 @@ def test_planner_requires_main_ancestry_and_preserves_immutable_evidence():assert "report-attribution-warning" in plannerassert "needs.plan.outputs.attribution_issues != '[]'" in plannerassert "GITHUB_STEP_SUMMARY" in planner- assert "gh issue comment" in planner- # A failed report must never fail the reusable planner the builds depend on.- assert "name: Create or refresh the attribution warning\n continue-on-error: true" in planner- assert "gh issue create" in planner- assert "gh issue edit" in planner+ # One rolling issue; a failed report must never fail the reusable planner.+ assert "name: Refresh the rolling unresolved-attribution issue\n continue-on-error: true" in planner+ assert "release_attribution.py report-unresolved" in plannerassert "cancel-in-progress: false" in source("nightly-cua-driver.yml")assert "cancel-in-progress: false" in source("nightly-lume.yml")diff --git a/.github/scripts/tests/test_pr_attribution_command.py b/.github/scripts/tests/test_pr_attribution_command.pyindex 56f06be8ab..09a288ba3c 100644--- a/.github/scripts/tests/test_pr_attribution_command.py+++ b/.github/scripts/tests/test_pr_attribution_command.py@@ -70,7 +70,7 @@ def validate_command(tmp_path, github_api):["git", *args], cwd=tmp_path, env=env, text=True).strip()- def validate(*, ancestor, head, body="", merge_base_sha=ANCESTOR):+ def validate(*, ancestor, head, body="", merge_base_sha=ANCESTOR, commit=None):config = tmp_path / CONFIGconfig.parent.mkdir()config.write_text(json.dumps({"identityOverrides": KNOWN}))@@ -95,7 +95,7 @@ def validate_command(tmp_path, github_api):"base": {"sha": ANCESTOR},"head": {"sha": HEAD, "repo": {"full_name": "contributor/cua"}},},- "/repos/trycua/cua/pulls/50/commits?per_page=100&page=1": [{+ "/repos/trycua/cua/pulls/50/commits?per_page=100&page=1": [commit or {"sha": HEAD,"author": {"login": "landing-author"},"commit": {@@ -150,23 +150,25 @@ def test_unchanged_configuration_uses_current_trusted_policy(validate_command, adef test_actual_changes_to_trusted_mappings_are_rejected(validate_command, head):result = validate_command(ancestor=KNOWN, head=head)- assert result.returncode == 1- assert "removes or changes trusted identityOverrides" in result.stderr- assert "merge-ready" not in result.stdout+ # Informational: the finding is a warning, the check still passes.+ assert result.returncode == 0, result.stdout + result.stderr+ assert "::warning" in result.stdout+ assert "removes or changes trusted identityOverrides" in result.stdout+ assert "is merge-ready for pull request" not in result.stdoutdef test_unverified_addition_on_stale_branch_is_rejected(validate_command):result = validate_command(ancestor={}, head={"[email protected]": "new-author"})- assert result.returncode == 1- assert "[email protected]" in result.stderr- assert "has no explicit same-repository source PR" in result.stderr- assert "merge-ready" not in result.stdout+ assert result.returncode == 0, result.stdout + result.stderr+ assert "[email protected]" in result.stdout+ assert "has no explicit same-repository source PR" in result.stdout+ assert "is merge-ready for pull request" not in result.stdout[email protected]("login,exit_code", [("source-author", 0), ("another-author", 1)])[email protected]("login,warns", [("source-author", False), ("another-author", True)])def test_addition_on_stale_branch_requires_verified_login(- validate_command, github_api, login, exit_code+ validate_command, github_api, login, warns):_, responses = github_apiresponses["/repos/trycua/cua/pulls/12"] = {@@ -181,10 +183,10 @@ def test_addition_on_stale_branch_requires_verified_login(body="The identity is verified by https://github.com/trycua/cua/pull/12",)- assert result.returncode == exit_code, result.stdout + result.stderr- if exit_code:- assert "verified source PR author is @source-author" in result.stderr- assert "merge-ready" not in result.stdout+ assert result.returncode == 0, result.stdout + result.stderr+ if warns:+ assert "verified source PR author is @source-author" in result.stdout+ assert "is merge-ready for pull request" not in result.stdoutelse:assert "merge-ready for pull request #50" in result.stdout@@ -195,15 +197,37 @@ def test_unreadable_configuration_is_not_approved(validate_command, missing):configurations[missing] = Noneresult = validate_command(**configurations)- assert result.returncode == 1- assert "GitHub API GET" in result.stderr- assert "404" in result.stderr- assert "merge-ready" not in result.stdout+ assert result.returncode == 0, result.stdout + result.stderr+ assert "::warning" in result.stdout+ assert "GitHub API GET" in result.stdout+ assert "404" in result.stdout+ assert "is merge-ready for pull request" not in result.stdoutdef test_missing_merge_base_is_not_approved(validate_command):result = validate_command(ancestor={}, head={}, merge_base_sha="")- assert result.returncode == 1- assert "no merge base" in result.stderr- assert "merge-ready" not in result.stdout+ assert result.returncode == 0, result.stdout + result.stderr+ assert "no merge base" in result.stdout+ assert "is merge-ready for pull request" not in result.stdout+++def test_unlinked_commit_email_passes_with_a_warning(validate_command):+ """A PR whose commit email GitHub cannot link never fails the check."""+ result = validate_command(+ ancestor=KNOWN,+ head=KNOWN,+ commit={+ "sha": HEAD,+ "author": None,+ "commit": {+ "author": {"name": "Some Person", "email": "[email protected]"},+ "message": "docs: update guide",+ },+ },+ )++ assert result.returncode == 0, result.stdout + result.stderr+ assert "::warning" in result.stdout+ assert "[email protected]" in result.stdout+ assert "informational" in result.stdoutdiff --git a/.github/scripts/tests/test_release_attribution.py b/.github/scripts/tests/test_release_attribution.pyindex bb39fd744d..2fe8f8427f 100644--- a/.github/scripts/tests/test_release_attribution.py+++ b/.github/scripts/tests/test_release_attribution.py@@ -22,6 +22,9 @@ from release_attribution import (linked_issue_numbers,login_from_email,merge_contributors,+ GitHubClient,+ merge_unresolved_issue_body,+ report_unresolved_identities,release_bump,release_entries,render_body,@@ -604,27 +607,288 @@ def test_nightly_manifest_attributes_maintenance_prs_without_a_versioned_changel)-def test_nightly_skips_unresolved_coauthor_but_stable_stays_strict():- commit = CommitRecord(+BEST_EFFORT_CONFIG = {+ "bots": [],+ "coauthorOverrides": {},+ "ignoredCoauthorEmails": [],+ "identityOverrides": {},+ "internalHandles": [],+ "optOutHandles": [],+}+UNRESOLVED_COMMIT = CommitRecord(+ "deadbeef",+ "fix(driver): preserve focus",+ "Co-authored-by: Unknown Person <[email protected]>",+)+UNRESOLVED_PULL = {+ "user": {"login": "author"},+ "author_association": "NONE",+ "body": "",+ "labels": [],+}+++def test_unresolved_coauthor_is_credited_by_name_without_a_mention():+ unresolved: list[dict[str, str]] = []+ contributors, _, _ = _change_contributors(+ UNRESOLVED_PULL,+ UNRESOLVED_COMMIT,+ FakeGitHub("deadbeef"),+ "trycua/cua",+ BEST_EFFORT_CONFIG,+ unresolved=unresolved,+ )+ assert contributors == [+ {"login": "author", "role": "author", "external": True},+ {"login": "Unknown Person", "role": "coauthor", "external": True, "mention": False},+ ]+ assert unresolved == [+ {"sha": "deadbeef", "name": "Unknown Person", "email": "[email protected]"}+ ]+++class LinkedGitHub(FakeGitHub):+ def __init__(self, commit_sha, *, commits=(), searched=None):+ super().__init__(commit_sha)+ self._commits = list(commits)+ self._searched = searched or {}++ def pull_commits(self, repository, number):+ return self._commits++ def login_for_email(self, email):+ return self._searched.get(email)+++def test_unresolved_coauthor_resolves_through_commits_api_and_email_search():+ via_commits = LinkedGitHub("deadbeef",- "fix(driver): preserve focus",- "Co-authored-by: Unknown Person <[email protected]>",+ commits=[+ {+ "author": {"login": "from-commits"},+ "commit": {"author": {"email": "[email protected]"}},+ }+ ],)- pull = {"user": {"login": "author"}, "author_association": "NONE", "body": "", "labels": []}- config = {- "bots": [],- "coauthorOverrides": {},- "ignoredCoauthorEmails": [],- "identityOverrides": {},- "internalHandles": [],- "optOutHandles": [],- }contributors, _, _ = _change_contributors(- pull, commit, FakeGitHub("deadbeef"), "trycua/cua", config, strict_coauthors=False+ {**UNRESOLVED_PULL, "number": 12}, UNRESOLVED_COMMIT, via_commits, "trycua/cua", BEST_EFFORT_CONFIG+ )+ assert {"login": "from-commits", "role": "coauthor", "external": True} in contributors++ via_search = LinkedGitHub("deadbeef", searched={"[email protected]": "from-search"})+ unresolved: list[dict[str, str]] = []+ contributors, _, _ = _change_contributors(+ UNRESOLVED_PULL,+ UNRESOLVED_COMMIT,+ via_search,+ "trycua/cua",+ BEST_EFFORT_CONFIG,+ unresolved=unresolved,)- assert [item["login"] for item in contributors] == ["author"]- with pytest.raises(ReleaseError, match="unresolved human coauthor"):- _change_contributors(pull, commit, FakeGitHub("deadbeef"), "trycua/cua", config)+ assert {"login": "from-search", "role": "coauthor", "external": True} in contributors+ assert unresolved == []+++def test_render_credits_unresolved_names_without_mentions():+ manifest = {+ "displayName": "Cua Driver",+ "version": "1.0.0",+ "tag": "cua-driver-rs-v1.0.0",+ "repository": "trycua/cua",+ "previousTag": None,+ "compareUrl": "https://github.com/trycua/cua/releases/tag/cua-driver-rs-v1.0.0",+ "changes": [+ {+ "type": "fix",+ "summary": "preserve focus",+ "pr": 12,+ "contributors": [+ {"login": "author", "role": "author", "external": True},+ {+ "login": "Unknown Person",+ "role": "coauthor",+ "external": True,+ "mention": False,+ },+ ],+ }+ ],+ "contributors": merge_contributors(+ [+ {"login": "author", "role": "author", "external": True},+ {"login": "Unknown Person", "role": "coauthor", "external": True, "mention": False},+ ]+ ),+ }+ body = render_body(manifest)+ assert "Thanks @author, Unknown Person." in body+ assert "Thanks to @author, Unknown Person for contributing" in body+ assert "@Unknown" not in body+++def test_stable_release_with_unresolved_coauthor_publishes(tmp_path: Path):+ """A stable manifest builds, credits by name, and lists the identity for the issue."""+ root = tmp_path+ git(root, "init")+ ident = ("-c", "user.name=Test", "-c", "[email protected]")+ (root / "libs/cua-driver").mkdir(parents=True)+ (root / "libs/cua-driver/CHANGELOG.md").write_text(+ "## 0.8.2\n\n- fix(driver): preserve focus (#12) (abc)\n"+ )+ git(root, "add", ".")+ git(root, *ident, "commit", "-m", "chore: start")+ git(root, "tag", "cua-driver-rs-v0.8.1")+ (root / "libs/cua-driver/a.txt").write_text("x")+ git(root, "add", ".")+ git(+ root,+ *ident,+ "commit",+ "-m",+ "fix(driver): preserve focus (#12)",+ "-m",+ "Co-authored-by: Unknown Person <[email protected]>",+ )+ sha = git(root, "rev-parse", "HEAD")++ class Hub(FakeGitHub):+ def pull(self, repository, number):+ return {+ "number": 12,+ "user": {"login": "pr-author"},+ "author_association": "NONE",+ "body": "",+ "labels": [],+ }++ manifest = build_manifest(+ repo_root=root,+ repository="trycua/cua",+ product="cua-driver-rs",+ display_name="Cua Driver",+ version="0.8.2",+ tag="cua-driver-rs-v0.8.2",+ release_ref=sha,+ previous_tag="cua-driver-rs-v0.8.1",+ expected_sha=sha,+ paths=("libs/cua-driver",),+ changelog_path=root / "libs/cua-driver/CHANGELOG.md",+ attribution_config=BEST_EFFORT_CONFIG,+ github=Hub(sha),+ )++ assert manifest["unresolvedIdentities"] == [+ {"sha": sha, "name": "Unknown Person", "email": "[email protected]"}+ ]+ assert {"login": "Unknown Person", "roles": ["coauthor"], "external": True, "mention": False} in (+ manifest["contributors"]+ )+ assert "@Unknown" not in render_body(manifest)+++def test_rolling_issue_body_dedupes_and_drops_resolved_identities():+ first = merge_unresolved_issue_body(+ "",+ [+ {"sha": "aaa", "name": "Some One", "email": "[email protected]"},+ {"sha": "bbb", "name": "Some One", "email": "[email protected]"},+ {"sha": "ccc", "name": "Other", "email": "[email protected]"},+ ],+ BEST_EFFORT_CONFIG,+ "v1",+ )+ assert first.count("`[email protected]`") == 1+ assert "`[email protected]`" in first+ refreshed = merge_unresolved_issue_body(+ first,+ [{"sha": "ddd", "name": "New", "email": "[email protected]"}],+ {**BEST_EFFORT_CONFIG, "identityOverrides": {"[email protected]": "other-login"}},+ "v2",+ )+ assert "`[email protected]`" not in refreshed+ assert "`[email protected]`" in refreshed and "`[email protected]`" in refreshed+++class SearchHub:+ """GitHub client double: fixed GET responses, recorded writes."""++ login_for_email = GitHubClient.login_for_email++ def __init__(self, responses):+ self.responses = responses+ self.writes = []++ def get(self, path):+ return self.responses[path]++ def send(self, method, path, payload):+ self.writes.append((method, path, payload))+ return {"number": 77}+++def _search_path(email):+ return f"search/users?q={email.replace('@', '%40').replace(':', '%3A')}%20in%3Aemail&per_page=2"+++def test_email_search_requires_exact_public_email_match():+ email = "[email protected]"+ search = {"items": [{"login": "someone", "type": "User"}]}+ hub = SearchHub({+ _search_path(email).replace("%20", "%20"): search,+ "users/someone": {"login": "someone", "email": "[email protected]"},+ })+ assert hub.login_for_email(email) is None+ hub = SearchHub({+ _search_path(email): search,+ "users/someone": {"login": "someone", "email": "[email protected]"},+ })+ assert hub.login_for_email(email) == "someone"+ hub = SearchHub({_search_path(email): {**search, "incomplete_results": True}})+ assert hub.login_for_email(email) is None+++def test_rolling_issue_refresh_clears_entries_that_now_resolve():+ body = merge_unresolved_issue_body(+ "",+ [+ {"sha": "a", "name": "One", "email": "[email protected]"},+ {"sha": "b", "name": "Two", "email": "[email protected]"},+ {"sha": "c", "name": "Three", "email": "[email protected]"},+ ],+ BEST_EFFORT_CONFIG,+ "v1",+ )+ config = {**BEST_EFFORT_CONFIG, "coauthorOverrides": {"Two <[email protected]>": "two"}}+ refreshed = merge_unresolved_issue_body(+ body, [], config, "v2", resolves=lambda email: "three" if email.startswith("three") else None+ )+ assert "`[email protected]`" in refreshed+ assert "[email protected]" not in refreshed and "[email protected]" not in refreshed++ only_resolved = merge_unresolved_issue_body(+ body,+ [],+ {**config, "identityOverrides": {"[email protected]": "one"}},+ "v3",+ resolves=lambda email: "x",+ )+ assert "_None right now._" in only_resolved++ hub = SearchHub({+ "search/issues?q=repo%3Atrycua/cua%20is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Contributor%20attribution%3A%20unresolved%20identities%22&per_page=20": {+ "items": [+ {+ "number": 5,+ "title": "Contributor attribution: unresolved identities",+ "body": body,+ }+ ]+ }+ })+ report_unresolved_identities(hub, "trycua/cua", [], {**config, "identityOverrides": {+ assert hub.writes and hub.writes[0][0] == "PATCH"+ assert "_None right now._" in hub.writes[0][2]["body"]def test_checked_in_override_resolves_adam():@@ -636,35 +900,6 @@ def test_checked_in_override_resolves_adam():assert config["identityOverrides"]["[email protected]"] == "0xABAN"-def test_unresolved_human_coauthor_fails_closed():- commit = CommitRecord(- "deadbeef",- "fix(driver): preserve focus",- "Co-authored-by: Unknown Person <[email protected]>",- )- pull = {- "user": {"login": "author"},- "author_association": "NONE",- "body": "",- "labels": [],- }- with pytest.raises(ReleaseError, match="unresolved human coauthor"):- _change_contributors(- pull,- commit,- FakeGitHub("deadbeef"),- "trycua/cua",- {- "bots": [],- "coauthorOverrides": {},- "ignoredCoauthorEmails": [],- "identityOverrides": {},- "internalHandles": [],- "optOutHandles": [],- },- )--def test_pr_2805_coauthor_resolves_through_trusted_identity_override():config = json.loads((REPO_ROOT / ".github/release-attribution-config.json").read_text())commit = CommitRecord(@@ -802,15 +1037,20 @@ def test_pr_4500_squash_trailer_resolves_with_the_checked_in_config():("ddupont808", [("", "Dillon DuPont")]),],)-def test_squash_trailer_without_maintainer_provenance_fails_closed(merger, commits):- with pytest.raises(ReleaseError, match="unresolved human coauthor"):- _change_contributors(- PULL_4500,- SQUASH_4500,- SquashTrailerGitHub(merger, commits),- "trycua/cua",- SQUASH_CONFIG,- )+def test_squash_trailer_without_maintainer_provenance_is_credited_by_name(merger, commits):+ unresolved: list[dict[str, str]] = []+ contributors, _, _ = _change_contributors(+ PULL_4500,+ SQUASH_4500,+ SquashTrailerGitHub(merger, commits),+ "trycua/cua",+ SQUASH_CONFIG,+ unresolved=unresolved,+ )+ assert unresolved+ assert all(+ item.get("mention") is False for item in contributors if item["role"] == "coauthor"+ )def _commit(root: Path, path: str, content: str, subject: str) -> str:diff --git a/.github/workflows/README.md b/.github/workflows/README.mdindex ca51a23066..4d18b41b71 100644--- a/.github/workflows/README.md+++ b/.github/workflows/README.md@@ -37,7 +37,8 @@ build on main pushes, manual runs and `ci:full` pull requests.Staging has no required status checks. trycua/cua requires `fleet-mirror-guard`,`contributor-attribution` and `validate`; none of those are renamed or removed-here. A workflow skipped by `paths:` never reports, so do not add a path-gated+here. `contributor-attribution` is informational: it always passes and reports+unresolved attribution as a warning. A workflow skipped by `paths:` never reports, so do not add a path-gatedcheck to the required list without a gate job that always runs.## Build cache (Rust)diff --git a/.github/workflows/cd-rust-cua-driver.yml b/.github/workflows/cd-rust-cua-driver.ymlindex a8b3b02167..cf2a2cfa3b 100644--- a/.github/workflows/cd-rust-cua-driver.yml+++ b/.github/workflows/cd-rust-cua-driver.yml@@ -77,7 +77,7 @@ on:permissions:contents: writeid-token: write- issues: read+ issues: write # the rolling unresolved-attribution issuepull-requests: readconcurrency:@@ -1541,6 +1541,7 @@ jobs:--release-metadata-path libs/cua-driver/typescript/package-lock.json \--changelog libs/cua-driver/rust/CHANGELOG.md \--asset-dir release-upload \+ --report-issue \--output release-metadata/release-manifest.json- name: Render release body and announcement draftdiff --git a/.github/workflows/cd-swift-lume.yml b/.github/workflows/cd-swift-lume.ymlindex 0a80d36afd..b3fa16929c 100644--- a/.github/workflows/cd-swift-lume.yml+++ b/.github/workflows/cd-swift-lume.yml@@ -51,7 +51,7 @@ on:permissions:contents: write- issues: read+ issues: write # the rolling unresolved-attribution issuepull-requests: readconcurrency:@@ -309,6 +309,7 @@ jobs:--path libs/lume \--changelog libs/lume/CHANGELOG.md \--asset-dir release-upload \+ --report-issue \--output release-metadata/release-manifest.json- name: Render release body and announcement draftdiff --git a/.github/workflows/nightly-component-plan.yml b/.github/workflows/nightly-component-plan.ymlindex bb92ed74f9..b5d7171328 100644--- a/.github/workflows/nightly-component-plan.yml+++ b/.github/workflows/nightly-component-plan.yml@@ -132,11 +132,18 @@ jobs:if: needs.plan.outputs.attribution_issues != '' && needs.plan.outputs.attribution_issues != '[]'runs-on: ubuntu-latestpermissions:+ contents: readissues: writesteps:- # A warning only: the nightly build continues. Stable releases still- # fail closed on unresolved attribution.- - name: Create or refresh the attribution warning+ # A warning only: attribution never holds a nightly or a stable release.+ # Unresolved identities go to the one rolling maintainer issue.+ - name: Check out trusted reporter+ uses: actions/checkout@v4+ with:+ sparse-checkout: .github+ persist-credentials: false++ - name: Refresh the rolling unresolved-attribution issuecontinue-on-error: trueenv:GH_TOKEN: ${{ github.token }}@@ -145,27 +152,13 @@ jobs:ATTRIBUTION_ISSUES: ${{ needs.plan.outputs.attribution_issues }}run: |set -euo pipefail- TITLE="Nightly ${COMPONENT} has unresolved contributor attribution"- BODY="$RUNNER_TEMP/nightly-attribution-warning.md"{- echo "The nightly build for ${COMPONENT} continued, but some contributors cannot be credited in its notes. A stable release of this range will fail until they are resolved."+ echo "Nightly ${COMPONENT} continued; unresolved contributors are credited by display name."echo- echo "Source commit: \`$SOURCE_SHA\`"- echo- echo "Unresolved identities:"jq -r '.[] | "- `\(.email)` in commit `\(.sha)` (\(.name))"' <<<"$ATTRIBUTION_ISSUES"- echo- echo "Resolve each identity by linking the email to GitHub, amending the source commit with a recognized email before merge, or adding a verified \`identityOverrides\` mapping. Do not add wildcard or human-email ignores."- } > "$BODY"- cat "$BODY" >> "$GITHUB_STEP_SUMMARY"- MATCHES=$(gh issue list --repo "${{ github.repository }}" --state open \- --search "\"$TITLE\" in:title" --limit 100 --json number,title)- NUMBER=$(jq -r --arg title "$TITLE" \- 'map(select(.title == $title)) | first | .number // empty' <<<"$MATCHES")- if [[ -n "$NUMBER" ]]; then- gh issue edit "$NUMBER" --repo "${{ github.repository }}" --body-file "$BODY"- gh issue comment "$NUMBER" --repo "${{ github.repository }}" \- --body "Seen again at \`$SOURCE_SHA\`; the nightly build continued."- else- gh issue create --repo "${{ github.repository }}" --title "$TITLE" --body-file "$BODY"- fi+ } >> "$GITHUB_STEP_SUMMARY"+ printf '%s' "$ATTRIBUTION_ISSUES" > "$RUNNER_TEMP/identities.json"+ python3 .github/scripts/release_attribution.py report-unresolved \+ --repository "${{ github.repository }}" \+ --identities "$RUNNER_TEMP/identities.json" \+ --source "nightly ${COMPONENT}"diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.ymlindex 13d39ffb7c..a9ad11fa7e 100644--- a/.github/workflows/release-notes.yml+++ b/.github/workflows/release-notes.yml@@ -37,7 +37,7 @@ on:permissions:contents: write- issues: read+ issues: write # the rolling unresolved-attribution issuepull-requests: readconcurrency: