The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(release): choose what a stable release builds and tests with lanes
ethernet36a8ee18cd77
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.ymlindex 83a6316df89..75c3aa8517b 100644--- a/.github/workflows/desktop-bundled-release.yml+++ b/.github/workflows/desktop-bundled-release.yml@@ -103,9 +103,13 @@ on:type: stringdefault: 'darwin-arm64,darwin-x64,win32-arm64,win32-x64,win32-bundle,linux-x64,linux-arm64,termux'skip-tests:- description: 'Stable candidates only: build and stage without native smokes or in-build test suites (the claim skipped tests).'+ description: 'Stable candidates only: build and stage without native smokes or in-build test suites (the claim has no smoke lane).'type: booleandefault: false+ store:+ description: 'Stable publish phase only: submit the Windows Store bundle (the claim built the windows lane).'+ type: boolean+ default: trueoutputs:darwin-arm64-receipt-url:value: ${{ jobs.stage-receipt-darwin-arm64.outputs.receipt-url }}@@ -2426,7 +2430,7 @@ jobs:stable-store:name: Submit the verified Store packageneeds: [validate, stable-publish]- if: inputs.release-phase == 'publish'+ if: inputs.release-phase == 'publish' && inputs.store# The Store is not a release gate: a failed submission leaves the release publishable# and the summary names the Store package for a manual Partner Center upload.continue-on-error: truediff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.ymlindex 06b48c63f39..e705916ac99 100644--- a/.github/workflows/stable-release.yml+++ b/.github/workflows/stable-release.yml@@ -47,12 +47,11 @@ jobs:version: ${{ steps.admit.outputs.version }}release-id: ${{ steps.admit.outputs.release-id }}release-epoch: ${{ steps.admit.outputs.release-epoch }}- skip-bundles: ${{ steps.admit.outputs.skip-bundles }}- skip-tests: ${{ steps.admit.outputs.skip-tests }}- # Opt-in platforms, off unless the claim was cut with --include-macos-intel- # / --include-termux. A claim without the keys reads them as false.- include-macos-intel: ${{ steps.admit.outputs.include-macos-intel }}- include-termux: ${{ steps.admit.outputs.include-termux }}+ # The claim's lanes (scripts/releases/lanes.py): `lanes` is one flag per lane and `jobs`+ # one run flag per lane-controlled job. Every job's `if` reads its own `jobs` entry, so the+ # lane table alone decides what runs and what the gates expect to have skipped.+ lanes: ${{ steps.admit.outputs.lanes }}+ jobs: ${{ steps.admit.outputs.jobs }}steps:- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1with:@@ -70,7 +69,7 @@ jobs:ci:name: Full CI pipelineneeds: admit- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['ci']permissions:contents: readpull-requests: write@@ -88,20 +87,20 @@ jobs:# tests still runs this job with its tests off. It builds alongside the# gates; only the acceptance join waits for CI.if: >-- !cancelled() && needs.admit.result == 'success'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['docker']uses: ./.github/workflows/docker.ymlsecrets: inheritwith:commit: ${{ needs.admit.outputs.commit }}release-phase: test- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes)['docker-tests'] }}tag: ${{ needs.admit.outputs.claim-tag }}version: ${{ needs.admit.outputs.version }}nix:needs: admit# The claim's policy removes it, not a gate it happens to need.- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['nix']uses: ./.github/workflows/nix.ymlwith:commit: ${{ needs.admit.outputs.commit }}@@ -110,10 +109,7 @@ jobs:pm-bundle:needs: admit- # Bundle acceptance is a test of bundles, so either claim flag removes it.- if: >-- needs.admit.outputs.skip-bundles != 'true'- && needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['pm-bundle']uses: ./.github/workflows/pm-bundle.ymlwith:release: true@@ -121,7 +117,7 @@ jobs:termux-checks:needs: admit- if: needs.admit.outputs.skip-tests != 'true' && needs.admit.outputs.include-termux == 'true'+ if: fromJSON(needs.admit.outputs.jobs)['termux-checks']permissions:contents: readactions: read@@ -133,7 +129,7 @@ jobs:windows-live:needs: admit- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['windows-live']uses: ./.github/workflows/windows-venv-e2e.ymlwith:commit: ${{ needs.admit.outputs.commit }}@@ -142,7 +138,7 @@ jobs:install-e2e:name: Install and update E2Eneeds: admit- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['install-e2e']permissions:contents: readactions: read@@ -159,7 +155,7 @@ jobs:needs: admit# Starts with the gates; the acceptance join is what requires CI.if: >-- !cancelled() && needs.admit.result == 'success' && needs.admit.outputs.skip-bundles != 'true'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['candidates-darwin-arm64']permissions:contents: writeactions: read@@ -173,17 +169,16 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: candidatejobs: darwin-arm64- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes).smoke }}candidates-darwin-x64:name: Build signed release candidates (darwin-x64)needs: admit# Starts with the gates; the acceptance join is what requires CI.- # macOS Intel is opt-in (--include-macos-intel): unsupported on main, and- # its macos-15-intel runner adds over an hour to the release.+ # macOS Intel is off by default: unsupported on main, and its macos-15-intel+ # runner adds over an hour to the release.if: >-- !cancelled() && needs.admit.result == 'success' && needs.admit.outputs.skip-bundles != 'true'- && needs.admit.outputs.include-macos-intel == 'true'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['candidates-darwin-x64']permissions:contents: writeactions: read@@ -197,14 +192,14 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: candidatejobs: darwin-x64- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes).smoke }}candidates-win32-arm64:name: Build signed release candidates (win32-arm64)needs: admit# Starts with the gates; the acceptance join is what requires CI.if: >-- !cancelled() && needs.admit.result == 'success' && needs.admit.outputs.skip-bundles != 'true'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['candidates-win32-arm64']permissions:contents: writeactions: read@@ -218,14 +213,14 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: candidatejobs: win32-arm64- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes).smoke }}candidates-win32-x64:name: Build signed release candidates (win32-x64)needs: admit# Starts with the gates; the acceptance join is what requires CI.if: >-- !cancelled() && needs.admit.result == 'success' && needs.admit.outputs.skip-bundles != 'true'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['candidates-win32-x64']permissions:contents: writeactions: read@@ -239,14 +234,14 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: candidatejobs: win32-x64- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes).smoke }}candidates-win32-bundle:name: Build signed release candidates (win32-bundle)needs: [admit, candidates-win32-arm64, candidates-win32-x64]# Starts with the gates; the acceptance join is what requires CI.if: >-- !cancelled() && needs.admit.result == 'success' && needs.admit.outputs.skip-bundles != 'true'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['candidates-win32-bundle']&& needs.candidates-win32-arm64.result == 'success'&& needs.candidates-win32-x64.result == 'success'permissions:@@ -262,16 +257,15 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: candidatejobs: win32-bundle- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes).smoke }}candidates-termux:name: Build signed release candidates (termux)needs: admit# Starts with the gates; the acceptance join is what requires CI.- # Termux is opt-in (--include-termux).+ # Termux is off by default.if: >-- !cancelled() && needs.admit.result == 'success' && needs.admit.outputs.skip-bundles != 'true'- && needs.admit.outputs.include-termux == 'true'+ !cancelled() && needs.admit.result == 'success' && fromJSON(needs.admit.outputs.jobs)['candidates-termux']permissions:contents: writeactions: read@@ -285,12 +279,12 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: candidatejobs: termux- skip-tests: ${{ needs.admit.outputs.skip-tests == 'true' }}+ skip-tests: ${{ !fromJSON(needs.admit.outputs.lanes).smoke }}transitions-darwin-arm64:name: Pin actual OLD and NEW signed packages (darwin-arm64)needs: [admit, candidates-darwin-arm64]- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['transitions-darwin-arm64']runs-on: ubuntu-24.04environment: release-signingoutputs:@@ -325,7 +319,7 @@ jobs:transitions-darwin-x64:name: Pin actual OLD and NEW signed packages (darwin-x64)needs: [admit, candidates-darwin-x64]- if: needs.admit.outputs.skip-tests != 'true' && needs.admit.outputs.include-macos-intel == 'true'+ if: fromJSON(needs.admit.outputs.jobs)['transitions-darwin-x64']runs-on: ubuntu-24.04environment: release-signingoutputs:@@ -360,7 +354,7 @@ jobs:transitions-win32:name: Pin actual OLD and NEW signed packages (win32)needs: [admit, candidates-win32-bundle]- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['transitions-win32']runs-on: ubuntu-24.04environment: release-signingoutputs:@@ -398,7 +392,7 @@ jobs:# The recorded smoke results are the calls' own workflow results: a# call's stable-phase-result fails when its smokes fail, so a failed# smoke fails this job's RELEASE_NEEDS check and stages no manifest.- if: always() && needs.admit.outputs.skip-bundles != 'true'+ if: always() && fromJSON(needs.admit.outputs.jobs)['candidate-manifest']needs: [admit, candidates-darwin-arm64, candidates-darwin-x64, candidates-win32-arm64,candidates-win32-x64, candidates-win32-bundle, candidates-termux]runs-on: ubuntu-24.04@@ -433,7 +427,7 @@ jobs:name: Windows signed-package acceptanceneeds: [admit, transitions-win32]# Without a published stable baseline there is no OLD package to upgrade from.- if: needs.transitions-win32.outputs.baseline != 'none'+ if: fromJSON(needs.admit.outputs.jobs)['windows-packaged'] && needs.transitions-win32.outputs.baseline != 'none'strategy:fail-fast: falsematrix: ${{ fromJSON(needs.transitions-win32.outputs.windows) }}@@ -452,7 +446,7 @@ jobs:name: macOS arm64 signed-package acceptanceneeds: [admit, transitions-darwin-arm64]# Without a published stable baseline there is no OLD package to upgrade from.- if: needs.transitions-darwin-arm64.outputs.baseline != 'none'+ if: fromJSON(needs.admit.outputs.jobs)['macos-packaged-arm64'] && needs.transitions-darwin-arm64.outputs.baseline != 'none'strategy:fail-fast: falsematrix: ${{ fromJSON(needs.transitions-darwin-arm64.outputs.macos) }}@@ -471,7 +465,7 @@ jobs:name: macOS x64 signed-package acceptanceneeds: [admit, transitions-darwin-x64]# Without a published stable baseline there is no OLD package to upgrade from.- if: needs.transitions-darwin-x64.outputs.baseline != 'none'+ if: fromJSON(needs.admit.outputs.jobs)['macos-packaged-x64'] && needs.transitions-darwin-x64.outputs.baseline != 'none'strategy:fail-fast: falsematrix: ${{ fromJSON(needs.transitions-darwin-x64.outputs.macos) }}@@ -489,7 +483,7 @@ jobs:bootstrap-version:name: Bootstrap installer release identityneeds: admit- if: needs.admit.outputs.skip-tests != 'true'+ if: fromJSON(needs.admit.outputs.jobs)['bootstrap-version']runs-on: ubuntu-24.04steps:- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1@@ -540,16 +534,14 @@ jobs:- run: python -m scripts.releases.stable gate admit ci docker nix pm-bundle termux-checks windows-live install-e2e candidates-darwin-arm64 candidates-darwin-x64 candidates-win32-arm64 candidates-win32-x64 candidates-win32-bundle candidates-termux candidate-manifest transitions-darwin-arm64 transitions-darwin-x64 transitions-win32 windows-packaged macos-packaged-arm64 macos-packaged-x64 bootstrap-versionenv:RELEASE_NEEDS: ${{ toJSON(needs) }}- SKIP_BUNDLES: ${{ needs.admit.outputs.skip-bundles }}- SKIP_TESTS: ${{ needs.admit.outputs.skip-tests }}- INCLUDE_MACOS_INTEL: ${{ needs.admit.outputs.include-macos-intel }}- INCLUDE_TERMUX: ${{ needs.admit.outputs.include-termux }}+ LANES: ${{ needs.admit.outputs.lanes }}publish-docker:name: Publish tested Docker image# B5: this job pushes only the immutable attempt-ref image tags; the# stable/latest aliases move in the ordered publication pass.needs: [admit, docker]+ if: fromJSON(needs.admit.outputs.jobs)['publish-docker']uses: ./.github/workflows/docker.ymlsecrets: inheritwith:@@ -565,7 +557,7 @@ jobs:# baseline (the first bundled release). Without !cancelled() that skip propagates here and# publication then refuses publish-bundles=skipped. acceptance itself is the gate.if: >-- !cancelled() && needs.admit.outputs.skip-bundles != 'true'+ !cancelled() && fromJSON(needs.admit.outputs.jobs)['publish-bundles']&& needs.acceptance.result == 'success' && needs.candidate-manifest.result == 'success'permissions:contents: write@@ -580,6 +572,7 @@ jobs:claim-object: ${{ needs.admit.outputs.claim-object }}release-phase: publishmanifest-sha256: ${{ needs.candidate-manifest.outputs.manifest-sha256 }}+ store: ${{ fromJSON(needs.admit.outputs.lanes).windows }}publication:name: All artifact publication succeeded@@ -596,10 +589,7 @@ jobs:- run: python -m scripts.releases.stable gate acceptance publish-docker publish-bundlesenv:RELEASE_NEEDS: ${{ toJSON(needs) }}- SKIP_BUNDLES: ${{ needs.admit.outputs.skip-bundles }}- SKIP_TESTS: ${{ needs.admit.outputs.skip-tests }}- INCLUDE_MACOS_INTEL: ${{ needs.admit.outputs.include-macos-intel }}- INCLUDE_TERMUX: ${{ needs.admit.outputs.include-termux }}+ LANES: ${{ needs.admit.outputs.lanes }}complete:name: Stable release is green@@ -627,12 +617,9 @@ jobs:- run: python -m scripts.releases.stable gate admit ci docker acceptance candidate-manifest publication publish-dockerenv:RELEASE_NEEDS: ${{ toJSON(needs) }}- SKIP_BUNDLES: ${{ needs.admit.outputs.skip-bundles }}- SKIP_TESTS: ${{ needs.admit.outputs.skip-tests }}- INCLUDE_MACOS_INTEL: ${{ needs.admit.outputs.include-macos-intel }}- INCLUDE_TERMUX: ${{ needs.admit.outputs.include-termux }}+ LANES: ${{ needs.admit.outputs.lanes }}- name: Validate the accepted candidate archive- if: needs.admit.outputs.skip-bundles != 'true'+ if: fromJSON(needs.admit.outputs.lanes).bundlesrun: python -m scripts.releases.stable completeenv:RELEASE_TAG: ${{ needs.admit.outputs.tag }}@@ -646,7 +633,7 @@ jobs:CLOUDFLARE_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET }}CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}- name: Render the admitted candidate smoke results- if: needs.admit.outputs.skip-bundles != 'true'+ if: fromJSON(needs.admit.outputs.lanes).bundles# The builds table is presentation: a render failure warns and the release still# publishes (rc.14-v0.21.7 passed every gate, then died here on missing env).continue-on-error: truediff --git a/apps/desktop/README.md b/apps/desktop/README.mdindex 2b0463e66fa..7d301158d8e 100644--- a/apps/desktop/README.md+++ b/apps/desktop/README.md@@ -12,7 +12,7 @@> **Intel Macs:** the `Hermes-Setup.dmg` bootstrap installer is built for> Apple Silicon (arm64) only, so on an Intel Mac it reports "not supported on> this Mac". Stable releases build the native `darwin-x64` bundle only when-> cut with `--include-macos-intel`; otherwise install the+> cut with `--with macos-intel`; otherwise install the> [CLI](../../README.md) and run `hermes desktop`. See> [Platform Support](../../website/docs/getting-started/platform-support.md#build-targets-and-support-priority).diff --git a/scripts/bundles/release_artifacts.py b/scripts/bundles/release_artifacts.pyindex bdc2d0f16d5..c243d4a4aa4 100644--- a/scripts/bundles/release_artifacts.py+++ b/scripts/bundles/release_artifacts.py@@ -14,7 +14,7 @@ import xml.etree.ElementTree as ETimport zipfilefrom pathlib import Path, PureWindowsPath-from scripts.releases import optional_platforms+from scripts.releases import lanes as lane_setfrom scripts.releases.stable import read_admitted_candidate, accepted_smoke_results, validate_candidates@@ -161,7 +161,7 @@ def validate_windows_bundle(bundle: Path, windows: list[dict]) -> None:ALL_HANDOFFS = ("win32-x64", "win32-arm64", "darwin-x64", "darwin-arm64", "termux", "windows-universal")-OPTIONAL_HANDOFFS = optional_platforms.HANDOFFS # opt-in handoff -> manifest target+WINDOWS_HANDOFFS = frozenset({"win32-x64", "win32-arm64", "windows-universal"})def assemble(root: Path, tag: str, commit: str, public_base: str, out: Path,@@ -171,16 +171,19 @@ def assemble(root: Path, tag: str, commit: str, public_base: str, out: Path,`tag` stays the plain payload identity; `archive` is the attempt ref themanifest and every artifact URL are keyed under. `handoffs` names the- groups this release built: the opt-in darwin-x64 and termux groups may be- left out, and then their targets must be absent from the manifest."""+ groups this release built; a group left out must have no target in the+ manifest. The three Windows groups build together or not at all: the+ universal and Store bundles are assembled from both architectures."""from scripts.releases.handoff import receipt_name, validate_receiptfrom scripts.releases.r2 import put, staging_key_forexpected = tuple(handoffs)- if (len(set(expected)) != len(expected) or not set(expected) <= set(ALL_HANDOFFS)- or not set(ALL_HANDOFFS) - set(OPTIONAL_HANDOFFS) <= set(expected)):+ windows = WINDOWS_HANDOFFS & set(expected)+ if (not expected or len(set(expected)) != len(expected) or not set(expected) <= set(ALL_HANDOFFS)+ or windows not in (set(), WINDOWS_HANDOFFS)):raise ValueError(f"Invalid candidate handoff set: {', '.join(expected)}")- absent = frozenset(target for name, target in OPTIONAL_HANDOFFS.items() if name not in expected)+ absent = frozenset(t for t in lane_set.TARGET_LANE if lane_set.TARGET_LANE[t] not in+ {lane_set.HANDOFF_LANE[name] for name in expected})smoke_results = accepted_smoke_results(smoke_results, absent=absent)by_name = {}for name in expected:@@ -203,10 +206,11 @@ def assemble(root: Path, tag: str, commit: str, public_base: str, out: Path,raise ValueError(f"Candidate local digest mismatch: {name}")if name.startswith("metadata-"):rows.append(json.loads(file.read_text(encoding="utf-8-sig")))- universal_name = single(name for name in by_name if name.endswith(".msixbundle") and not name.startswith("Store-"))- single(name for name in by_name if name.endswith(".msixbundle") and name.startswith("Store-"))- windows = [r for r in rows if r["platform"] == "windows"]- validate_windows_bundle(root / universal_name, windows)+ universal_name = None+ if windows:+ universal_name = single(name for name in by_name if name.endswith(".msixbundle") and not name.startswith("Store-"))+ single(name for name in by_name if name.endswith(".msixbundle") and name.startswith("Store-"))+ validate_windows_bundle(root / universal_name, [r for r in rows if r["platform"] == "windows"])files = [{**row, "url": f"{public_base.rstrip('/')}/{staging_key_for(archive, name)}"}for name, row in sorted(by_name.items()) if not name.startswith("metadata-")]by_name = {item["path"]: item for item in files}@@ -223,9 +227,8 @@ def assemble(root: Path, tag: str, commit: str, public_base: str, out: Path,"packages": packages, "files": files, "smoke_results": smoke_results}validate_candidates(result, tag, commit, public_base, release_epoch, archive=archive)present = {f"{row['platform']}/{row['arch']}" for row in packages}- for name, target in OPTIONAL_HANDOFFS.items():- if (target in present) != (name in expected):- raise ValueError(f"Candidate {target} row differs from the built handoffs")+ if present != set(lane_set.TARGET_LANE) - absent:+ raise ValueError("Candidate package rows differ from the built handoffs")out.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")put(tag=archive, key="release-candidates.json", file=out, immutable=True)return resultdiff --git a/scripts/release.py b/scripts/release.pyindex b701d807ca9..fb1446e8d34 100755--- a/scripts/release.py+++ b/scripts/release.py@@ -651,21 +651,19 @@ def main():release_cmd.add_argument("--bump", choices=["major", "minor", "patch"], default="patch")release_cmd.add_argument("--autopublish", action="store_true",help="Publish on green instead of leaving a draft")- release_cmd.add_argument("--skip-bundles", action="store_true",- help="Release only the tag and the Docker image: no desktop, Termux or "- "PM bundle builds, smokes, feeds or Store check. The desktop update "- "channel stays on the previous bundle release.")- release_cmd.add_argument("--skip-tests", action="store_true",- help="Emergency release: skip CI, Nix, PM bundle, install/update E2E, "- "Termux, Windows, native smoke and upgrade acceptance jobs. "- "Artifacts still build and publish.")- release_cmd.add_argument("--include-macos-intel", action="store_true",- help="Also build, test and publish the macOS Intel (darwin-x64) desktop "- "bundle. Off by default: Intel macOS is not supported on main and "- "its runner adds over an hour to the release.")- release_cmd.add_argument("--include-termux", action="store_true",- help="Also build, test and publish the Termux (Android aarch64) APT "- "package. Off by default.")+ from scripts.releases import lanes as lane_set++ release_cmd.add_argument("--only", action="append", metavar="LANES",+ help="Start from exactly these lanes instead of the default set "+ "(comma-separated, repeatable).")+ release_cmd.add_argument("--with", dest="with_lanes", action="append", metavar="LANES",+ help="Also build or test these lanes (comma-separated, repeatable).")+ release_cmd.add_argument("--without", dest="without_lanes", action="append", metavar="LANES",+ help="Do not build or test these lanes (comma-separated, repeatable).")+ release_cmd.epilog = ("Lanes (default on unless noted): "+ + "; ".join(f"{lane.name}{'' if lane.default else ' (off)'} = {lane.doc}"+ for lane in lane_set.LANES))+ release_cmd.formatter_class = argparse.RawDescriptionHelpFormatter# SUPPRESS keeps a --no-changelog given before the subcommand from being# reset by this parser's default.release_cmd.add_argument("--no-changelog", action="store_true", default=argparse.SUPPRESS,diff --git a/scripts/releases/channel_releases.py b/scripts/releases/channel_releases.pyindex 47e0a07f1d6..ddbb9e859e1 100644--- a/scripts/releases/channel_releases.py+++ b/scripts/releases/channel_releases.py@@ -14,7 +14,7 @@ from hermes_cli.release_channels import (ChannelError, build_prefix, canonical_json, validate_identity,)from scripts.bundles.channel_artifacts import assemble-from scripts.releases import handoff, optional_platforms, r2, stable+from scripts.releases import handoff, lanes as lane_set, r2, stablefrom scripts.releases.channels import ChannelPublisher, R2ChannelStorefrom scripts.releases.progress import logfrom scripts.releases.versioning import parse_attempt_ref@@ -54,10 +54,9 @@ def product_identity(tag: str, run=subprocess.check_output) -> dict:return validate_identity(identity)-# Stable builds these native legs only when the claim opts in; the other legs-# are in every bundle release.-OPTIONAL_NATIVE_LEGS = {p.handoff: tuple(p.target.split("/")) for p in optional_platforms.PLATFORMS- if p.handoff in NATIVE_LEGS}+# The macos-intel lane is not part of lanes.CHANNEL_DESKTOP: its leg is in a release only when the+# claim built it. The other legs are in every release that advances the channel.+OPTIONAL_NATIVE_LEGS = {"darwin-x64": ("macos", "x64")}def native_legs(accepted: dict | None) -> tuple[str, ...]:@@ -220,7 +219,7 @@ def admit_transaction(policy: str, env: dict, *, require_published: bool = Falsedef accepted_stable(publisher: ChannelPublisher, env: dict, tag: str, commit: str,- release_epoch: int, *, skip_tests: bool) -> dict:+ release_epoch: int, *, lanes: frozenset[str]) -> dict:"""Read the accepted candidate from the attempt-scoped release archive."""from hermes_cli.release_channels import decode_json, require_sha256@@ -233,7 +232,7 @@ def accepted_stable(publisher: ChannelPublisher, env: dict, tag: str, commit: stcandidate = decode_json(publisher.reader.read_bytes(key, digest))stable.validate_candidates(candidate, payload_tag, commit, publisher.public_base, release_epoch,archive=tag)- stable.require_smokes_match_claim(candidate, skip_tests=skip_tests)+ stable.require_smokes_match_claim(candidate, lanes)return candidate@@ -389,11 +388,12 @@ def publish_release(policy: str, env: dict, root: Path) -> dict:raise ChannelError("Protected R2 identity differs from the existing product")final_claim = stable.final_context({**env, "RELEASE_TAG": payload_tag})[2] \if policy == "stable-release" else None- if final_claim is not None and final_claim["skip_bundles"]:- raise ChannelError("A release that skipped bundles has no native bytes to advance a protected head")+ if final_claim is not None and not lane_set.advances_desktop(final_claim["lanes"]):+ raise ChannelError("A release that did not build every desktop package the channel serves "+ "cannot advance a protected head")release_epoch = final_claim["claim_epoch"] if final_claim is not None else Noneaccepted = accepted_stable(publisher, env, tag, commit, release_epoch,- skip_tests=final_claim["skip_tests"]) \+ lanes=final_claim["lanes"]) \if final_claim is not None else None# Native handoffs were staged under the attempt ref for stable attempts# (identical for canary, where tag == payload_tag).@@ -426,7 +426,7 @@ def publish_release(policy: str, env: dict, root: Path) -> dict:if release_epoch is None:raise ChannelError("Stable release epoch is unavailable")return accepted_stable(publisher, env, tag, commit, release_epoch,- skip_tests=final_claim["skip_tests"]) == accepted+ lanes=final_claim["lanes"]) == acceptedreturn Truesource_version = payload_tag[1:].split("+", 1)[0]diff --git a/scripts/releases/entrypoint.py b/scripts/releases/entrypoint.pyindex 3aa135c8c55..6de8ca80b38 100644--- a/scripts/releases/entrypoint.py+++ b/scripts/releases/entrypoint.py@@ -16,7 +16,7 @@ import timefrom collections.abc import Callablefrom pathlib import Path-from scripts.releases import optional_platforms, stable+from scripts.releases import lanes as lane_set, stablefrom scripts.releases.draft_warning import draft_bodyfrom scripts.releases.versioning import (SEED, attempt_ref, derive_next_version, marker_ref, next_attempt,@@ -224,18 +224,16 @@ def _abandon_confirmed(outstanding: tuple[str, int, str], confirm_abandon: Calladef release(commit: str, *, bump: str, repo: Path, remote: str, repository: str,execute, autopublish: bool = False, no_changelog: bool = False,- skip_bundles: bool = False, skip_tests: bool = False,- include_macos_intel: bool = False, include_termux: bool = False,+ lanes: frozenset[str] = lane_set.DEFAULT,published: tuple[str, str | None] = (SEED, None),run_wait: float = 0, sleep=time.sleep,confirm_abandon: Callable[[str], bool] | None = None, inspect=None) -> dict:"""Claim the next attempt of the derived version, cut its draft, and start the gate.``published`` is the stable channel's ``(version, commit)``; the commit is- None before the first publication. ``skip_bundles``, ``skip_tests``,- ``include_macos_intel`` and ``include_termux`` are written into the claim,- which is the one record every later job reads. macOS Intel and Termux are- not built unless their include flag is set.+ None before the first publication. ``lanes`` (what to build and test, see+ scripts/releases/lanes.py) is written into the claim, which is the one+ record every later job reads.``run_wait`` is how many seconds to keep looking for the dispatched run;GitHub lists it a moment after the dispatch returns.``confirm_abandon`` is asked about an outstanding attempt's ref; only a@@ -293,10 +291,7 @@ def release(commit: str, *, bump: str, repo: Path, remote: str, repository: str,"attempt": attempt,"commit": commit,"autopublish": autopublish,- "skipBundles": skip_bundles,- "skipTests": skip_tests,- "includeMacosIntel": include_macos_intel,- "includeTermux": include_termux,+ "lanes": sorted(lanes),"claimEpoch": claim_epoch,}, sort_keys=True, separators=(",", ":"))subprocess.check_output(@@ -350,8 +345,7 @@ def release(commit: str, *, bump: str, repo: Path, remote: str, repository: str,return {"version": version, "tag": tag, "commit": commit, "url": url, "repository": repository,"final_url": f"https://github.com/{repository}/releases/tag/v{version}","run_url": run_url, "autopublish": autopublish,- "skip_bundles": skip_bundles, "skip_tests": skip_tests,- "include_macos_intel": include_macos_intel, "include_termux": include_termux}+ "lanes": lanes}RUN_POLL_SECONDS = 2@@ -520,17 +514,19 @@ def next_steps(result: dict, *, bold: bool = False) -> str:"Release CI: " + (result.get("run_url")or f"the run is not listed yet. Find {tag} at {actions_url}"),]- if result["skip_bundles"]:- lines.append("Bundles are skipped. Only the tag, the GitHub release and the Docker image "- "ship; the desktop, Termux and Store channels stay on the previous release.")- else:- left_out = optional_platforms.excluded(result)- if left_out:- effects = "; ".join(p.left_out for p in left_out)- lines.append(f"Not built: {' and '.join(p.label for p in left_out)} (opt in with "- f"{' / '.join(p.option for p in left_out)}). {effects[0].upper()}{effects[1:]}.")- if result["skip_tests"]:- warning = "Tests are skipped, since you passed --skip-tests"+ lanes = result["lanes"]+ left_out = [name for name in lane_set.LEFT_OUT if name not in lanes]+ if left_out:+ effects = "; ".join(lane_set.LEFT_OUT[name] for name in left_out)+ lines.append(f"Not built: {', '.join(left_out)}. {effects[0].upper()}{effects[1:]}.")+ if lane_set.has_bundles(lanes) and not lane_set.advances_desktop(lanes):+ lines.append("This is a partial desktop release: its packages are verified, but the desktop "+ "update channel and feeds stay on the previous release (they move only when "+ "windows and macos-arm64 are both built).")+ untested = [name for name in lane_set.NAMES if name not in lanes and name not in lane_set.LEFT_OUT+ and not (name == "termux-checks" and "termux" not in lanes)]+ if untested:+ warning = f"Not tested: {', '.join(untested)}"lines.append(f"\033[1m{warning}\033[0m" if bold else warning)lines.append(f"Draft release: {result['url']}")if result["autopublish"]:@@ -566,6 +562,11 @@ def cmd_release(args) -> None:"""The ``release`` subcommand: claim, draft, dispatch."""from scripts import release as release_script+ try:+ lanes = lane_set.select(only=lane_set.parse_list(args.only), with_=lane_set.parse_list(args.with_lanes) or (),+ without=lane_set.parse_list(args.without_lanes) or ())+ except ValueError as error:+ raise SystemExit(f"release: {error}") from errorrepo = release_script.REPO_ROOTremote = release_script.resolve_push_remote(args.remote)repository = release_script.remote_github_repo(remote)@@ -583,8 +584,7 @@ def cmd_release(args) -> None:result = release(commit, bump=args.bump, repo=repo, remote=remote, repository=repository,execute=execute, autopublish=args.autopublish, no_changelog=args.no_changelog,- skip_bundles=args.skip_bundles, skip_tests=args.skip_tests,- include_macos_intel=args.include_macos_intel, include_termux=args.include_termux,+ lanes=lanes,published=published_stable_identity(repository), run_wait=RUN_WAIT_SECONDS,confirm_abandon=_abandon_prompt(), inspect=lambda command: _inspect(repo, command),)diff --git a/scripts/releases/lanes.py b/scripts/releases/lanes.pynew file mode 100644index 00000000000..bd82b7e14d5--- /dev/null+++ b/scripts/releases/lanes.py@@ -0,0 +1,217 @@+"""The stable release lanes, defined once.++A stable release is a set of lanes. A build lane produces something users get+(a package or an image); a test lane is a suite that gates the release. The+claim records the set, ``admit`` turns it into one flag per lane and one run+flag per workflow job, and every gate judges each job against that same set.++``release.py release`` starts from DEFAULT (every lane except macOS Intel and+Termux) and edits it with ``--only``, ``--with`` and ``--without``.++Lanes are independent switches, but a job runs only when every lane it needs+is on (JOB_LANES), so a test lane for something that is not built is inert:+``upgrade`` with ``macos-arm64`` off runs no macOS upgrade arm.+"""+from __future__ import annotations++from dataclasses import dataclass+from typing import Iterable, Mapping+++@dataclass(frozen=True)+class Lane:+ name: str+ default: bool+ doc: str+++LANES = (+ Lane("docker", True, "build and publish the Docker image"),+ Lane("windows", True, "Windows x64 + arm64 MSIX, the universal bundle and the Microsoft Store bundle"),+ Lane("macos-arm64", True, "macOS Apple Silicon DMG + ZIP"),+ Lane("macos-intel", False, "macOS Intel DMG + ZIP (unsupported on main; its runner adds over an hour)"),+ Lane("termux", False, "Termux (Android aarch64) APT package"),+ Lane("ci", True, "the full CI pipeline"),+ Lane("nix", True, "Nix checks"),+ Lane("docker-tests", True, "tests of the Docker image before it is published"),+ Lane("pm-bundle", True, "PM bundle acceptance"),+ Lane("windows-live", True, "Windows live venv E2E"),+ Lane("install-e2e", True, "install and update E2E"),+ Lane("bootstrap-version", True, "bootstrap installer release identity check"),+ Lane("termux-checks", True, "Termux verification (runs only with termux)"),+ Lane("smoke", True, "native install + chat smoke of each built desktop package"),+ Lane("upgrade", True, "signed-package upgrade acceptance (OLD to NEW) of each built desktop package"),+)+NAMES = tuple(lane.name for lane in LANES)+DEFAULT = frozenset(lane.name for lane in LANES if lane.default)++DESKTOP = ("windows", "macos-arm64", "macos-intel")+BUNDLES = (*DESKTOP, "termux")+# The protected desktop channel, the update feeds and the Termux index move only for a release that+# built every desktop package the channel serves. A partial set still stages, verifies and (for+# Windows) submits its packages, but leaves the channels on the previous release.+CHANNEL_DESKTOP = ("windows", "macos-arm64")++# Each stable-release.yml job and the lanes that must all be on for it to run. A job named here+# reports `skipped` when one is off and `success` otherwise; a job not named never skips. "bundles"+# is derived: any build lane except docker.+JOB_LANES: dict[str, frozenset[str]] = {name: frozenset(needs) for name, needs in {+ "ci": ("ci",),+ "nix": ("nix",),+ "docker": ("docker",),+ "publish-docker": ("docker",),+ "pm-bundle": ("pm-bundle",),+ "termux-checks": ("termux-checks", "termux"),+ "windows-live": ("windows-live",),+ "install-e2e": ("install-e2e",),+ "bootstrap-version": ("bootstrap-version",),+ "candidates-darwin-arm64": ("macos-arm64",),+ "candidates-darwin-x64": ("macos-intel",),+ "candidates-win32-arm64": ("windows",),+ "candidates-win32-x64": ("windows",),+ "candidates-win32-bundle": ("windows",),+ "candidates-termux": ("termux",),+ "candidate-manifest": ("bundles",),+ "publish-bundles": ("bundles",),+ "transitions-darwin-arm64": ("macos-arm64", "upgrade"),+ "transitions-darwin-x64": ("macos-intel", "upgrade"),+ "transitions-win32": ("windows", "upgrade"),+ "macos-packaged-arm64": ("macos-arm64", "upgrade"),+ "macos-packaged-x64": ("macos-intel", "upgrade"),+ "windows-packaged": ("windows", "upgrade"),+}.items()}++# Candidate handoff group and manifest target, each with the lane that builds it.+HANDOFF_LANE = {"win32-x64": "windows", "win32-arm64": "windows", "windows-universal": "windows",+ "darwin-arm64": "macos-arm64", "darwin-x64": "macos-intel", "termux": "termux"}+TARGET_LANE = {"windows/x64": "windows", "windows/arm64": "windows", "macos/arm64": "macos-arm64",+ "macos/x64": "macos-intel", "termux/aarch64": "termux"}+LEFT_OUT = {+ "docker": "the Docker image keeps its previous stable tag",+ "windows": "no Windows packages and no Microsoft Store submission",+ "macos-arm64": "no macOS Apple Silicon package",+ "macos-intel": "Intel Macs get no update: the shared macOS stable feed lists arm64 only",+ "termux": "the Termux APT channel stays on its previous release",+}+++def select(*, only: Iterable[str] | None = None, with_: Iterable[str] = (),+ without: Iterable[str] = ()) -> frozenset[str]:+ """The lane set a ``release`` command asks for. ``only`` replaces DEFAULT as the base."""+ base, added, removed = (_known(group) for group in (DEFAULT if only is None else only, with_, without))+ if added & removed:+ raise ValueError(f"--with and --without both name {', '.join(sorted(added & removed))}")+ return frozenset((base | added) - removed)+++def _known(names: Iterable[str]) -> frozenset[str]:+ names = frozenset(names)+ unknown = names - set(NAMES)+ if unknown:+ raise ValueError(f"unknown lane {', '.join(sorted(unknown))}; lanes are {', '.join(NAMES)}")+ return names+++def parse_list(values: Iterable[str] | None) -> list[str] | None:+ """Flatten repeated comma-separated option values; None when the option was not given."""+ if values is None:+ return None+ return [name.strip() for value in values for name in value.split(",") if name.strip()]+++def effective(lanes: Iterable[str]) -> frozenset[str]:+ lanes = frozenset(lanes)+ return lanes | {"bundles"} if lanes & set(BUNDLES) else lanes+++def flags(lanes: Iterable[str]) -> dict[str, bool]:+ """One flag per lane plus the derived ``bundles``: what ``admit`` hands the workflow."""+ on = effective(lanes)+ return {name: name in on for name in (*NAMES, "bundles")}+++def from_flags(raw: object) -> frozenset[str]:+ """The lane set of a ``flags`` mapping; refuses anything but a boolean for every lane."""+ if not isinstance(raw, Mapping) or set(raw) != {*NAMES, "bundles"} \+ or any(not isinstance(value, bool) for value in raw.values()):+ raise ValueError("lanes must be a boolean for every lane")+ return frozenset(name for name in NAMES if raw[name])+++def jobs_to_run(lanes: Iterable[str]) -> dict[str, bool]:+ """Whether each lane-controlled job runs. Every ``if`` in the workflow reads this."""+ on = effective(lanes)+ return {job: needs <= on for job, needs in JOB_LANES.items()}+++def handoffs(lanes: Iterable[str], names: Iterable[str]) -> tuple[str, ...]:+ """``names`` without the candidate handoff groups the lanes did not build."""+ on = frozenset(lanes)+ return tuple(name for name in names if HANDOFF_LANE[name] in on)+++def targets(lanes: Iterable[str]) -> frozenset[str]:+ """The manifest platform/arch targets the lanes build."""+ on = frozenset(lanes)+ return frozenset(target for target, lane in TARGET_LANE.items() if lane in on)+++def has_bundles(lanes: Iterable[str]) -> bool:+ return bool(frozenset(lanes) & set(BUNDLES))+++def runs_smokes(lanes: Iterable[str]) -> bool:+ """A smoke result exists only for a built desktop package."""+ on = frozenset(lanes)+ return "smoke" in on and bool(on & set(DESKTOP))+++def advances_desktop(lanes: Iterable[str]) -> bool:+ return frozenset(lanes) >= set(CHANNEL_DESKTOP)+++def moves_channels(lanes: Iterable[str]) -> bool:+ """Whether publication moves a channel head. A release that moves none is finished once public."""+ on = frozenset(lanes)+ return "docker" in on or advances_desktop(on)+++_LEGACY_OPTIONAL = ("includeMacosIntel", "includeTermux")+_LEGACY_BUNDLE_LANES = frozenset({*BUNDLES, "pm-bundle", "upgrade", "smoke"})+_TEST_LANES = frozenset({"ci", "nix", "docker-tests", "pm-bundle", "windows-live", "install-e2e",+ "bootstrap-version", "termux-checks", "smoke", "upgrade"})+++def claim_lanes(metadata: Mapping) -> frozenset[str]:+ """The lanes a claim message records.++ Claims cut before lanes existed carry ``skipBundles``, ``skipTests`` and+ (later) ``includeMacosIntel`` / ``includeTermux`` instead of ``lanes``. They+ stay readable for as long as their tags do: each translates to the lane set+ that gated the same jobs. A missing include key reads as false.+ """+ if "lanes" in metadata:+ lanes = metadata["lanes"]+ if (not isinstance(lanes, list) or any(not isinstance(name, str) for name in lanes)+ or lanes != sorted(set(lanes))):+ raise ValueError("Stable claim metadata is invalid")+ try:+ return _known(lanes)+ except ValueError as error:+ raise ValueError("Stable claim metadata is invalid") from error+ if any(not isinstance(metadata.get(key), bool)+ for key in ("skipBundles", "skipTests", *(k for k in _LEGACY_OPTIONAL if k in metadata))):+ raise ValueError("Stable claim metadata is invalid")+ lanes = set(NAMES) - {"macos-intel", "termux"}+ lanes |= {lane for key, lane in zip(_LEGACY_OPTIONAL, ("macos-intel", "termux")) if metadata.get(key)}+ if metadata["skipBundles"]:+ lanes -= _LEGACY_BUNDLE_LANES+ if metadata["skipTests"]:+ lanes -= _TEST_LANES+ return frozenset(lanes)+++def describe(lanes: Iterable[str]) -> str:+ on = frozenset(lanes)+ off = [name for name in NAMES if name not in on]+ return f"on: {', '.join(name for name in NAMES if name in on) or 'none'}; off: {', '.join(off) or 'none'}"diff --git a/scripts/releases/optional_platforms.py b/scripts/releases/optional_platforms.pydeleted file mode 100644index 000c4c0ec13..00000000000--- a/scripts/releases/optional_platforms.py+++ /dev/null@@ -1,76 +0,0 @@-"""The opt-in stable release platforms, defined once.--A stable release builds macOS Intel and Termux only when its claim asks for-them. Each row ties a claim flag to everything that flag controls: the-release.py option, the admit output, the gate's removal reason, the jobs it-removes, the candidate handoff, the manifest target, and the candidate call-and smoke job. A claim cut before these flags existed lacks the keys, and a-missing key reads as false.-"""-from __future__ import annotations--from dataclasses import dataclass-from typing import Mapping---@dataclass(frozen=True)-class OptionalPlatform:- label: str- claim_flag: str # key in the claim message- key: str # normalized claim field, keyword argument, and admit output (with dashes)- option: str # release.py release option- exclusion: str # gate removal reason when the platform is left out- jobs: tuple[str, ...] # stable-release.yml jobs the exclusion removes- handoff: str # candidate handoff group- target: str # candidate manifest platform/arch- left_out: str # what users of the platform get from a release that leaves it out- call: str | None = None # candidate call whose result records the smoke- smoke: str | None = None---PLATFORMS = (- OptionalPlatform("macOS Intel", "includeMacosIntel", "include_macos_intel", "--include-macos-intel",- "excludeMacosIntel",- ("candidates-darwin-x64", "transitions-darwin-x64", "macos-packaged-x64"),- "darwin-x64", "macos/x64",- # promote rewrites the one shared stable-mac.yml feed with the arm64 leg alone.- "Intel Macs get no update: the shared macOS stable feed now lists arm64 only",- "candidates-darwin-x64", "smoke-darwin-x64"),- OptionalPlatform("Termux", "includeTermux", "include_termux", "--include-termux", "excludeTermux",- ("candidates-termux", "termux-checks"), "termux", "termux/aarch64",- "the Termux APT channel stays on its previous release"),-)-CLAIM_FLAGS = tuple(p.claim_flag for p in PLATFORMS)-TARGETS = tuple(p.target for p in PLATFORMS)-# The opt-in handoffs and the manifest target each one produces.-HANDOFFS = {p.handoff: p.target for p in PLATFORMS}---def claim_flags(metadata: dict) -> dict:- """The claim's opt-in flags, each false when absent; raises on a non-bool."""- if any(not isinstance(metadata[flag], bool) for flag in CLAIM_FLAGS if flag in metadata):- raise ValueError("Stable claim metadata is invalid")- return {flag: metadata.get(flag, False) for flag in CLAIM_FLAGS}---def excluded(flags: Mapping[str, bool]) -> tuple[OptionalPlatform, ...]:- """The platforms a claim leaves out. ``flags`` maps each ``key`` to its value."""- return tuple(p for p in PLATFORMS if not flags.get(p.key))---def claim_handoffs(handoffs: tuple[str, ...], flags: Mapping[str, bool]) -> tuple[str, ...]:- """``handoffs`` without the groups the claim did not opt into."""- omitted = {p.handoff for p in excluded(flags)}- return tuple(name for name in handoffs if name not in omitted)---def require_targets_match_claim(manifest: dict, *, include_macos_intel: bool,- include_termux: bool) -> None:- """The opt-in targets are in the manifest exactly when the claim asked for them."""- flags = {"include_macos_intel": include_macos_intel, "include_termux": include_termux}- present = {f"{row.get('platform')}/{row.get('arch')}" for row in manifest.get("packages", [])}- for p in PLATFORMS:- wanted = flags[p.key]- if (p.target in present) != wanted:- raise ValueError(f"Candidate manifest {'lacks' if wanted else 'carries'} {p.target}, "- "which differs from the claim")diff --git a/scripts/releases/sequencer.py b/scripts/releases/sequencer.pyindex ef4100c3bdd..12e17504902 100644--- a/scripts/releases/sequencer.py+++ b/scripts/releases/sequencer.py@@ -15,6 +15,7 @@ import timefrom datetime import datetime, timedelta, timezone, UTCfrom pathlib import Path+from scripts.releases import lanes as lane_setfrom scripts.releases.progress import error as log_error, group, log, logged_run, noticefrom scripts.releases.versioning import (marker_ref, outstanding_attempts, parse_attempt_ref, parse_marker_ref,@@ -262,7 +263,7 @@ def discover(repository: str, run=output) -> list[dict]:commit = claim_ref["commit"]claim = _tag_message(claim_tag, claim_ref["object"], run)try:- # Normalized: a claim cut before the opt-in platform flags reads them as false.+ # Normalized: a claim cut before lanes existed reads as the lane set it gated.claim = validate_claim(claim, version=version, attempt=attempt, commit=commit)except ValueError as error:raise ValueError(f"{claim_tag} metadata is invalid") from error@@ -325,18 +326,15 @@ def discover(repository: str, run=output) -> list[dict]:if retry:why += f"; failed-job retry due (attempt {retry['attempt'] + 1} of {MAX_ATTEMPTS})"- flags = [name for name, on in (("autopublish", claim["autopublish"]),- ("skip-bundles", claim["skipBundles"]),- ("skip-tests", claim["skipTests"])) if on]log(f" {claim_tag} @ {commit[:10]}: {state.upper()} — {why}"- + (f" [{', '.join(flags)}]" if flags else ""))+ + (" [autopublish]" if claim["autopublish"] else "")+ + f" [{lane_set.describe(claim['lanes'])}]")records.append({"version": version,"attempt": attempt,"state": state,"autopublish": claim["autopublish"],- "skip_bundles": claim["skipBundles"],- "skip_tests": claim["skipTests"],+ "lanes": claim["lanes"],"claim_tag": claim_tag,"claim_object": claim_ref["object"],"claim_epoch": claim_epoch,@@ -358,15 +356,17 @@ def channel_head(desktop_head: str | None, records: list[dict],stable_alias_digest: str | None) -> str | None:"""The newest version whose publication pass finished.- A bundle release finishes when the protected R2 head names it. A release- that skipped bundles never moves that head. It finishes when the Docker- ``stable`` alias carries the digest its final receipt binds.+ A release that advances the desktop channel finishes when the protected R2+ head names it. One that does not finishes when the Docker ``stable`` alias+ carries the digest its final receipt binds, or, when it moves no channel at+ all, as soon as it is public."""versions = [desktop_head] if desktop_head is not None else []- if stable_alias_digest is not None:- versions += [record["version"] for record in records- if record["state"] == "published"- and record["docker_manifest_digest"] == stable_alias_digest]+ versions += [record["version"] for record in records+ if record["state"] == "published"+ and (not lane_set.moves_channels(record["lanes"])+ or (stable_alias_digest is not None+ and record["docker_manifest_digest"] == stable_alias_digest))]return max(versions, key=_key, default=None)@@ -438,7 +438,7 @@ def reconcile(env: dict, *, run=output, read_head=None, advance_head=None,if advance_head is None:def production_advance(record: dict) -> None:- if not record["skip_bundles"]:+ if lane_set.advances_desktop(record["lanes"]):log(f"Advancing the protected desktop channel to {record['version']} from "f"releases/tag/{record['claim_tag']}/ "f"(receipt manifest {record['candidate_manifest_sha256']})")@@ -446,16 +446,17 @@ def reconcile(env: dict, *, run=output, read_head=None, advance_head=None,channel_releases.advance_stable(env, record, Path(directory))log(f"Desktop channel head is now {record['version']}")else:- log(f"{record['version']} skipped bundles: no desktop channel to advance")- log(f"Tagging Docker {record['tag']}/stable/latest onto {record['claim_tag']} "- f"({record['docker_manifest_digest']})")- # The final vX.Y.Z and the stable/latest aliases move onto the attempt's image here, in- # the publication pass with the feed pointer, never in the green- # build that pushed the image under the attempt ref. A release- # that skipped bundles moves only these aliases.- docker.promote_stable(record["claim_tag"], record["docker_manifest_digest"], record["tag"])- log("Docker aliases moved")- if not record["skip_bundles"]:+ log(f"{record['version']} did not build every desktop package the channel serves "+ "(windows, macos-arm64): the desktop channel stays on the previous release")+ if "docker" in record["lanes"]:+ log(f"Tagging Docker {record['tag']}/stable/latest onto {record['claim_tag']} "+ f"({record['docker_manifest_digest']})")+ # The final vX.Y.Z and the stable/latest aliases move onto the attempt's image here, in+ # the publication pass with the feed pointer, never in the green+ # build that pushed the image under the attempt ref.+ docker.promote_stable(record["claim_tag"], record["docker_manifest_digest"], record["tag"])+ log("Docker aliases moved")+ if "windows" in record["lanes"]:log("Checking the Microsoft Store submission")# The Store check joins the pass here (after the feeds and aliases# move). It never releases the held submission: the API cannot,diff --git a/scripts/releases/stable.py b/scripts/releases/stable.pyindex 6d4b6d14b9b..52ff8175804 100644--- a/scripts/releases/stable.py+++ b/scripts/releases/stable.py@@ -13,18 +13,17 @@ import urllib.errorimport urllib.requestfrom datetime import datetime, timezone, UTCfrom pathlib import Path+from typing import Iterablefrom urllib.parse import unquote, urlsplitfrom hermes_cli.update_channel import STABLE_TAG_RE-from scripts.releases import optional_platforms+from scripts.releases import lanes as lane_setfrom scripts.releases.draft_warning import strip_draft_warning-from scripts.releases.optional_platforms import require_targets_match_claimfrom scripts.releases.versioning import tag_recordSHA = re.compile(r"[a-f0-9]{40}")DIGEST = re.compile(r"[a-f0-9]{64}")DESKTOP_TARGETS = ("windows/x64", "windows/arm64", "macos/x64", "macos/arm64")-OPTIONAL_TARGETS = optional_platforms.TARGETS # built only when the claim opts in-REQUIRED_DESKTOP_TARGETS = tuple(t for t in DESKTOP_TARGETS if t not in OPTIONAL_TARGETS)+ALL_TARGETS = tuple(lane_set.TARGET_LANE)SMOKE_JOBS = {"smoke-darwin-arm64": "macOS DMG + ZIP (arm64)","smoke-darwin-x64": "macOS DMG + ZIP (x64)",@@ -69,55 +68,24 @@ def require_success(needs: dict, required: list[str]) -> None:raise ValueError("Release blocked: " + ", ".join(failures))-# The claim flags that remove stable-release.yml jobs, per job. A job one of-# the claim's active removals removes must report `skipped`. Every other gated-# job must report `success`. Jobs not listed here never skip.-CLAIM_FLAGS = ("autopublish", "skipBundles", "skipTests")-# An opt-in platform left out of the claim removes its jobs too-# (optional_platforms names the reason and the jobs).-_TESTS, _BUNDLES = frozenset({"skipTests"}), frozenset({"skipBundles"})-SKIPPED_BY = {- **{job: _TESTS for job in ("ci", "nix", "termux-checks", "windows-live", "install-e2e",- "bootstrap-version")},- **{job: _BUNDLES for job in ("candidates-darwin-arm64", "candidates-darwin-x64",- "candidates-win32-arm64", "candidates-win32-x64",- "candidates-win32-bundle", "candidates-termux",- "candidate-manifest", "publish-bundles")},- # Bundle acceptance is a test of bundles, so either flag removes it.- **{job: _TESTS | _BUNDLES for job in ("pm-bundle", "transitions-darwin-arm64",- "transitions-darwin-x64", "transitions-win32",- "windows-packaged", "macos-packaged-arm64",- "macos-packaged-x64")},-}-for _platform in optional_platforms.PLATFORMS:- for _job in _platform.jobs:- SKIPPED_BY[_job] = SKIPPED_BY[_job] | {_platform.exclusion}--# Each signed-package upgrade arm and the transitions job that plans it.PACKAGED_BY = {"macos-packaged-arm64": "transitions-darwin-arm64","macos-packaged-x64": "transitions-darwin-x64","windows-packaged": "transitions-win32"}-def gate_expectations(required: list[str], *, skip_bundles: bool, skip_tests: bool,- **platforms: bool) -> dict:- """Each gated job's required result under the claim's flags (``platforms``:- the optional_platforms keys, each false when omitted)."""- active = {flag for flag, on in (("skipBundles", skip_bundles), ("skipTests", skip_tests)) if on}- if set(platforms) - {p.key for p in optional_platforms.PLATFORMS}:- raise TypeError(f"Unknown platform flags: {sorted(platforms)}")- active |= {p.exclusion for p in optional_platforms.excluded(platforms)}- return {name: "skipped" if SKIPPED_BY.get(name, frozenset()) & active else "success"- for name in required}+def gate_expectations(required: list[str], lanes: Iterable[str]) -> dict:+ """Each gated job's required result under the claim's lanes: `skipped` for a job a+ lane it needs is off for, `success` for every other."""+ runs = lane_set.jobs_to_run(lanes)+ return {name: "success" if runs.get(name, True) else "skipped" for name in required}-def require_gate(needs: dict, required: list[str], *, skip_bundles: bool, skip_tests: bool,- **platforms: bool) -> None:- """``require_success`` that also demands a flag-removed job really was skipped."""+def require_gate(needs: dict, required: list[str], *, lanes: Iterable[str]) -> None:+ """``require_success`` that also demands a lane-removed job really was skipped."""if not required or len(set(required)) != len(required):raise ValueError("Invalid required-job list")- expected = gate_expectations(required, skip_bundles=skip_bundles, skip_tests=skip_tests, **platforms)+ expected = gate_expectations(required, lanes)for packaged, planner in PACKAGED_BY.items():# Without a published baseline there is no OLD package, so the planner# skips the upgrade arm. Only that planner's own successful output can excuse it.@@ -134,8 +102,8 @@ def require_gate(needs: dict, required: list[str], *, skip_bundles: bool, skip_tdef accepted_smoke_results(needs: object, *, absent: tuple[str, ...] | frozenset = ()) -> dict:"""Persist only observed native groups, never infer them from artifacts.- Every group passed, or every group was skipped. Only a claim that skipped- tests may produce the second shape. ``smokes_skipped`` lets claim-aware+ Every group passed, or every group was skipped. Only a claim whose lanes run+ no smoke may produce the second shape. ``smokes_skipped`` lets claim-awarereaders check that. A group whose target the release did not build(``absent``) ran no smoke, so it must be recorded as skipped."""@@ -161,11 +129,19 @@ def smokes_skipped(manifest: dict) -> bool:return all((results.get(job) or {}).get("result") == "skipped" for job in SMOKE_JOBS)-def require_smokes_match_claim(manifest: dict, *, skip_tests: bool) -> None:- if smokes_skipped(manifest) != skip_tests:+def require_smokes_match_claim(manifest: dict, lanes: Iterable[str]) -> None:+ if smokes_skipped(manifest) == lane_set.runs_smokes(lanes):raise ValueError("Candidate smoke results differ from the claim's test policy")+def require_targets_match_claim(manifest: dict, lanes: Iterable[str]) -> None:+ """The manifest carries exactly the targets the claim's build lanes produce."""+ present = {f"{row.get('platform')}/{row.get('arch')}" for row in manifest.get("packages", [])}+ wanted = lane_set.targets(lanes)+ if present != wanted:+ raise ValueError(f"Candidate manifest targets {sorted(present)} differ from the claim's {sorted(wanted)}")++def stable_windows_version(epoch: object) -> str:if isinstance(epoch, bool) or not isinstance(epoch, int) or epoch < 0:raise ValueError("Stable release epoch must be a non-negative integer")@@ -212,7 +188,7 @@ def _validated_rows(manifest: dict, tag: str, commit: str, public_base: str,rows = {}for item in manifest["packages"]:target = f"{item.get('platform')}/{item.get('arch')}"- if target not in (*DESKTOP_TARGETS, *OPTIONAL_TARGETS) or target in rows or item.get("tag") != tag or item.get("commit") != commit:+ if target not in ALL_TARGETS or target in rows or item.get("tag") != tag or item.get("commit") != commit:raise ValueError(f"Invalid or duplicate candidate target: {target}")artifact = item.get("artifact", {})url = urlsplit(artifact.get("url", ""))@@ -251,10 +227,12 @@ def validate_candidates(manifest: dict, tag: str, commit: str, public_base: str,never is."""rows = _validated_rows(manifest, tag, commit, public_base, release_epoch, archive=archive)- if any(target not in rows for target in REQUIRED_DESKTOP_TARGETS):- raise ValueError("Candidate manifest must cover Windows on both architectures and macOS arm64")+ if not rows:+ raise ValueError("Candidate manifest has no packages")+ # Which targets a release must carry is its claim's business (require_targets_match_claim),+ # not the manifest's: a release may build any subset of the lanes.accepted_smoke_results(manifest.get("smoke_results"),- absent=frozenset(t for t in OPTIONAL_TARGETS if t not in rows))+ absent=frozenset(t for t in ALL_TARGETS if t not in rows))return rows@@ -303,7 +281,7 @@ def plan_transitions(previous: dict, candidate: dict, public_base: str) -> list[archive=previous.get("archive"))new = validate_candidates(candidate, candidate.get("tag"), candidate.get("commit"), public_base,archive=candidate.get("archive"))- # An opt-in target upgrades only between two releases that both built it.+ # A target upgrades only between two releases that both built it.return [_transition_row(target, old[target], new[target]) for target in DESKTOP_TARGETSif target in new and target in old]@@ -311,8 +289,8 @@ def plan_transitions(previous: dict, candidate: dict, public_base: str) -> list[def baseline_covers(previous: dict, receipt: str, public_base: str) -> bool:"""Whether the published baseline built every target of this receipt.- A release that left macOS Intel out has no OLD Intel package, so the next- release that opts back in has nothing to upgrade from on that arch.+ A release that left a target out has no OLD package for it, so the next+ release that builds it has nothing to upgrade from on that arch."""old = validate_candidates(previous, previous.get("tag"), previous.get("commit"), public_base,archive=previous.get("archive"))@@ -439,17 +417,21 @@ def output(argv: list[str]) -> str:def validate_claim(metadata: object, *, version: str, attempt: int, commit: str) -> dict:"""The claim message's exact shape. It is the one record of the attempt's policy.- Opt-in platform flags may be absent (older claims); the copy returned has them."""+ A claim cut before lanes existed (lanes.claim_lanes); the copy returned has its lanes."""expected = {"schema": 1, "version": version, "attempt": attempt, "commit": commit}- required = {*expected, *CLAIM_FLAGS, "claimEpoch"}if (not isinstance(metadata, dict)or any(metadata.get(key) != value for key, value in expected.items())- or any(not isinstance(metadata.get(flag), bool) for flag in CLAIM_FLAGS)+ or not isinstance(metadata.get("autopublish"), bool)or not isinstance(metadata.get("claimEpoch"), int)- or metadata["claimEpoch"] <= 0- or not required <= set(metadata) <= {*required, *optional_platforms.CLAIM_FLAGS}):+ or metadata["claimEpoch"] <= 0):+ raise ValueError("Stable claim metadata is invalid")+ base = {*expected, "autopublish", "claimEpoch"}+ legacy = {"skipBundles", "skipTests"}+ shapes = ({*base, "lanes"}, {*base, *legacy}, {*base, *legacy, "includeMacosIntel"},+ {*base, *legacy, "includeTermux"}, {*base, *legacy, "includeMacosIntel", "includeTermux"})+ if set(metadata) not in shapes:raise ValueError("Stable claim metadata is invalid")- return {**metadata, **optional_platforms.claim_flags(metadata)}+ return {**metadata, "lanes": lane_set.claim_lanes(metadata)}def _claim_metadata(raw: str, *, version: str, attempt: int, commit: str) -> dict:@@ -464,8 +446,9 @@ def validate_final(final: object, *, version: str, commit: str, claim_tag: str,claim_object: str, claim: dict) -> dict:"""The final receipt tag's exact shape, bound to its validated claim.- A claim that skipped bundles has no candidate manifest, so its receipt- records ``candidateManifestSha256: null``. Every other receipt pins one.+ A claim that builds no bundle has no candidate manifest, so its receipt+ records ``candidateManifestSha256: null``; one that builds no Docker image+ records ``dockerManifestDigest: null``. Every other receipt pins them."""if not isinstance(final, dict):raise ValueError("Final tag metadata differs from its claim")@@ -480,11 +463,13 @@ def validate_final(final: object, *, version: str, commit: str, claim_tag: str,"archive": f"releases/tag/{claim_tag}/",}manifest = final.get("candidateManifestSha256")- manifest_ok = manifest is None if claim["skipBundles"] else bool(DIGEST.fullmatch(manifest or ""))+ lanes = claim["lanes"]+ manifest_ok = bool(DIGEST.fullmatch(manifest or "")) if lane_set.has_bundles(lanes) else manifest is None+ docker = final["dockerManifestDigest"]+ docker_ok = bool(re.fullmatch(r"sha256:[a-f0-9]{64}", docker or "")) if "docker" in lanes else docker is Noneif (final != expectedor not isinstance(final["releaseId"], int) or final["releaseId"] <= 0- or not manifest_ok- or not re.fullmatch(r"sha256:[a-f0-9]{64}", final["dockerManifestDigest"] or "")):+ or not manifest_ok or not docker_ok):raise ValueError("Final tag metadata differs from its claim")return final@@ -573,9 +558,8 @@ def check_claim(env: dict, run=output) -> dict:if metadata["claimEpoch"] != claim_epoch:raise ValueError("Stable claim epoch differs from its annotated tagger timestamp")return {**admitted, "claim_object": local_object,- "autopublish": metadata["autopublish"], "skip_bundles": metadata["skipBundles"],- "skip_tests": metadata["skipTests"], "claim_epoch": claim_epoch,- **{p.key: metadata[p.claim_flag] for p in optional_platforms.PLATFORMS}}+ "autopublish": metadata["autopublish"], "lanes": metadata["lanes"],+ "claim_epoch": claim_epoch}def stable_context(env: dict, run=output) -> tuple[str, str, dict]:@@ -637,8 +621,7 @@ def final_context(env: dict, run=output) -> tuple[str, str, dict]:raise ValueError("Stable channel requires the published final release")return tag, commit, {**admitted, "claim_object": claim_object,"autopublish": claim["autopublish"],- "skip_bundles": claim["skipBundles"],- "skip_tests": claim["skipTests"],+ "lanes": claim["lanes"],"claim_epoch": claim["claimEpoch"],"release_id": final["releaseId"],"candidate_manifest_sha256": final["candidateManifestSha256"],@@ -689,19 +672,14 @@ def admit(env: dict) -> None:"claim-tag": admitted["claim_tag"], "claim-object": admitted["claim_object"],"tag": admitted["tag"], "commit": admitted["commit"], "version": admitted["version"],"release-id": release["databaseId"], "release-epoch": admitted["claim_epoch"],- "skip-bundles": "true" if admitted["skip_bundles"] else "false",- "skip-tests": "true" if admitted["skip_tests"] else "false",- **{p.key.replace("_", "-"): "true" if admitted[p.key] else "false"- for p in optional_platforms.PLATFORMS},+ # `lanes` is every lane's flag; `jobs` is every lane-controlled job's run flag. Each+ # job's `if` reads `jobs`, so the lane table is the only place that says what runs.+ "lanes": lane_set.flags(admitted["lanes"]), "jobs": lane_set.jobs_to_run(admitted["lanes"]),}, env)- skipped = [name for name, on in (("bundles", admitted["skip_bundles"]),- ("tests", admitted["skip_tests"])) if on]- opted = [p.label for p in optional_platforms.PLATFORMS if admitted[p.key]]summary(f"## Stable candidate {admitted['claim_tag']}\nCommit: {admitted['commit']}\n"f"Version: {admitted['version']}\nPayload tag: {admitted['tag']}\n"- f"Skipped: {', '.join(skipped) or 'nothing'}\n"- f"Opt-in packages: {', '.join(opted) or 'none (macOS Intel and Termux are not built)'}\n",+ f"Lanes {lane_set.describe(admitted['lanes'])}\n",env,)@@ -776,7 +754,7 @@ def transitions(env: dict) -> None:if previous is None or not baseline_covers(previous, receipt, base):# Native smokes still gate this release. Its packages become the# baseline that the next bundle release must upgrade from. A baseline- # that left this receipt's opt-in target out has no OLD package either.+ # that left this receipt's target out has no OLD package either.validate_receipt(receipt_manifest, receipt, receipt_manifest.get("tag"),receipt_manifest.get("commit"), base, archive=receipt_manifest.get("archive"))emit({**matrices, "baseline": "none"}, env)@@ -811,14 +789,15 @@ def candidate_manifest(env: dict) -> None:if not isinstance(needs, dict):raise ValueError("Candidate call results must be a needs object")tag, commit, claim = stable_context(env)- if claim["skip_bundles"]:- raise ValueError("A claim that skipped bundles has no candidate manifest")- handoffs = optional_platforms.claim_handoffs(CANDIDATE_HANDOFFS, claim)- # A call the claim did not opt into never ran, so it has no smoke to record.- skipped_calls = {p.call for p in optional_platforms.excluded(claim)}- calls = {call: job for call, job in CALL_SMOKE_JOBS.items() if call not in skipped_calls}+ lanes = claim["lanes"]+ if not lane_set.has_bundles(lanes):+ raise ValueError("A claim that builds no bundle has no candidate manifest")+ handoffs = lane_set.handoffs(lanes, CANDIDATE_HANDOFFS)+ # A call the claim did not build never ran, so it has no smoke to record.+ runs = lane_set.jobs_to_run(lanes)+ calls = {call: job for call, job in CALL_SMOKE_JOBS.items() if runs[call]}smoke = {job: {"result": "skipped"} for job in CALL_SMOKE_JOBS.values()}- if claim["skip_tests"]:+ if not lane_set.runs_smokes(lanes):# The calls built and staged their groups but ran no smoke. Record# that as skipped. Never let a green call stand in for a smoke.require_success(needs, list(calls))@@ -841,13 +820,16 @@ def candidate_manifest(env: dict) -> None:def _final_metadata(tag: str, commit: str, claim: dict, candidate_manifest_sha256: str | None,- docker_manifest_digest: str, release_id: int) -> dict:- if claim["skip_bundles"]:+ docker_manifest_digest: str | None, release_id: int) -> dict:+ if not lane_set.has_bundles(claim["lanes"]):if candidate_manifest_sha256 is not None:- raise ValueError("A claim that skipped bundles cannot bind a candidate manifest")+ raise ValueError("A claim that builds no bundle cannot bind a candidate manifest")elif not DIGEST.fullmatch(candidate_manifest_sha256 or ""):raise ValueError("Final tag candidate manifest digest is invalid")- if not re.fullmatch(r"sha256:[a-f0-9]{64}", docker_manifest_digest):+ if "docker" not in claim["lanes"]:+ if docker_manifest_digest is not None:+ raise ValueError("A claim that builds no Docker image cannot bind a Docker digest")+ elif not re.fullmatch(r"sha256:[a-f0-9]{64}", docker_manifest_digest or ""):raise ValueError("Final tag Docker manifest digest is invalid")if not isinstance(release_id, int) or release_id <= 0:raise ValueError("Final tag release database ID is invalid")@@ -877,7 +859,7 @@ def authenticated_push(ref: str, env: dict | None = None) -> list[str]:def ensure_final_tag(tag: str, commit: str, claim: dict, *, candidate_manifest_sha256: str | None,- docker_manifest_digest: str, release_id: int, run=output) -> str:+ docker_manifest_digest: str | None, release_id: int, run=output) -> str:"""Create or verify the immutable annotated final tag."""require_stable_identity(tag, commit)expected = _final_metadata(@@ -983,12 +965,14 @@ def publish_attempt(record: dict, *, repository: str, run=output, read_archive)from scripts.releases import dockerclaim = {"claim_tag": record["claim_tag"], "claim_object": record["claim_object"],- "autopublish": record["autopublish"], "skip_bundles": record["skip_bundles"],+ "autopublish": record["autopublish"], "lanes": record["lanes"],"claim_epoch": record["claim_epoch"]}- # A claim that skipped bundles staged no archive, so its receipt binds no manifest.- manifest_sha256 = None if record["skip_bundles"] else hashlib.sha256(- read_archive(f"releases/tag/{record['claim_tag']}/release-candidates.json")).hexdigest()- docker_digest = docker.published_digest(record["claim_tag"], run)+ # A claim that built no bundle staged no archive, so its receipt binds no manifest. One that+ # built no image pushed none, so it binds no digest.+ manifest_sha256 = hashlib.sha256(+ read_archive(f"releases/tag/{record['claim_tag']}/release-candidates.json")+ ).hexdigest() if lane_set.has_bundles(record["lanes"]) else None+ docker_digest = docker.published_digest(record["claim_tag"], run) if "docker" in record["lanes"] else Noneensure_final_tag(record["tag"], record["commit"], claim,candidate_manifest_sha256=manifest_sha256,docker_manifest_digest=docker_digest,@@ -1001,21 +985,13 @@ def publish_attempt(record: dict, *, repository: str, run=output, read_archive)def complete(env: dict) -> None:"""Validate the accepted candidate archive. The final tag moves to publish."""tag, commit, claim = stable_context(env)- if claim["skip_bundles"]:- raise ValueError("A claim that skipped bundles has no candidate archive to validate")+ if not lane_set.has_bundles(claim["lanes"]):+ raise ValueError("A claim that builds no bundle has no candidate archive to validate")base = env["CLOUDFLARE_R2_PUBLIC_URL"].rstrip("/")candidate = read_candidate(env)validate_candidates(candidate, tag, commit, base, claim["claim_epoch"], archive=claim["claim_tag"])- require_smokes_match_claim(candidate, skip_tests=claim["skip_tests"])- require_targets_match_claim(candidate, include_macos_intel=claim["include_macos_intel"],- include_termux=claim["include_termux"])---def _flag(env: dict, name: str) -> bool:- value = env.get(name)- if value not in ("true", "false"):- raise ValueError(f"{name} must be the admitted claim's true or false, not {value!r}")- return value == "true"+ require_smokes_match_claim(candidate, claim["lanes"])+ require_targets_match_claim(candidate, claim["lanes"])def main(argv: list[str] | None = None, env: dict | None = None) -> None:@@ -1024,9 +1000,7 @@ def main(argv: list[str] | None = None, env: dict | None = None) -> None:if argv and argv[0] == "gate":needs = json.loads(env["RELEASE_NEEDS"])summary("\n".join(f"- {name}: {needs.get(name, {}).get('result', 'missing')}" for name in argv[1:]), env)- require_gate(needs, argv[1:], skip_bundles=_flag(env, "SKIP_BUNDLES"),- skip_tests=_flag(env, "SKIP_TESTS"),- **{p.key: _flag(env, p.key.upper()) for p in optional_platforms.PLATFORMS})+ require_gate(needs, argv[1:], lanes=lane_set.from_flags(json.loads(env.get("LANES") or "null")))returnif argv and argv[0] == "stage-receipt":if len(argv) != 3 or argv[1] != "--receipt" or argv[2] not in RECEIPT_TARGETS:diff --git a/tests/ci/desktop_release_roles.py b/tests/ci/desktop_release_roles.pyindex 1f46240866e..248cb51acfb 100644--- a/tests/ci/desktop_release_roles.py+++ b/tests/ci/desktop_release_roles.py@@ -10,6 +10,7 @@ graph change cannot silently empty a test."""from __future__ import annotations+import astimport refrom pathlib import Path@@ -220,6 +221,8 @@ def evaluate(expression, inputs, needs, *, cancelled=False, failed=False, job_if'always': lambda: True, 'cancelled': lambda: cancelled,'success': lambda: not (cancelled or failed), 'failure': lambda: failed,'contains': lambda value, needle: needle in value,+ # Expression strings reach eval already rewritten (true -> True), so read them as literals.+ 'fromJSON': ast.literal_eval,})diff --git a/tests/ci/test_stable_release_graph.py b/tests/ci/test_stable_release_graph.pyindex 77be6fddc4f..d2171756994 100644--- a/tests/ci/test_stable_release_graph.py+++ b/tests/ci/test_stable_release_graph.py@@ -1,10 +1,14 @@"""The release workflow's dependency graph enforces publication ordering."""+import jsonimport osimport subprocessfrom pathlib import Path+import pytestfrom ruamel.yaml import YAML+from scripts.releases import lanes as lane_set+from tests.ci.desktop_release_roles import gateROOT = Path(__file__).resolve().parents[2]@@ -99,50 +103,84 @@ def test_release_reuses_whole_ci_and_docker_before_publication():assert gate(jobs[name]["if"], {}, failed), name-def test_claim_flags_remove_exactly_the_jobs_the_gate_expects_skipped():- """The gate's SKIPPED_BY table and the workflow's conditions describe the same graph."""- from scripts.releases.stable import SKIPPED_BY+LANE_SETS = {+ "default": lane_set.DEFAULT,+ "everything": frozenset(lane_set.NAMES),+ "windows and docker, untested": lane_set.select(only=["windows", "docker"]),+ "docker only": lane_set.select(only=["docker"]),+ "no mac": lane_set.select(without=["macos-arm64"]),+ "no tests": lane_set.select(without=lane_set.NAMES[5:]),+ "nothing": frozenset(),+ # Each lane alone and each lane missing, so no job's condition can borrow another lane's flag.+ **{f"only {name}": frozenset({name}) for name in lane_set.NAMES},+ **{f"everything but {name}": frozenset(lane_set.NAMES) - {name} for name in lane_set.NAMES},+}+[email protected]("lanes", LANE_SETS.values(), ids=LANE_SETS)+def test_every_lane_controlled_job_runs_exactly_when_the_lane_table_says(lanes):+ """The workflow's `if` conditions and the gate's expectations describe the same graph."""jobs = workflow("stable-release.yml")["jobs"]- # A skip flag removes a job when it is true; an opt-in flag when it is not.- outputs = {"skipTests": "needs.admit.outputs.skip-tests != 'true'",- "skipBundles": "needs.admit.outputs.skip-bundles != 'true'",- "excludeMacosIntel": "needs.admit.outputs.include-macos-intel == 'true'",- "excludeTermux": "needs.admit.outputs.include-termux == 'true'"}-- def needs_of(name):- needs = jobs[name].get("needs", [])- return [needs] if isinstance(needs, str) else needs-- def removed_by(name, flag):- condition = str(jobs[name].get("if", ""))- if outputs[flag] in condition:- return True- # Without a status function a job skips when any job it needs skipped.- return ("always()" not in condition and "!cancelled()" not in condition- and any(flag in SKIPPED_BY.get(need, ()) and removed_by(need, flag)- for need in needs_of(name)))-- for name, flags in SKIPPED_BY.items():- assert name in jobs- for flag in flags:- assert removed_by(name, flag), f"{name} does not skip under {flag}"- # The image publish-docker pushes and the candidates are built under- # skip-tests; they are told to run without their own tests.- for name in ("docker", "candidates-darwin-arm64", "candidates-darwin-x64", "candidates-win32-arm64",+ runs = lane_set.jobs_to_run(lanes)+ admit = {"result": "success", "outputs": {"lanes": json.dumps(lane_set.flags(lanes)),+ "jobs": json.dumps(runs)}}++ def result(name):+ if name == "admit":+ return admit+ # What the job does under these lanes is what the table says (a job outside it never skips).+ return {"result": "success" if runs.get(name, True) else "skipped",+ "outputs": {"baseline": "published"}}++ for name, wanted in runs.items():+ assert name in jobs, name+ needs = {need: result(need) for need in direct_needs(jobs, name)}+ assert gate(jobs[name].get("if", "true"), {}, needs) == wanted, (name, sorted(lanes))+ # A job that is not lane-controlled never skips with the lanes.+ for name in set(jobs) - set(runs) - {"admit", "acceptance", "publication", "complete",+ "candidate-manifest", "publish-bundles"}:+ assert "outputs.jobs" not in str(jobs[name].get("if", "")), name+++def test_lane_inputs_reach_the_workflows_they_configure():+ jobs = workflow("stable-release.yml")["jobs"]+ # Tests the image and the candidates run for themselves follow their own lane.+ assert jobs["docker"]["with"]["skip-tests"] == "${{ !fromJSON(needs.admit.outputs.lanes)['docker-tests'] }}"+ for name in ("candidates-darwin-arm64", "candidates-darwin-x64", "candidates-win32-arm64","candidates-win32-x64", "candidates-win32-bundle", "candidates-termux"):- assert jobs[name]["with"]["skip-tests"] == "${{ needs.admit.outputs.skip-tests == 'true' }}"- assert {"skip-bundles", "skip-tests", "include-macos-intel", "include-termux"} <= \- set(jobs["admit"]["outputs"])+ assert jobs[name]["with"]["skip-tests"] == "${{ !fromJSON(needs.admit.outputs.lanes).smoke }}", name+ # The Store submission follows the windows lane.+ assert jobs["publish-bundles"]["with"]["store"] == "${{ fromJSON(needs.admit.outputs.lanes).windows }}"+ desktop = workflow("desktop-bundled-release.yml")["jobs"]+ assert "inputs.store" in desktop["stable-store"]["if"]+ assert {"lanes", "jobs"} <= set(jobs["admit"]["outputs"])for name in ("acceptance", "publication", "complete"):- gate = next(step for step in jobs[name]["steps"]- if "scripts.releases.stable gate" in step.get("run", ""))- assert gate["env"]["SKIP_BUNDLES"] == "${{ needs.admit.outputs.skip-bundles }}"- assert gate["env"]["SKIP_TESTS"] == "${{ needs.admit.outputs.skip-tests }}"- assert gate["env"]["INCLUDE_MACOS_INTEL"] == "${{ needs.admit.outputs.include-macos-intel }}"- assert gate["env"]["INCLUDE_TERMUX"] == "${{ needs.admit.outputs.include-termux }}"- gated = gate["run"].split(" gate ", 1)[1].split()- assert set(gated) <= set(needs_of(name)), name+ gate_step = next(step for step in jobs[name]["steps"]+ if "scripts.releases.stable gate" in step.get("run", ""))+ assert gate_step["env"] == {"RELEASE_NEEDS": "${{ toJSON(needs) }}",+ "LANES": "${{ needs.admit.outputs.lanes }}"}+ gated = gate_step["run"].split(" gate ", 1)[1].split()+ assert set(gated) <= set(direct_needs(jobs, name)), name+++def test_admit_emits_the_same_lanes_and_jobs_the_gate_reads(tmp_path):+ from scripts.releases import stable++ output = tmp_path / "output"+ summary = tmp_path / "summary"+ admitted = {"claim_tag": "rc.1-v1.2.3", "claim_object": "a" * 40, "tag": "v1.2.3", "commit": "b" * 40,+ "version": "1.2.3", "attempt": 1, "claim_epoch": 1, "autopublish": False,+ "lanes": lane_set.select(only=["windows", "docker"])}+ env = {"GITHUB_OUTPUT": str(output), "GITHUB_STEP_SUMMARY": str(summary), "GITHUB_REPOSITORY": "o/r"}+ from unittest import mock+ with mock.patch.object(stable, "check_claim", return_value=admitted), \+ mock.patch.object(stable, "output", return_value=json.dumps(+ {"tagName": "rc.1-v1.2.3", "isDraft": True, "isPrerelease": False, "databaseId": 7})):+ stable.admit(env)+ emitted = dict(line.split("=", 1) for line in output.read_text(encoding="utf-8").splitlines())+ assert lane_set.from_flags(json.loads(emitted["lanes"])) == admitted["lanes"]+ assert json.loads(emitted["jobs"]) == lane_set.jobs_to_run(admitted["lanes"])+ assert "on: docker, windows" in summary.read_text(encoding="utf-8")def test_a_skipped_upgrade_arm_never_skips_a_gated_publish_job():@@ -173,7 +211,7 @@ def test_claim_custody_and_final_payload_identity_reach_every_privileged_phase()jobs = release["jobs"]# The claim is the one record of the attempt's policy; a dispatch cannot override it.inputs = set(release["on"]["workflow_dispatch"]["inputs"])- assert not {"autopublish", "skip-bundles", "skip-tests"}.intersection(inputs)+ assert not {"autopublish", "lanes", "skip-bundles", "skip-tests"}.intersection(inputs)assert {"claim-tag", "claim-object", "tag", "commit", "version", "release-id", "release-epoch"} <= \set(jobs["admit"]["outputs"])for name in ("publish-bundles", *("candidates-darwin-arm64", "candidates-darwin-x64",diff --git a/tests/scripts/test_release_channels.py b/tests/scripts/test_release_channels.pyindex a1969d67707..3f33dfba3d1 100644--- a/tests/scripts/test_release_channels.py+++ b/tests/scripts/test_release_channels.py@@ -13,6 +13,8 @@ import xml.sax.saxutilsimport pytest+from scripts.releases import lanes as lane_set+@contextmanagerdef object_server():@@ -527,7 +529,7 @@ def test_accepted_release_receipts_feed_the_protected_head_without_rebuilding(tmlambda policy, env, **_kwargs: (tag, commit))monkeypatch.setattr(channel_releases.stable, "final_context",lambda env: (tag, commit, {"claim_epoch": 1_787_965_323,- "skip_bundles": False, "skip_tests": False}))+ "lanes": lane_set.DEFAULT}))monkeypatch.setattr(channel_releases, "accepted_stable", lambda *args, **kwargs: accepted)promotion_attempts = [0]def promote_stable_feeds(*args):@@ -651,15 +653,15 @@ def test_accepted_stable_reads_the_release_archive_by_tag(monkeypatch):objects[key] = rawcandidate_env = {"CANDIDATE_MANIFEST_SHA256": hashlib.sha256(raw).hexdigest(), "CANDIDATE_MANIFEST_URL": pub.public_base + "/" + key}assert channel_releases.accepted_stable(pub, candidate_env, attempt, commit, release_epoch,- skip_tests=False) == candidate+ lanes=lane_set.DEFAULT) == candidate# Passed smokes cannot stand behind a claim that skipped tests, or the reverse.with pytest.raises(ValueError, match="test policy"):channel_releases.accepted_stable(pub, candidate_env, attempt, commit, release_epoch,- skip_tests=True)+ lanes=lane_set.select(without=["smoke"]))faults["stale_public"] = b"{}"with pytest.raises(ChannelError):channel_releases.accepted_stable(pub, candidate_env, attempt, commit, release_epoch,- skip_tests=False)+ lanes=lane_set.DEFAULT)def test_request_inputs_are_rejected_before_allocating():diff --git a/tests/scripts/test_release_entrypoint.py b/tests/scripts/test_release_entrypoint.pyindex 78a1188bef8..c01297313b3 100644--- a/tests/scripts/test_release_entrypoint.py+++ b/tests/scripts/test_release_entrypoint.py@@ -8,12 +8,17 @@ operator has to notice."""import jsonimport subprocess+import sysimport threading+from pathlib import Pathimport pytest+from scripts.releases import lanes as lane_setfrom scripts.releases.versioning import tag_record+ROOT = Path(__file__).resolve().parents[2]+def git(repo, *args):return subprocess.check_output(["git", *args], cwd=repo, text=True, encoding="utf-8").strip()@@ -94,7 +99,8 @@ def test_release_claims_the_first_attempt_creates_a_draft_and_dispatches(source)return "https://github.com/example/hermes-agent/releases/tag/untagged-0123abcd\n"return ""- result = _release(source, commit, execute=execute, autopublish=True, skip_bundles=True)+ result = _release(source, commit, execute=execute, autopublish=True,+ lanes=lane_set.select(only=["docker", "ci"], with_=["windows"]))assert result["version"] == "0.21.5"assert result["tag"] == "rc.1-v0.21.5"@@ -105,19 +111,16 @@ def test_release_claims_the_first_attempt_creates_a_draft_and_dispatches(source)assert git(source, "rev-parse", "rc.1-v0.21.5^{commit}") == commitclaim = tag_record(git(source, "tag", "-l", "rc.1-v0.21.5", "--format=%(contents)"))assert isinstance(claim.pop("claimEpoch"), int)- # The claim is the one record of the attempt's policy, flags included.+ # The claim is the one record of the attempt's policy: the sorted lane set.assert claim == {"attempt": 1,"autopublish": True,"commit": commit,"schema": 1,- "skipBundles": True,- "skipTests": False,- # macOS Intel and Termux are opt-in, and off unless asked for.- "includeMacosIntel": False,- "includeTermux": False,+ "lanes": ["ci", "docker", "windows"],"version": "0.21.5",}+ assert result["lanes"] == frozenset({"ci", "docker", "windows"})create = calls[0]assert create[:4] == ["gh", "release", "create", "rc.1-v0.21.5"]assert "--verify-tag" in create and "--draft" in create@@ -144,7 +147,7 @@ def test_release_output_names_the_ci_run_and_the_publish_step():from scripts.releases.entrypoint import next_stepsresult = {"version": "0.21.5", "tag": "rc.1-v0.21.5", "autopublish": False,- "skip_bundles": False, "skip_tests": False, "repository": "example/hermes-agent",+ "lanes": lane_set.DEFAULT, "repository": "example/hermes-agent","run_url": "https://github.com/example/hermes-agent/actions/runs/7","url": "https://github.com/example/hermes-agent/releases/tag/untagged-0123abcd"}text = next_steps(result)@@ -153,24 +156,29 @@ def test_release_output_names_the_ci_run_and_the_publish_step():assert "Draft release: " + result["url"] in text# The publish command sits on its own line so it can be copied whole.assert "\n python scripts/release.py publish --version 0.21.5 --remote origin" in text- assert "skipped" not in text+ # The default set names what it leaves out, and warns about no test lane.+ assert "Not built: macos-intel, termux." in text+ assert "Not tested" not in textautomatic = next_steps({**result, "autopublish": True})assert "Autopublish is on" in automaticassert "publish --version" not in automatic- skipped = next_steps({**result, "skip_bundles": True, "skip_tests": True})- assert "Bundles are skipped." in skipped- assert "Tests are skipped, since you passed --skip-tests" in skipped- assert "\033[" not in skipped- assert "\033[1mTests are skipped" in next_steps({**result, "skip_tests": True}, bold=True)+ # --only windows,docker: no tests, no macOS, and a partial desktop set never moves the channel.+ windows = next_steps({**result, "lanes": lane_set.select(only=["windows", "docker"])})+ assert "Not built: macos-arm64, macos-intel, termux." in windows+ assert "Not tested: ci, nix, docker-tests, pm-bundle, windows-live, install-e2e, bootstrap-version, smoke, upgrade" in windows+ assert "partial desktop release" in windows+ assert "\033[" not in windows+ assert "\033[1mNot tested" in next_steps({**result, "lanes": lane_set.select(without=["ci"])}, bold=True)+ assert "partial desktop release" not in textdef test_an_unlisted_run_points_at_the_workflow_page():from scripts.releases.entrypoint import next_stepstext = next_steps({"version": "0.21.5", "tag": "rc.1-v0.21.5", "autopublish": False,- "skip_bundles": False, "skip_tests": False,+ "lanes": lane_set.DEFAULT,"repository": "example/hermes-agent", "run_url": "","url": "https://github.com/example/hermes-agent/releases/tag/untagged-0123abcd"})assert "the run is not listed yet" in text@@ -1034,3 +1042,18 @@ def test_a_concurrent_cut_of_another_version_is_stopped_before_dispatch(with pytest.raises(entrypoint.ReleaseRefused, match="more than one outstanding attempt"):_release(left, commit, execute=lambda command: pytest.fail(f"must not run {command}"))assert {"rc.1-v0.21.5", "rc.1-v0.22.0"} <= set(git(left, "tag", "--list", "rc.*").splitlines())+++def test_release_refuses_an_unknown_lane_before_touching_git(tmp_path):+ ran = subprocess.run(+ [sys.executable, "scripts/release.py", "release", "--commit", "HEAD", "--with", "macos-intell"],+ cwd=ROOT, capture_output=True, text=True, encoding="utf-8", check=False)+ assert ran.returncode != 0+ assert "unknown lane macos-intell" in ran.stderr and "macos-intel" in ran.stderr+ both = subprocess.run(+ [sys.executable, "scripts/release.py", "release", "--commit", "HEAD", "--with", "ci", "--without", "ci"],+ cwd=ROOT, capture_output=True, text=True, encoding="utf-8", check=False)+ assert "--with and --without both name ci" in both.stderr+ helped = subprocess.run([sys.executable, "scripts/release.py", "release", "--help"], cwd=ROOT,+ capture_output=True, text=True, encoding="utf-8", check=False)+ assert "macos-intel (off)" in helped.stdout and "docker-tests" in helped.stdoutdiff --git a/tests/scripts/test_release_lanes.py b/tests/scripts/test_release_lanes.pynew file mode 100644index 00000000000..fe8e9597cca--- /dev/null+++ b/tests/scripts/test_release_lanes.py@@ -0,0 +1,88 @@+"""The stable release lanes: what a lane set builds, tests, and records in its claim."""+import pytest++from scripts.releases import lanes as lane_set+++def test_the_default_builds_everything_but_macos_intel_and_termux():+ assert lane_set.DEFAULT == set(lane_set.NAMES) - {"macos-intel", "termux"}+ assert lane_set.select() == lane_set.DEFAULT++[email protected]("kwargs,expected", [+ # The request that motivated lanes: only the Windows bundles and the image, no tests.+ ({"only": ["windows", "docker"]}, {"windows", "docker"}),+ ({"with_": ["macos-intel", "termux"]}, set(lane_set.NAMES)),+ ({"without": ["macos-arm64", "upgrade"]}, set(lane_set.DEFAULT) - {"macos-arm64", "upgrade"}),+ ({"only": ["windows"], "with_": ["smoke"], "without": ["windows"]}, {"smoke"}),+ ({"only": []}, set()),+])+def test_select_edits_the_default_or_replaces_it(kwargs, expected):+ assert lane_set.select(**kwargs) == expected+++def test_select_refuses_unknown_and_contradictory_lanes():+ with pytest.raises(ValueError, match="unknown lane intel"):+ lane_set.select(with_=["intel"])+ with pytest.raises(ValueError, match="both name ci"):+ lane_set.select(with_=["ci"], without=["ci"])+++def test_options_flatten_repeats_and_commas():+ assert lane_set.parse_list(["windows, docker", "ci"]) == ["windows", "docker", "ci"]+ assert lane_set.parse_list(None) is None+++def test_every_job_names_real_lanes():+ for job, needs in lane_set.JOB_LANES.items():+ assert needs <= {*lane_set.NAMES, "bundles"}, job+ for target, lane in lane_set.TARGET_LANE.items():+ assert lane in lane_set.NAMES, target+ for handoff, lane in lane_set.HANDOFF_LANE.items():+ assert lane in lane_set.NAMES, handoff+++def test_a_job_runs_only_when_every_lane_it_needs_is_on():+ windows_only = lane_set.jobs_to_run(["windows", "docker"])+ assert {job for job, runs in windows_only.items() if runs} == {+ "docker", "publish-docker", "candidates-win32-arm64", "candidates-win32-x64",+ "candidates-win32-bundle", "candidate-manifest", "publish-bundles"}+ # A test lane for something that is not built is inert.+ assert not lane_set.jobs_to_run(["upgrade", "macos-intel"])["transitions-darwin-arm64"]+ assert lane_set.jobs_to_run(["upgrade", "macos-intel"])["transitions-darwin-x64"]+ # termux-checks needs both the check and the package.+ assert not lane_set.jobs_to_run(["termux-checks"])["termux-checks"]+ assert lane_set.jobs_to_run(["termux-checks", "termux"])["termux-checks"]+ assert not any(lane_set.jobs_to_run([]).values())+++def test_flags_round_trip_and_refuse_anything_loose():+ flags = lane_set.flags(["windows", "docker"])+ assert flags["bundles"] is True and flags["macos-arm64"] is False+ assert lane_set.from_flags(flags) == {"windows", "docker"}+ assert lane_set.flags(["docker"])["bundles"] is False+ for bad in (None, {}, {**flags, "extra": True}, {**flags, "ci": "true"},+ {name: flags[name] for name in flags if name != "ci"}):+ with pytest.raises(ValueError, match="boolean for every lane"):+ lane_set.from_flags(bad)+++def test_targets_and_handoffs_follow_the_build_lanes():+ assert lane_set.targets(["windows", "termux"]) == {"windows/x64", "windows/arm64", "termux/aarch64"}+ assert lane_set.handoffs(["windows"], ("win32-x64", "darwin-arm64", "windows-universal", "termux")) == \+ ("win32-x64", "windows-universal")+++def test_smokes_run_only_for_a_built_desktop_package():+ assert lane_set.runs_smokes(lane_set.DEFAULT)+ assert not lane_set.runs_smokes(["smoke", "docker", "termux"])+ assert not lane_set.runs_smokes(["windows"])+++def test_the_desktop_channel_moves_only_for_the_full_desktop_set():+ assert lane_set.advances_desktop(lane_set.DEFAULT)+ assert not lane_set.advances_desktop(["windows", "docker"])+ assert not lane_set.advances_desktop(["macos-arm64"])+ # A release that moves no channel is finished once public.+ assert lane_set.moves_channels(["docker"]) and lane_set.moves_channels(["windows", "macos-arm64"])+ assert not lane_set.moves_channels(["windows"]) and not lane_set.moves_channels([])diff --git a/tests/scripts/test_release_sequencer.py b/tests/scripts/test_release_sequencer.pyindex 89b0cd28f7b..da845126fc9 100644--- a/tests/scripts/test_release_sequencer.py+++ b/tests/scripts/test_release_sequencer.py@@ -394,7 +394,7 @@ def test_two_outstanding_attempts_are_refused_across_versions():def _sequencer_fixture(*versions, manifest_digest, docker_digest="sha256:" + "b" * 64,- drafts_on_claim_tag=False, skip_bundles=False, final_tags=True):+ drafts_on_claim_tag=False, skip_bundles=False, final_tags=True, lanes=None):"""Two green claims with their final tags; releases start as drafts.final_tags=False is a fresh green claim: no receipt tag yet, the draft on@@ -412,6 +412,8 @@ def _sequencer_fixture(*versions, manifest_digest, docker_digest="sha256:" + "b""autopublish": False, "skipBundles": skip_bundles, "skipTests": False,"claimEpoch": 1_790_000_000 + index,}+ if lanes is not None:+ claim = {**{k: v for k, v in claim.items() if not k.startswith("skip")}, "lanes": sorted(lanes)}final = {"schema": 1, "version": version, "commit": commit,"autopublish": False, "claimEpoch": claim["claimEpoch"],@@ -679,6 +681,46 @@ def test_a_release_that_skipped_bundles_ships_only_its_tag_release_and_docker_alassert events == [("aliases", "rc.1-v0.21.5", "v0.21.5")][email protected]("lanes,docker,store_checked", [+ # --only windows,docker: a partial desktop set. Only the aliases move; the channel stays.+ (["windows", "docker"], True, True),+ # --only windows: no channel moves at all, so the release is finished once public.+ (["windows"], False, True),+ # --only macos-arm64,docker: no Store, no channel.+ (["macos-arm64", "docker"], True, False),+])+def test_a_partial_desktop_release_moves_only_what_it_built(monkeypatch, lanes, docker, store_checked):+ from scripts.releases import channel_releases, docker as docker_module, sequencer, store++ docker_digest = "sha256:" + "b" * 64 if docker else None+ manifest = hashlib.sha256(b"m").hexdigest()+ _tags, releases, run = _sequencer_fixture(+ "0.21.5", manifest_digest=manifest, docker_digest=docker_digest, lanes=lanes)+ alias = [None]+ events = []++ def promote(claim_tag, digest, release_tag):+ events.append(("aliases", claim_tag, release_tag))+ alias[0] = digest++ monkeypatch.setattr(channel_releases, "advance_stable",+ lambda *_args: pytest.fail("a partial desktop set moved the protected head"))+ monkeypatch.setattr(store, "check_from_env", lambda _env: events.append(("store",)))+ monkeypatch.setattr(channel_releases, "stable_head_version", lambda _env: "0.21.4")+ monkeypatch.setattr(docker_module, "promote_stable", promote)+ monkeypatch.setattr(docker_module, "stable_alias_digest", lambda: alias[0])+ env = {"GITHUB_REPOSITORY": "example/project", "REQUESTED_VERSION": "0.21.5"}++ steps = sequencer.reconcile(env, run=run, read_archive=lambda _key: b"m")++ assert steps == [{"flip": "0.21.5"}, {"advance": "0.21.5"}]+ assert events == ([("aliases", "rc.1-v0.21.5", "v0.21.5")] if docker else []) + \+ ([("store",)] if store_checked else [])+ assert releases[0]["tag_name"] == "v0.21.5" and releases[0]["draft"] is False+ # Finished: the alias carries the receipt's digest, or the release moves no channel at all.+ assert sequencer.reconcile(env, run=run, read_archive=lambda _key: b"m") == []++def test_the_sequencer_narrates_every_phase_on_stderr_and_keeps_stdout_json(capsys):"""Discovery, each claim's state and why, the plan, every step and every command."""from scripts.releases.sequencer import reconcilediff --git a/tests/scripts/test_stable_admission.py b/tests/scripts/test_stable_admission.pyindex 10f9a90fa4c..25450800346 100644--- a/tests/scripts/test_stable_admission.py+++ b/tests/scripts/test_stable_admission.py@@ -75,6 +75,6 @@ def test_a_signed_claim_tag_is_read_through_the_jobs_own_git_read(tmp_path, monkassert "-----BEGIN SSH SIGNATURE-----" in rawwith pytest.raises(json.JSONDecodeError): # the shape that failed admissionjson.loads(raw)- # The record predates the opt-in platform keys, which read as false.+ # The record predates lanes: skipTests=true reads as the build lanes alone.assert _claim_metadata(raw, version="0.21.5", attempt=19, commit="3" * 40) == {- **record, "includeMacosIntel": False, "includeTermux": False}+ **record, "lanes": frozenset({"docker", "windows", "macos-arm64"})}diff --git a/tests/scripts/test_stable_release.py b/tests/scripts/test_stable_release.pyindex a0dcfa9f113..0233fa7aa3a 100644--- a/tests/scripts/test_stable_release.py+++ b/tests/scripts/test_stable_release.py@@ -15,8 +15,9 @@ from tests.scripts.test_release_r2 import r2_server as r2_server # noqa: PLC041from scripts.releases.draft_warning import (WARNING_CLOSE, WARNING_OPEN, strip_draft_warning,)+from scripts.releases import lanes as lane_setfrom scripts.releases.stable import (- check_claim, ensure_final_tag, plan_receipt_transitions, plan_transitions, read_manifest,+ check_claim, ensure_final_tag, gate_expectations, plan_receipt_transitions, plan_transitions, read_manifest,require_stable_identity, require_success, validate_candidates, validate_receipt,)from scripts.releases.versioning import tag_record@@ -69,8 +70,7 @@ def test_gate_requires_every_success_including_real_cli(tmp_path):require_success(needs, required)summary = tmp_path / "summary.md"env = {**os.environ, "RELEASE_NEEDS": json.dumps(success), "GITHUB_STEP_SUMMARY": str(summary), "PYTHONPATH": str(ROOT),- "SKIP_BUNDLES": "false", "SKIP_TESTS": "false",- "INCLUDE_MACOS_INTEL": "false", "INCLUDE_TERMUX": "false"}+ "LANES": json.dumps(lane_set.flags(lane_set.DEFAULT))}argv = [sys.executable, "-m", "scripts.releases.stable", "gate", *required]assert subprocess.run(argv, cwd=tmp_path, env=env, capture_output=True, check=False).returncode == 0empty = subprocess.run(argv[:4], cwd=tmp_path, env=env, capture_output=True, text=True, encoding="utf-8", check=False)@@ -82,35 +82,35 @@ def test_gate_requires_every_success_including_real_cli(tmp_path):assert "publication=cancelled" in result.stderr[email protected]("skip_bundles,skip_tests", [(True, False), (False, True), (True, True)])-def test_gate_requires_every_flag_removed_job_to_have_skipped(tmp_path, skip_bundles, skip_tests):- from scripts.releases.stable import SKIPPED_BY, gate_expectations-- required = ["admit", "docker", "publish-docker", *SKIPPED_BY]- expected = gate_expectations(required, skip_bundles=skip_bundles, skip_tests=skip_tests,- include_macos_intel=True, include_termux=True)- # The flags remove jobs; they never remove admission or the Docker image.- assert expected["admit"] == expected["docker"] == expected["publish-docker"] == "success"- assert expected["transitions-win32"] == expected["pm-bundle"] == "skipped"[email protected]("lanes", [+ lane_set.select(without=lane_set.BUNDLES),+ lane_set.select(without=lane_set.NAMES[5:]),+ lane_set.select(only=["windows", "docker"]),+ lane_set.select(only=[]),+])+def test_gate_requires_every_lane_removed_job_to_have_skipped(tmp_path, lanes):+ required = ["admit", *lane_set.JOB_LANES]+ expected = gate_expectations(required, lanes)+ # Lanes never remove admission.+ assert expected["admit"] == "success"+ assert {name for name, result in expected.items() if result == "success"} - {"admit"} == \+ {job for job, runs in lane_set.jobs_to_run(lanes).items() if runs}needs = {name: {"result": result} for name, result in expected.items()}env = {**os.environ, "RELEASE_NEEDS": json.dumps(needs), "PYTHONPATH": str(ROOT),- "GITHUB_STEP_SUMMARY": str(tmp_path / "summary.md"),- "SKIP_BUNDLES": "true" if skip_bundles else "false",- "SKIP_TESTS": "true" if skip_tests else "false",- "INCLUDE_MACOS_INTEL": "true", "INCLUDE_TERMUX": "true"}+ "GITHUB_STEP_SUMMARY": str(tmp_path / "summary.md"), "LANES": json.dumps(lane_set.flags(lanes))}argv = [sys.executable, "-m", "scripts.releases.stable", "gate", *required]assert subprocess.run(argv, cwd=tmp_path, env=env, capture_output=True, check=False).returncode == 0- # A removed job that ran anyway blocks the release, and so does an unflagged gate.+ # A removed job that ran anyway blocks the release, and so does a different lane set.removed = next(name for name, result in expected.items() if result == "skipped")env["RELEASE_NEEDS"] = json.dumps({**needs, removed: {"result": "success"}})ran = subprocess.run(argv, cwd=tmp_path, env=env, capture_output=True, text=True, encoding="utf-8", check=False)assert ran.returncode != 0 and f"{removed}=success (expected skipped)" in ran.stderrenv["RELEASE_NEEDS"] = json.dumps(needs)- env["SKIP_BUNDLES"] = env["SKIP_TESTS"] = "false"+ env["LANES"] = json.dumps(lane_set.flags(lane_set.NAMES))assert subprocess.run(argv, cwd=tmp_path, env=env, capture_output=True, check=False).returncode != 0- del env["SKIP_TESTS"]+ del env["LANES"]missing = subprocess.run(argv, cwd=tmp_path, env=env, capture_output=True, text=True, encoding="utf-8", check=False)- assert missing.returncode != 0 and "SKIP_TESTS must be" in missing.stderr+ assert missing.returncode != 0 and "lanes must be" in missing.stderrdef test_validate_candidates_keys_the_archive_by_the_attempt_ref():@@ -218,13 +218,23 @@ def test_an_unknown_receipt_is_refused():manifest["releaseEpoch"], archive="rc.2-v1.2.4")-def test_validate_candidates_still_refuses_a_missing_target():+def test_a_manifest_must_carry_exactly_the_targets_its_claims_lanes_build():commit = "b" * 40manifest = candidates("v1.2.4", commit, "2" * 64, archive="rc.2-v1.2.4")- with pytest.raises(ValueError, match="both architectures"):- validate_candidates(_receipt_rows(manifest, {"macos/arm64", "windows/arm64"}),- manifest["tag"], commit, BASE, manifest["releaseEpoch"],- archive="rc.2-v1.2.4")+ # A release may build any subset of the lanes, so a partial manifest is a valid manifest.+ windows_only = _receipt_rows(manifest, {"windows/x64", "windows/arm64"})+ windows_only["smoke_results"] = {**manifest["smoke_results"], "smoke-darwin-arm64": {"result": "skipped"},+ "smoke-darwin-x64": {"result": "skipped"}}+ assert validate_candidates(windows_only, manifest["tag"], commit, BASE, manifest["releaseEpoch"],+ archive="rc.2-v1.2.4").keys() == {"windows/x64", "windows/arm64"}+ from scripts.releases.stable import require_targets_match_claim+ require_targets_match_claim(windows_only, ["windows"])+ for wrong in (lane_set.DEFAULT, ["windows", "macos-arm64"], []):+ with pytest.raises(ValueError, match="differ from the claim"):+ require_targets_match_claim(windows_only, wrong)+ with pytest.raises(ValueError, match="no packages"):+ validate_candidates(_receipt_rows(manifest, set()), manifest["tag"], commit, BASE,+ manifest["releaseEpoch"], archive="rc.2-v1.2.4")def test_plan_receipt_transitions_yields_only_the_receipts_rows():@@ -253,10 +263,12 @@ def test_transitions_bind_all_arches_identity_version_and_archive():assert all(row["transition"]["new"]["commit"] == new["commit"] for row in transitions)assert all(row["transition"]["new"]["artifact"]["url"].startswith(f"{BASE}/releases/tag/{new['archive']}/")for row in transitions)+ # A target the new release did not build has nothing to upgrade to.missing = copy.deepcopy(new)missing["packages"].pop()- with pytest.raises(ValueError, match="both architectures"):- plan_transitions(old, missing, BASE)+ missing["smoke_results"]["smoke-darwin-arm64"] = {"result": "skipped"}+ assert {row["target"] for row in plan_transitions(old, missing, BASE)} == \+ {"windows-x64", "windows-arm64", "macos-x64"}with pytest.raises(ValueError, match="identity"):validate_candidates(new, new["tag"], old["commit"], BASE, archive=new["archive"])for key, value in [("commit", old["commit"]), ("identity", "different"), ("publisher", "CN=Other"), ("version", "9.9.9.0")]:@@ -428,9 +440,8 @@ def test_claim_object_movement_and_lightweight_tags_fail_closed(tmp_path, monkeyassert check_claim(env, git) == {"claim_tag": "rc.1-v1.2.3", "claim_object": claim_object,"tag": "v1.2.3", "version": "1.2.3", "attempt": 1, "commit": commit,- "autopublish": False, "skip_bundles": False, "skip_tests": False,- # A claim without the opt-in platform keys reads them as false.- "include_macos_intel": False, "include_termux": False,+ # A claim cut before lanes existed reads as the lane set that gated the same jobs.+ "autopublish": False, "lanes": lane_set.DEFAULT,"claim_epoch": 1_790_000_000,}# The metadata binds the attempt its ref names.@@ -458,7 +469,7 @@ def test_claim_object_movement_and_lightweight_tags_fail_closed(tmp_path, monkeysubprocess.run(["git", "remote", "add", "origin", str(remote)], check=True)metadata = json.dumps({"schema": 1, "version": "1.2.3", "attempt": 1, "commit": actual,- "autopublish": False, "skipBundles": False, "skipTests": False,+ "autopublish": False, "lanes": sorted(lane_set.DEFAULT),"claimEpoch": 1_790_000_000,}, sort_keys=True, separators=(",", ":"))subprocess.run(@@ -487,8 +498,8 @@ def test_claim_object_movement_and_lightweight_tags_fail_closed(tmp_path, monkeycheck_claim(env)-def test_a_claim_cut_before_the_opt_in_platform_flags_still_parses():- """rc.1..rc.11 of v0.21.6/v0.21.7 carry no includeMacosIntel/includeTermux keys."""+def test_a_claim_cut_before_lanes_existed_reads_as_the_lane_set_that_gated_the_same_jobs():+ """rc.1..rc.11 of v0.21.6/v0.21.7 carry skipBundles/skipTests and no include keys."""from scripts.releases.stable import _claim_metadata, validate_claimcommit = "a" * 40@@ -497,35 +508,45 @@ def test_a_claim_cut_before_the_opt_in_platform_flags_still_parses():"claimEpoch": 1_790_000_000}raw = json.dumps(old, sort_keys=True, separators=(",", ":"))parsed = _claim_metadata(raw, version="0.21.7", attempt=11, commit=commit)- assert parsed == {**old, "includeMacosIntel": False, "includeTermux": False}+ assert parsed == {**old, "lanes": lane_set.DEFAULT}assert old == json.loads(raw) # the caller's record is not mutated- new = {**old, "includeMacosIntel": True, "includeTermux": False}- assert validate_claim(new, version="0.21.7", attempt=11, commit=commit) == new- # The keys stay optional, never loose: a non-boolean or an unknown key is refused.- for wrong in ({**old, "includeTermux": "yes"}, {**old, "includeLinux": True}):+ both = {**old, "includeMacosIntel": True, "includeTermux": True}+ assert validate_claim(both, version="0.21.7", attempt=11, commit=commit)["lanes"] == frozenset(lane_set.NAMES)+ untested = {**old, "skipTests": True}+ assert validate_claim(untested, version="0.21.7", attempt=11, commit=commit)["lanes"] == frozenset(+ {"docker", "windows", "macos-arm64"})+ # skipBundles built the image and nothing else a bundle touches, tests included.+ bundleless = {**old, "skipBundles": True}+ assert validate_claim(bundleless, version="0.21.7", attempt=11, commit=commit)["lanes"] == frozenset(+ {"docker", "ci", "nix", "docker-tests", "windows-live", "install-e2e", "bootstrap-version", "termux-checks"})+ # The keys stay exact, never loose: a non-boolean, an unknown key or a mix of shapes is refused.+ new = {k: v for k, v in old.items() if not k.startswith("skip")}+ assert validate_claim({**new, "lanes": ["docker", "windows"]}, version="0.21.7", attempt=11,+ commit=commit)["lanes"] == frozenset({"docker", "windows"})+ for wrong in ({**old, "includeTermux": "yes"}, {**old, "includeLinux": True},+ {**new, "lanes": ["windows", "docker"]}, {**new, "lanes": ["linux"]},+ {**new, "lanes": "windows"}, {**old, "lanes": ["docker"]}):with pytest.raises(ValueError, match="metadata is invalid"):validate_claim(wrong, version="0.21.7", attempt=11, commit=commit)-def test_a_default_claim_builds_no_macos_intel_or_termux_and_the_flags_restore_them(+def test_a_default_claim_builds_no_macos_intel_or_termux_and_lanes_restore_them(tmp_path, r2_server, https_origin, monkeypatch):from scripts.releases import stable- opt_in = {"candidates-darwin-x64", "transitions-darwin-x64", "macos-packaged-x64",- "candidates-termux", "termux-checks"}- required = ["admit", "docker", *stable.SKIPPED_BY]- default = stable.gate_expectations(required, skip_bundles=False, skip_tests=False)- assert {name for name, result in default.items() if result == "skipped"} == opt_in- both = stable.gate_expectations(required, skip_bundles=False, skip_tests=False,- include_macos_intel=True, include_termux=True)- assert set(both.values()) == {"success"}- intel = stable.gate_expectations(required, skip_bundles=False, skip_tests=False,- include_macos_intel=True)+ off = {"candidates-darwin-x64", "transitions-darwin-x64", "macos-packaged-x64",+ "candidates-termux", "termux-checks"}+ required = ["admit", *lane_set.JOB_LANES]+ default = stable.gate_expectations(required, lane_set.DEFAULT)+ assert {name for name, result in default.items() if result == "skipped"} == off+ assert set(stable.gate_expectations(required, lane_set.NAMES).values()) == {"success"}+ intel = stable.gate_expectations(required, lane_set.select(with_=["macos-intel"]))assert {name for name, result in intel.items() if result == "skipped"} == \{"candidates-termux", "termux-checks"}- # The skip flags still remove an opted-in platform's jobs.- assert stable.gate_expectations(["candidates-termux"], skip_bundles=True, skip_tests=False,- include_termux=True) == {"candidates-termux": "skipped"}+ # A lane that is off removes its jobs even when its test lane is on.+ assert stable.gate_expectations(["candidates-termux", "termux-checks"],+ lane_set.select(without=["termux"])) == \+ {"candidates-termux": "skipped", "termux-checks": "skipped"}# Only the default groups stage handoffs; the manifest is complete without# the x64 Mac and Termux rows and records the unbuilt smoke as skipped.@@ -536,8 +557,7 @@ def test_a_default_claim_builds_no_macos_intel_or_termux_and_the_flags_restore_t_stage_windows_handoff(built, "x64")_stage_windows_handoff(built, "arm64")_stage_universal_bundle(built)- monkeypatch.setattr(stable, "stable_context", _fake_stable_context(- include_macos_intel=False, include_termux=False))+ monkeypatch.setattr(stable, "stable_context", _fake_stable_context(lanes=lane_set.DEFAULT))calls = {call: {"result": "success"} for call in stable.CALL_SMOKE_JOBSif call != "candidates-darwin-x64"}calls["candidates-darwin-x64"] = {"result": "skipped"}@@ -550,25 +570,49 @@ def test_a_default_claim_builds_no_macos_intel_or_termux_and_the_flags_restore_tassert manifest["smoke_results"]["smoke-darwin-x64"] == {"result": "skipped"}stable.validate_candidates(manifest, "v1.2.3", RECEIPT_COMMIT, https_origin.base,RELEASE_EPOCH, archive=ATTEMPT)- stable.require_targets_match_claim(manifest, include_macos_intel=False, include_termux=False)- with pytest.raises(ValueError, match="lacks macos/x64"):- stable.require_targets_match_claim(manifest, include_macos_intel=True, include_termux=False)+ stable.require_targets_match_claim(manifest, lane_set.DEFAULT)+ with pytest.raises(ValueError, match="differ from the claim"):+ stable.require_targets_match_claim(manifest, lane_set.select(with_=["macos-intel"]))# A smoke that claims to have passed for a target nobody built is refused.forged = {**manifest, "smoke_results": {**manifest["smoke_results"],"smoke-darwin-x64": {"result": "success"}}}with pytest.raises(ValueError, match="did not build"):stable.validate_candidates(forged, "v1.2.3", RECEIPT_COMMIT, https_origin.base,RELEASE_EPOCH, archive=ATTEMPT)- # A claim that opted in needs the opt-in handoffs: a missing one leaves no manifest.+ # A claim that built Termux needs its handoff: a missing one leaves no manifest.del r2_server.store[f"releases/tag/{ATTEMPT}/release-candidates.json"]- monkeypatch.setattr(stable, "stable_context", _fake_stable_context(include_termux=True,- include_macos_intel=False))+ monkeypatch.setattr(stable, "stable_context",+ _fake_stable_context(lanes=lane_set.select(with_=["termux"])))with pytest.raises(Exception, match="handoff-termux"):stable.main(["candidate-manifest"], env)assert f"releases/tag/{ATTEMPT}/release-candidates.json" not in r2_server.store-def _claim_fixture(tmp_path, *, tag, version, skip_bundles=False, skip_tests=False):+def test_a_windows_only_claim_assembles_a_windows_only_manifest(+ tmp_path, r2_server, https_origin, monkeypatch):+ """--only windows,docker: no macOS handoff exists, so none is read and no macOS row appears."""+ from scripts.releases import stable++ https_origin.store = r2_server.store+ built = tmp_path / "built"+ built.mkdir()+ _stage_windows_handoff(built, "x64")+ _stage_windows_handoff(built, "arm64")+ _stage_universal_bundle(built)+ lanes = lane_set.select(only=["windows", "docker"])+ monkeypatch.setattr(stable, "stable_context", _fake_stable_context(lanes=lanes))+ calls = {"candidates-win32-x64": {"result": "success"}, "candidates-win32-arm64": {"result": "success"}}+ env = {**_receipt_env(tmp_path, https_origin.base), "RELEASE_NEEDS": json.dumps(calls)}+ stable.main(["candidate-manifest"], env)+ manifest = json.loads(r2_server.store[f"releases/tag/{ATTEMPT}/release-candidates.json"][0])+ assert {f"{row['platform']}/{row['arch']}" for row in manifest["packages"]} == {"windows/x64", "windows/arm64"}+ # Nothing smoked: the claim has no smoke lane, so every smoke is recorded skipped.+ assert manifest["smoke_results"] == {job: {"result": "skipped"} for job in stable.SMOKE_JOBS}+ stable.require_smokes_match_claim(manifest, lanes)+ stable.require_targets_match_claim(manifest, lanes)+++def _claim_fixture(tmp_path, *, tag, version, lanes=lane_set.DEFAULT):"""A real checkout + bare remote carrying one annotated attempt claim."""from scripts.releases.versioning import parse_attempt_ref@@ -586,7 +630,7 @@ def _claim_fixture(tmp_path, *, tag, version, skip_bundles=False, skip_tests=Falattempt = parse_attempt_ref(tag)[1]metadata = json.dumps({"schema": 1, "version": version, "attempt": attempt, "commit": commit,- "autopublish": False, "skipBundles": skip_bundles, "skipTests": skip_tests,+ "autopublish": False, "lanes": sorted(lanes),"claimEpoch": epoch,}, sort_keys=True, separators=(",", ":"))subprocess.run(@@ -654,11 +698,10 @@ def test_strip_refuses_an_unbalanced_fence(body):strip_draft_warning(body)-def _publish_record(commit, tag_object, *, epoch, release_id=42, skip_bundles=False):+def _publish_record(commit, tag_object, *, epoch, release_id=42, lanes=lane_set.DEFAULT):return {"claim_tag": "rc.2-v1.2.3", "claim_object": tag_object, "tag": "v1.2.3","commit": commit, "version": "1.2.3", "attempt": 2, "release_id": release_id,- "autopublish": False, "skip_bundles": skip_bundles, "skip_tests": False,- "claim_epoch": epoch}+ "autopublish": False, "lanes": frozenset(lanes), "claim_epoch": epoch}def test_publish_attempt_writes_the_receipt_retargets_and_copies_no_bytes(tmp_path, monkeypatch):@@ -743,6 +786,55 @@ def test_publish_attempt_writes_the_receipt_retargets_and_copies_no_bytes(tmp_paassert release["body"] == "## What's changed\n- x"[email protected]("lanes,binds_manifest,binds_docker", [+ (["windows"], True, False), (["docker"], False, True), ([], False, False)])+def test_the_final_receipt_binds_only_what_the_claims_lanes_built(+ tmp_path, monkeypatch, lanes, binds_manifest, binds_docker):+ from scripts.releases import stable++ commit, tag_object = _claim_fixture(tmp_path, tag="rc.2-v1.2.3", version="1.2.3", lanes=lanes)+ monkeypatch.chdir(tmp_path / "repo")+ epoch = tag_record(subprocess.check_output(+ ["git", "tag", "-l", "rc.2-v1.2.3", "--format=%(contents)"],+ text=True, encoding="utf-8"))["claimEpoch"]+ release = {"id": 42, "tag_name": "rc.2-v1.2.3", "draft": True, "prerelease": False,+ "body": "notes", "published_at": None}+ archive_reads = []++ def run(argv):+ if argv[0] == "git":+ return subprocess.check_output(argv, text=True, encoding="utf-8").strip()+ if argv[:3] == ["docker", "buildx", "imagetools"]:+ assert binds_docker, "a claim without the docker lane reads no image"+ return json.dumps("sha256:" + "d" * 64)+ if argv[:3] == ["gh", "api", "--method"]:+ fields = dict(value.partition("=")[::2] for value in argv[6::2])+ release.update({key: (raw == "true") if key in {"draft", "prerelease"} else raw+ for key, raw in fields.items() if key in {"tag_name", "draft", "prerelease", "body"}})+ if release["draft"] is False:+ release["published_at"] = "2026-09-22T00:00:00Z"+ return "{}"+ if argv[:2] == ["gh", "api"]:+ return json.dumps(release)+ raise AssertionError(argv)++ digests = stable.publish_attempt(+ _publish_record(commit, tag_object, epoch=epoch, lanes=lanes), repository="example/project",+ run=run, read_archive=lambda key: archive_reads.append(key) or b"{}")+ assert (digests["candidate_manifest_sha256"] is not None) == binds_manifest == bool(archive_reads)+ assert (digests["docker_manifest_digest"] is not None) == binds_docker+ final = tag_record(subprocess.check_output(["git", "tag", "-l", "v1.2.3", "--format=%(contents)"],+ text=True, encoding="utf-8"))+ claim = {"autopublish": False, "claimEpoch": epoch, "lanes": frozenset(lanes)}+ stable.validate_final(final, version="1.2.3", commit=commit, claim_tag="rc.2-v1.2.3",+ claim_object=tag_object, claim=claim)+ # The receipt of a different lane set is refused: a Docker digest the claim never built.+ with pytest.raises(ValueError, match="differs from its claim"):+ stable.validate_final(final, version="1.2.3", commit=commit, claim_tag="rc.2-v1.2.3",+ claim_object=tag_object,+ claim={**claim, "lanes": frozenset({"windows", "docker"} - set(lanes)) or frozenset({"docker"})})++def test_publish_attempt_refuses_a_release_that_is_no_longer_a_draft(tmp_path, monkeypatch):from scripts.releases import stable@@ -844,13 +936,10 @@ WINDOWS_VERSION = "2026.5761.123.0"RELEASE_EPOCH = 1_787_965_323-def _fake_stable_context(*, skip_tests=False, include_macos_intel=True, include_termux=True):+def _fake_stable_context(*, lanes=lane_set.NAMES):def context(env):return "v1.2.3", RECEIPT_COMMIT, {"claim_tag": ATTEMPT, "claim_object": "0" * 40,- "claim_epoch": RELEASE_EPOCH, "skip_bundles": False,- "skip_tests": skip_tests,- "include_macos_intel": include_macos_intel,- "include_termux": include_termux}+ "claim_epoch": RELEASE_EPOCH, "lanes": frozenset(lanes)}return context@@ -1117,13 +1206,12 @@ def test_gate_excuses_an_upgrade_arm_only_for_its_planners_no_baseline_output():needs = {name: {"result": "skipped"} for name in PACKAGED_BY}needs.update({name: {"result": "success", "outputs": {"baseline": "none"}}for name in PACKAGED_BY.values()})- require_gate(needs, required, skip_bundles=False, skip_tests=False, include_macos_intel=True)+ require_gate(needs, required, lanes=lane_set.NAMES)for packaged, planner in PACKAGED_BY.items():for planned in ({"result": "success", "outputs": {"baseline": "published"}},{"result": "success"}, {"result": "failure", "outputs": {"baseline": "none"}}):with pytest.raises(ValueError, match=packaged):- require_gate({**needs, planner: planned}, required, skip_bundles=False, skip_tests=False,- include_macos_intel=True)+ require_gate({**needs, planner: planned}, required, lanes=lane_set.NAMES)def test_candidate_manifest_needs_every_call_and_stages_the_archive_manifest(@@ -1170,7 +1258,7 @@ def test_candidate_manifest_needs_every_call_and_stages_the_archive_manifest(assert f"releases/tag/{ATTEMPT}/release-candidates.json" not in r2_server.store-def test_a_claim_that_skipped_tests_records_skipped_smokes_never_passed(+def test_a_claim_without_the_smoke_lane_records_skipped_smokes_never_passed(tmp_path, r2_server, https_origin, monkeypatch):from scripts.releases import stable@@ -1183,7 +1271,7 @@ def test_a_claim_that_skipped_tests_records_skipped_smokes_never_passed(_stage_windows_handoff(built, "arm64")_stage_universal_bundle(built)_stage_termux_handoff(built)- monkeypatch.setattr(stable, "stable_context", _fake_stable_context(skip_tests=True))+ monkeypatch.setattr(stable, "stable_context", _fake_stable_context(lanes=lane_set.select(only=lane_set.NAMES, without=["smoke"])))calls = {call: {"result": "success"} for call in stable.CALL_SMOKE_JOBS}env = {**_receipt_env(tmp_path, https_origin.base), "RELEASE_NEEDS": json.dumps(calls)}# A build call that failed still leaves no manifest, even with the smokes off.@@ -1199,9 +1287,9 @@ def test_a_claim_that_skipped_tests_records_skipped_smokes_never_passed(assert manifest["smoke_results"] == {job: {"result": "skipped"} for job in stable.SMOKE_JOBS}stable.validate_candidates(manifest, "v1.2.3", RECEIPT_COMMIT, https_origin.base,RELEASE_EPOCH, archive=ATTEMPT)- stable.require_smokes_match_claim(manifest, skip_tests=True)+ stable.require_smokes_match_claim(manifest, lane_set.select(without=["smoke"]))with pytest.raises(ValueError, match="test policy"):- stable.require_smokes_match_claim(manifest, skip_tests=False)+ stable.require_smokes_match_claim(manifest, lane_set.DEFAULT)def test_the_final_tag_push_authenticates_with_gh_token_without_persisted_credentials():diff --git a/website/docs/developer-guide/stable-releases.md b/website/docs/developer-guide/stable-releases.mdindex c2be0717b47..8b42302fe82 100644--- a/website/docs/developer-guide/stable-releases.md+++ b/website/docs/developer-guide/stable-releases.md@@ -15,14 +15,14 @@ files on `main`.`abandoned-rc.*`). Derive the next SemVer from the published release familyseeded at `0.21.5` (the last legacy CalVer release, v2026.9.24) alone: the newer of the protected R2 stable head and thenewest published non-prerelease GitHub release with a `vX.Y.Z` tag. A- release that skipped bundles moves only the second. Attempts do not move the+ release that builds no desktop packages moves only the second. Attempts do not move theversion line. A cut whose next version already has a final `vX.Y.Z` tag isrefused until that publication finishes.2. Push an annotated `rc.<N>-vX.Y.Z` attempt ref atomically, create onenon-prerelease GitHub draft on it, and dispatch `Stable Release` from thedefault branch with that ref as its `tag` input. The attempt number comes from the existing attempt refs of that version.The claim message binds its commit, attempt number, autopublish policy,- `skipBundles`, `skipTests`, `includeMacosIntel` and `includeTermux` flags, and+ lane set (see [Lanes](#lanes)), andone monotonically allocated epoch. That epoch is the release date and nativepackaging clock for every matrix leg and retry. One outstanding attempt, ofany version, blocks a new `release`.@@ -33,9 +33,9 @@ files on `main`.`main`'s tip, never the commit under test. Every lane that tests or builds thepayload is passed the admitted commit, and the commit-threading lint in`tests/ci/test_stable_release_commit_threading.py` enforces that.-4. Run the whole source, Docker, Nix, PM bundle, install/update, Windows,- signed-package, and native-upgrade acceptance graph (plus macOS Intel and- Termux when the claim opted into them).+4. Run the lanes the claim records: by default the whole source, Docker, Nix,+ PM bundle, install/update, Windows, signed-package, and native-upgrade+ acceptance graph, without macOS Intel and Termux.5. Push immutable versioned Docker and R2 artifacts from the tested bytes. TheDocker image is pushed as soon as its own tests pass, tagged by the attemptref. Do not move `stable` or `latest` aliases yet and do not rebuild for@@ -104,102 +104,89 @@ Add `--autopublish` to publish immediately when the claim becomes the oldestgreen release. Without it, the release stays a draft until an explicit publishor a later green claim forces ordered resolution.-### Skip bundles or tests+### Lanes-Two `release` flags remove parts of the pipeline. They can be used together,-and they combine with `--autopublish`.+A stable release is a set of lanes. A build lane produces something users get;+a test lane is a suite that gates the release. `release` starts from the+default set and edits it:```sh-# Tag, GitHub release and Docker image only-python scripts/release.py release --commit "$(git rev-parse origin/main)" --skip-bundles --remote origin-# Emergency release: build and publish everything, run no tests-python scripts/release.py release --commit "$(git rev-parse origin/main)" --skip-tests --remote origin+# The default: everything except macOS Intel and Termux+python scripts/release.py release --commit "$(git rev-parse origin/main)" --remote origin+# Only the Windows bundles (and the Store bundle) and the Docker image, no tests+python scripts/release.py release --commit "$(git rev-parse origin/main)" --only windows,docker --remote origin+# Everything, plus macOS Intel, without the install/update E2E+python scripts/release.py release --commit "$(git rev-parse origin/main)" --with macos-intel --without install-e2e --remote origin```-| | `--skip-bundles` | `--skip-tests` |-|---|---|---|-| Source CI (`ci.yaml`), Nix, Termux, Windows live, install/update E2E, bootstrap identity | run | skipped |-| Docker image | built, tested, published | built and published, `tests/docker` skipped |-| Native PM bundle check | skipped | skipped |-| Desktop and Termux candidates | skipped | built, signed and staged, with no native smokes or in-build test suites |-| Signed-package upgrade acceptance (`transitions-*`, `*-packaged`) | skipped | skipped |-| Publication | final tag, GitHub release, Docker `stable`/`latest` aliases | everything, as a normal release |--The flags are written into the claim message, never passed as workflow-inputs. `admit` reads them from the claim and emits `skip-bundles` and-`skip-tests`. Every job condition and every gate reads those outputs. A-recovery rerun cannot change them. To change a flag, `abandon` the attempt and-cut again.--The gates stay strict. `scripts.releases.stable gate` reads the flags and-requires each job the flags remove to report `skipped`, and every other gated-job to report `success`. A job that ran although a flag removes it also-blocks the release. `SKIPPED_BY` in `scripts/releases/stable.py` is the one-table of which flag removes which job.--**`--skip-bundles`.** The draft, Docker image, final tag and GitHub release are-the whole release. No candidate manifest exists, so the final tag records-`candidateManifestSha256: null`. Publication moves only the Docker aliases. The-protected R2 stable head, App Installer and macOS feeds, APT channel,-downloads page, `releases/stable/release-candidates.json`, signed-package-baseline, and Store submission all stay on the previous bundle release. Source-checkouts on the official repository follow-`releases/stable/release-candidates.json`, so they also stay on the previous-bundle release. Such a release is complete when the Docker `stable` alias-carries the digest its final tag binds. The sequencer uses that alias, next to-the R2 head, to decide which releases still need their publication pass.--**`--skip-tests`.** Every artifact is built, signed, staged and published the-same way as a normal release. The candidate manifest records each native smoke-as `skipped`, never as passed. The next release uses that manifest as its-upgrade baseline like any other. Every reader that knows the claim (`complete`-and the protected R2 advance) refuses a manifest whose smoke results disagree-with the claim's `skipTests` flag. Use it only for an emergency fix, and cut a-normal release after it.--### macOS Intel and Termux are opt-in--A stable release does not build the macOS Intel (`darwin-x64`) desktop bundle-or the Termux (Android aarch64) APT package unless the claim asks for them.-Intel macOS is not supported on `main`, and its `macos-15-intel` bundle leg-alone takes well over an hour. Both remain buildable:+`--only` replaces the default set, `--with` adds lanes and `--without`+removes them. Each takes comma-separated names and can repeat. `release --help`+lists every lane.-```sh-python scripts/release.py release --commit "$(git rev-parse origin/main)" \- --include-macos-intel --include-termux --remote origin-```--| | default | `--include-macos-intel` | `--include-termux` |-|---|---|---|---|-| `candidates-darwin-x64`, `transitions-darwin-x64`, `macos-packaged-x64` | skipped | run | skipped |-| `candidates-termux`, `termux-checks` | skipped | skipped | run |--Like the skip flags, `--include-macos-intel` and `--include-termux` are written-into the claim (`includeMacosIntel`, `includeTermux`) and `admit` emits them as-`include-macos-intel` and `include-termux`. A claim without those keys, which-includes every claim cut before they existed, reads them as `false`. The gate-requires an opted-out job to report `skipped`, and `--skip-bundles` /-`--skip-tests` still remove these jobs when the platform is opted in.--When a platform is left out, its rows are absent from the candidate manifest,-the release body's downloads table and the downloads page. The two channels-behave differently:--- **macOS Intel:** there is one macOS stable feed- (`releases/darwin/stable/stable-mac.yml`), and `promote` replaces it with- the arm64 leg alone. Intel Macs on that feed get no update until a release is- cut with `--include-macos-intel`. The protected R2 head carries three native- packages, and a preview channel that ships macOS Intel cannot be retired into- a stable head without it.-- **Termux:** the APT indexes are not rewritten, so the APT channel stays on- its previous release.--A release that opts macOS Intel back in after one that left it out has no-published Intel baseline, so its Intel upgrade arm is skipped like a first-release.--The claim flags, the jobs they remove, the handoffs, targets and smoke jobs for-both platforms are defined once in `scripts/releases/optional_platforms.py`.+| Lane | Default | What it controls |+|---|---|---|+| `docker` | on | build and publish the Docker image |+| `windows` | on | Windows x64 and arm64 MSIX, the universal bundle and the Store bundle (they build together) |+| `macos-arm64` | on | macOS Apple Silicon DMG and ZIP |+| `macos-intel` | off | macOS Intel DMG and ZIP: unsupported on `main`, and its runner adds over an hour |+| `termux` | off | Termux (Android aarch64) APT package |+| `ci`, `nix`, `docker-tests`, `pm-bundle`, `windows-live`, `install-e2e`, `bootstrap-version` | on | the standalone suites |+| `termux-checks` | on | Termux verification; runs only with `termux` |+| `smoke` | on | native install and chat smoke of each built desktop package |+| `upgrade` | on | signed-package upgrade acceptance (OLD to NEW) of each built desktop package |++Lanes are independent switches. A job runs only when every lane it needs is on+(`JOB_LANES` in `scripts/releases/lanes.py`), so a test lane for something that+is not built does nothing: `upgrade` with `macos-arm64` off plans no macOS+upgrade arm.++The lane set is written into the claim message (`"lanes": [...]`), never passed+as a workflow input. `admit` reads it from the claim and emits two outputs:+`lanes` (one flag per lane) and `jobs` (one run flag per lane-controlled job).+Every such job's `if` reads its own `jobs` entry, so the lane table is the only+place that says what runs. A recovery rerun cannot change it. To change a lane,+`abandon` the attempt and cut again.++The gates stay strict. `scripts.releases.stable gate` reads the lanes and+requires each job they remove to report `skipped`, and every other gated job to+report `success`. A job that ran although a lane removes it also blocks the+release. A claim cut before lanes existed (`skipBundles`, `skipTests`,+`includeMacosIntel`, `includeTermux`) reads as the lane set that gated the same+jobs.++What a release publishes follows what it built:++- **Docker.** With `docker` off no image is built or promoted, and the final+ tag records `dockerManifestDigest: null`.+- **Bundles.** With no desktop or Termux lane there is no candidate manifest,+ and the final tag records `candidateManifestSha256: null`.+- **The desktop channel moves only for the full desktop set** (`windows` and+ `macos-arm64`). A partial set still stages its packages, records a candidate+ manifest with exactly the targets it built, and submits the Store bundle when+ `windows` is on. The protected R2 stable head, the App Installer and macOS+ feeds, the APT channel, downloads page,+ `releases/stable/release-candidates.json` and the signed-package baseline stay+ on the previous full release. Source checkouts on the official repository+ follow `releases/stable/release-candidates.json`, so they stay too.+- **Finished.** A release that advances the desktop channel is finished when+ the protected R2 head names it. One that only moves Docker is finished when+ the `stable` alias carries the digest its final tag binds. One that moves no+ channel is finished once it is public. The sequencer uses these markers to+ decide which releases still need their publication pass.+- **No tests.** The candidate manifest records each native smoke as `skipped`,+ never as passed, and every reader that knows the claim (`complete` and the+ protected R2 advance) refuses a manifest whose smoke results disagree with the+ claim's `smoke` lane. The next full release uses that manifest as its upgrade+ baseline like any other. Cut a normal release after an untested one.++When macOS Intel is left out, its rows are absent from the candidate manifest,+the release body's downloads table and the downloads page. There is one macOS+stable feed (`releases/darwin/stable/stable-mac.yml`), and `promote` replaces it+with the arm64 leg alone, so Intel Macs on that feed get no update until a+release is cut with `--with macos-intel`. When Termux is left out the APT+indexes are not rewritten, so the APT channel stays on its previous release.+A release that adds a target back after one that left it out has no published+baseline for it, so that target's upgrade arm is skipped like a first release.The claim push is the atomic version lock. Two callers may derive the same nextversion, but only one push wins; the loser reports the winning tagger, time, and@@ -301,8 +288,8 @@ retain no downloadable job artifacts.The desktop workflow takes a `jobs` input with the groups `darwin-arm64`,`darwin-x64`, `win32-arm64`, `win32-x64`, `win32-bundle`, `linux-x64`,`linux-arm64`, and `termux`. Stable calls it once per group, except the linux-groups, which wait for a real Linux build, and the opt-in `darwin-x64` and-`termux` groups, which it calls only when the claim includes them. Each Mac arch and the Windows bundle+groups, which wait for a real Linux build, and the `darwin-x64`, `termux` and+any other group whose lane the claim leaves out, which it does not call. Each Mac arch and the Windows bundlestage a receipt, and each install arm starts from its own receipt as soon asits own bytes are staged. `acceptance` is the one join that blocks publication.@@ -496,8 +483,8 @@ See [the bundled update contract](https://github.com/NousResearch/hermes-agent/bbecause it is flaky. It is reported as deferred, not passed. Stabilize itand prove repeatable CI runs before adding it to this gate.- Install/update E2E and native signed-package acceptance are **not** deferred.- Only a claim cut with `--skip-tests` removes them, and the gate then requires- them to be skipped.+ Only a claim without the `install-e2e`, `smoke` or `upgrade` lane removes+ them, and the gate then requires them to be skipped.- PR-only history, label and diff review checks do not apply to a stable tag.All applicable source CI jobs still run, regardless of changed paths.- OSV vulnerability findings retain their existing advisory policy. Requireddiff --git a/website/docs/getting-started/platform-support.md b/website/docs/getting-started/platform-support.mdindex 75e98e51989..3deb9e52c88 100644--- a/website/docs/getting-started/platform-support.md+++ b/website/docs/getting-started/platform-support.md@@ -33,17 +33,17 @@ PRs will be accepted to fix issues with them, but they will take precedence belo| OS / Architecture | Installation methods | Notes || ------------------------------ | -------------------------------------------------------------------- | ---------------------------------------------------------------------------- || **Nix** (macOS, Linux, NixOS) | [Nix flake and modules](./nix-setup.md) | Nix owns runtime installation and updates. |-| **Android / [Termux](./termux.md)** (aarch64) | [Signed APT repository](./termux.md), then `pkg install hermes-agent` | Prerelease package with Python, Node, and TUI. Not built by default: only releases cut with `--include-termux` update the APT channel. Run the gateway in a Termux session; Android can terminate background processes. |+| **Android / [Termux](./termux.md)** (aarch64) | [Signed APT repository](./termux.md), then `pkg install hermes-agent` | Prerelease package with Python, Node, and TUI. Not built by default: only releases cut with `--with termux` (and `windows` and `macos-arm64`) update the APT channel. Run the gateway in a Termux session; Android can terminate background processes. |### Build targets and support priorityStable releases build the macOS desktop bundle for Apple Silicon (`arm64`) only.The Intel macOS (`x64`) bundle and the Termux APT package are **not built bydefault**: a release includes them only when it is cut with-`release.py release --include-macos-intel` or `--include-termux`. A release+`release.py release --with macos-intel` or `--with termux`. A releasewithout macOS Intel replaces the one shared macOS stable update feed with anarm64-only feed, so Intel Macs installed from a desktop bundle get no update-until a release is cut with `--include-macos-intel`. A release without Termux+until a release is cut with `--with macos-intel`. A release without Termuxleaves the Termux APT channel on its previous release.The `Hermes-Setup.dmg` bootstrap installer is built for Apple Silicon only, soon an Intel Mac it reports "not supported on this Mac". Intel Macs can install@@ -61,7 +61,7 @@ PRs to fix them will _not_ be accepted, and any code that keeps compatibility wi- Android / Termux on non-aarch64 devices (aarch64 is [supported](./termux.md) via our APT package)- installs via the AUR (we might upstream patches if it helps out <3)-- 32-bit x86 macOS. Intel x86_64 desktop bundles are built only for releases cut with `--include-macos-intel`.+- 32-bit x86 macOS. Intel x86_64 desktop bundles are built only for releases cut with `--with macos-intel`.- installs via `pypi` (e.g. `uv tool install hermes-agent`, `pip install hermes-agent`, etc.)- installs via `brew` (`brew install hermes-agent`)