Skip to content

The agent that grows with you

ci(release): refuse Intel-less retirement targets and define opt-in platforms once

Teknium0d3b11c21c57
diff --git a/scripts/bundles/release_artifacts.py b/scripts/bundles/release_artifacts.py
index 26f8dfef9fb..1e919f9c5f9 100644
--- a/scripts/bundles/release_artifacts.py
+++ b/scripts/bundles/release_artifacts.py
@@ -14,6 +14,7 @@ import xml.etree.ElementTree as ET
import zipfile
from pathlib import Path, PureWindowsPath
+from scripts.releases import optional_platforms
from scripts.releases.stable import read_admitted_candidate, accepted_smoke_results, validate_candidates
@@ -160,8 +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")
-# The opt-in handoffs and the manifest target each one produces.
-OPTIONAL_HANDOFFS = {"darwin-x64": "macos/x64", "termux": "termux/aarch64"}
+OPTIONAL_HANDOFFS = optional_platforms.HANDOFFS # opt-in handoff -> manifest target
def assemble(root: Path, tag: str, commit: str, public_base: str, out: Path,
diff --git a/scripts/releases/channel_releases.py b/scripts/releases/channel_releases.py
index 17f3df07c16..38716428438 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, r2, stable
+from scripts.releases import handoff, optional_platforms, r2, stable
from scripts.releases.channels import ChannelPublisher, R2ChannelStore
from scripts.releases.versioning import parse_attempt_ref
@@ -53,9 +53,10 @@ def product_identity(tag: str, run=subprocess.check_output) -> dict:
return validate_identity(identity)
-# Stable builds macOS Intel only when the claim opts in; the other legs are
-# in every bundle release.
-OPTIONAL_NATIVE_LEGS = {"darwin-x64": ("macos", "x64")}
+# 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}
def native_legs(accepted: dict | None) -> tuple[str, ...]:
diff --git a/scripts/releases/channels.py b/scripts/releases/channels.py
index 7a2275fe98a..3b89e89b411 100644
--- a/scripts/releases/channels.py
+++ b/scripts/releases/channels.py
@@ -443,6 +443,15 @@ class ChannelPublisher:
raise ChannelError("Retirement requires a directly active stable-release destination")
target_raw = self.reader.read_bytes(target["head"]["manifestKey"], target["head"]["sha256"])
manifest = validate_manifest(decode_json(target_raw), target, self.public_base)
+ # Clients pin destinationHead and need their own package in it, so a
+ # stable head that left a target out (macOS Intel is opt-in) cannot
+ # receive a preview that shipped that target.
+ if record["head"] is not None:
+ source_raw = self.reader.read_bytes(record["head"]["manifestKey"], record["head"]["sha256"])
+ source = validate_manifest(decode_json(source_raw), record, self.public_base)
+ covered = {(p["platform"], p["arch"]) for p in manifest["packages"]}
+ if any((p["platform"], p["arch"]) not in covered for p in source["packages"]):
+ raise ChannelError("Retirement destination lacks a package this channel ships")
# Two-tier retirement: the kind is derived, never asserted by the caller.
# A suffixed (canary/commit) identity can never match stable's, so
# "in-place" cannot be mis-assigned; the kind is a client routing hint.
diff --git a/scripts/releases/entrypoint.py b/scripts/releases/entrypoint.py
index 043b7f2bc80..590cbee8308 100644
--- a/scripts/releases/entrypoint.py
+++ b/scripts/releases/entrypoint.py
@@ -15,6 +15,7 @@ import tempfile
import time
from pathlib import Path
+from scripts.releases import optional_platforms
from scripts.releases.draft_warning import draft_body
from scripts.releases.versioning import (
SEED, attempt_ref, derive_next_version, marker_ref, next_attempt,
@@ -477,13 +478,11 @@ def next_steps(result: dict, *, bold: bool = False) -> str:
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 = [(name, flag) for name, flag, on in (
- ("macOS Intel", "--include-macos-intel", result.get("include_macos_intel")),
- ("Termux", "--include-termux", result.get("include_termux"))) if not on]
+ left_out = optional_platforms.excluded(result)
if left_out:
- lines.append(f"Not built: {' and '.join(name for name, _ in left_out)} (opt in with "
- f"{' / '.join(flag for _, flag in left_out)}). "
- "Those channels stay on their previous release.")
+ 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"
lines.append(f"\033[1m{warning}\033[0m" if bold else warning)
diff --git a/scripts/releases/optional_platforms.py b/scripts/releases/optional_platforms.py
new file mode 100644
index 00000000000..000c4c0ec13
--- /dev/null
+++ b/scripts/releases/optional_platforms.py
@@ -0,0 +1,76 @@
+"""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/stable.py b/scripts/releases/stable.py
index fcdf4033aa9..e8ff24b8ae2 100644
--- a/scripts/releases/stable.py
+++ b/scripts/releases/stable.py
@@ -16,14 +16,14 @@ from pathlib import Path
from urllib.parse import unquote, urlsplit
from hermes_cli.update_channel import STABLE_TAG_RE
+from scripts.releases import optional_platforms
from scripts.releases.draft_warning import strip_draft_warning
+from scripts.releases.optional_platforms import require_targets_match_claim
from scripts.releases.versioning import tag_record
SHA = 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")
-# Built only when the claim opts in (includeMacosIntel / includeTermux). Every
-# other desktop target is in every bundle release.
-OPTIONAL_TARGETS = ("macos/x64", "termux/aarch64")
+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)
SMOKE_JOBS = {
"smoke-darwin-arm64": "macOS DMG + ZIP (arm64)",
@@ -73,28 +73,25 @@ def require_success(needs: dict, required: list[str]) -> None:
# 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")
-# Opt-in platforms. A claim cut before these existed has neither key, and a
-# missing key means false: those packages are not built unless asked for.
-OPTIONAL_CLAIM_FLAGS = ("includeMacosIntel", "includeTermux")
-# Removal reasons. The include flags remove their jobs when they are off.
+# 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"})
-_INTEL, _TERMUX = frozenset({"excludeMacosIntel"}), frozenset({"excludeTermux"})
SKIPPED_BY = {
- **{job: _TESTS for job in ("ci", "nix", "windows-live", "install-e2e",
+ **{job: _TESTS for job in ("ci", "nix", "termux-checks", "windows-live", "install-e2e",
"bootstrap-version")},
- "termux-checks": _TESTS | _TERMUX,
- **{job: _BUNDLES for job in ("candidates-darwin-arm64",
+ **{job: _BUNDLES for job in ("candidates-darwin-arm64", "candidates-darwin-x64",
"candidates-win32-arm64", "candidates-win32-x64",
- "candidates-win32-bundle",
+ "candidates-win32-bundle", "candidates-termux",
"candidate-manifest", "publish-bundles")},
- "candidates-darwin-x64": _BUNDLES | _INTEL,
- "candidates-termux": _BUNDLES | _TERMUX,
# Bundle acceptance is a test of bundles, so either flag removes it.
**{job: _TESTS | _BUNDLES for job in ("pm-bundle", "transitions-darwin-arm64",
- "transitions-win32",
- "windows-packaged", "macos-packaged-arm64")},
- **{job: _TESTS | _BUNDLES | _INTEL for job in ("transitions-darwin-x64", "macos-packaged-x64")},
+ "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.
@@ -104,23 +101,23 @@ PACKAGED_BY = {"macos-packaged-arm64": "transitions-darwin-arm64",
def gate_expectations(required: list[str], *, skip_bundles: bool, skip_tests: bool,
- include_macos_intel: bool = False, include_termux: bool = False) -> dict:
- """Each gated job's required result under the claim's flags."""
- active = {flag for flag, on in (("skipBundles", skip_bundles), ("skipTests", skip_tests),
- ("excludeMacosIntel", not include_macos_intel),
- ("excludeTermux", not include_termux)) if on}
+ **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 require_gate(needs: dict, required: list[str], *, skip_bundles: bool, skip_tests: bool,
- include_macos_intel: bool = False, include_termux: bool = False) -> None:
+ **platforms: bool) -> None:
"""``require_success`` that also demands a flag-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,
- include_macos_intel=include_macos_intel,
- include_termux=include_termux)
+ expected = gate_expectations(required, skip_bundles=skip_bundles, skip_tests=skip_tests, **platforms)
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.
@@ -261,16 +258,6 @@ def validate_candidates(manifest: dict, tag: str, commit: str, public_base: str,
return rows
-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."""
- present = {f"{row.get('platform')}/{row.get('arch')}" for row in manifest.get("packages", [])}
- for target, wanted in (("macos/x64", include_macos_intel), ("termux/aarch64", include_termux)):
- if (target in present) != wanted:
- raise ValueError(f"Candidate manifest {'lacks' if wanted else 'carries'} {target}, "
- "which differs from the claim")
-
-
def validate_receipt(manifest: dict, receipt: str, tag: str, commit: str, public_base: str,
release_epoch: int | None = None, *, archive: str) -> dict:
"""One per-arch or bundle receipt: exactly that group's rows and no others."""
@@ -452,23 +439,17 @@ 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.
-
- The opt-in platform flags are optional: every claim cut before they
- existed lacks them, and ``release`` writes them only when set. A missing
- one reads as false. The returned copy always carries both.
- """
+ Opt-in platform flags may be absent (older claims); the copy returned has them."""
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 any(not isinstance(metadata[flag], bool)
- for flag in OPTIONAL_CLAIM_FLAGS if flag in metadata)
or not isinstance(metadata.get("claimEpoch"), int)
or metadata["claimEpoch"] <= 0
- or not required <= set(metadata) <= {*required, *OPTIONAL_CLAIM_FLAGS}):
+ or not required <= set(metadata) <= {*required, *optional_platforms.CLAIM_FLAGS}):
raise ValueError("Stable claim metadata is invalid")
- return {**{flag: False for flag in OPTIONAL_CLAIM_FLAGS}, **metadata}
+ return {**metadata, **optional_platforms.claim_flags(metadata)}
def _claim_metadata(raw: str, *, version: str, attempt: int, commit: str) -> dict:
@@ -562,9 +543,8 @@ def check_claim(env: dict, run=output) -> dict:
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"],
- "include_macos_intel": metadata["includeMacosIntel"],
- "include_termux": metadata["includeTermux"], "claim_epoch": claim_epoch}
+ "skip_tests": metadata["skipTests"], "claim_epoch": claim_epoch,
+ **{p.key: metadata[p.claim_flag] for p in optional_platforms.PLATFORMS}}
def stable_context(env: dict, run=output) -> tuple[str, str, dict]:
@@ -680,13 +660,12 @@ def admit(env: dict) -> None:
"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",
- "include-macos-intel": "true" if admitted["include_macos_intel"] else "false",
- "include-termux": "true" if admitted["include_termux"] else "false",
+ **{p.key.replace("_", "-"): "true" if admitted[p.key] else "false"
+ for p in optional_platforms.PLATFORMS},
}, env)
skipped = [name for name, on in (("bundles", admitted["skip_bundles"]),
("tests", admitted["skip_tests"])) if on]
- opted = [name for name, on in (("macOS Intel", admitted["include_macos_intel"]),
- ("Termux", admitted["include_termux"])) 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"
@@ -792,13 +771,6 @@ CANDIDATE_HANDOFFS = ("win32-x64", "win32-arm64", "darwin-x64", "darwin-arm64",
CANDIDATE_INCLUDES = ("metadata-*.json", "*.msixbundle")
-def claim_handoffs(*, include_macos_intel: bool, include_termux: bool) -> tuple[str, ...]:
- """The handoffs a claim's candidate calls stage. Opt-in groups only when asked for."""
- omitted = {name for name, on in (("darwin-x64", include_macos_intel),
- ("termux", include_termux)) if not on}
- return tuple(name for name in CANDIDATE_HANDOFFS if name not in omitted)
-
-
def candidate_manifest(env: dict) -> None:
"""Merge the staged handoffs into the accepted candidate manifest."""
from scripts.bundles.release_artifacts import assemble
@@ -810,11 +782,10 @@ def candidate_manifest(env: dict) -> None:
tag, commit, claim = stable_context(env)
if claim["skip_bundles"]:
raise ValueError("A claim that skipped bundles has no candidate manifest")
- handoffs = claim_handoffs(include_macos_intel=claim["include_macos_intel"],
- include_termux=claim["include_termux"])
+ 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.
- calls = {call: job for call, job in CALL_SMOKE_JOBS.items()
- if call != "candidates-darwin-x64" or claim["include_macos_intel"]}
+ 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}
smoke = {job: {"result": "skipped"} for job in CALL_SMOKE_JOBS.values()}
if claim["skip_tests"]:
# The calls built and staged their groups but ran no smoke. Record
@@ -1010,8 +981,7 @@ def main(argv: list[str] | None = None, env: dict | None = None) -> None:
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"),
- include_macos_intel=_flag(env, "INCLUDE_MACOS_INTEL"),
- include_termux=_flag(env, "INCLUDE_TERMUX"))
+ **{p.key: _flag(env, p.key.upper()) for p in optional_platforms.PLATFORMS})
return
if 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/scripts/test_release_channels.py b/tests/scripts/test_release_channels.py
index 3bdf8417efd..c5e1d88b541 100644
--- a/tests/scripts/test_release_channels.py
+++ b/tests/scripts/test_release_channels.py
@@ -312,6 +312,45 @@ def test_retire_derives_receiver_kind_from_channel_identity_match():
assert pub.reader.resolve("suffixed-preview").requested["receiver"] == {"kind": "discontinued"}
+def test_retire_refuses_a_stable_head_without_the_previews_targets():
+ """An Intel preview cannot be pinned to an arm64-only stable head it has no package in."""
+ from hermes_cli.release_channels import ChannelError, canonical_json
+
+ def with_arches(manifest, arches):
+ row = manifest["packages"][0]
+ return dict(manifest, packages=[dict(row, arch=arch) for arch in arches])
+
+ with object_server() as (url, objects, _headers, _requests, _faults):
+ pub = publisher(url, verify_build=lambda request, manifest: True)
+ pub.create("intel-preview")
+ pub.create("stable")
+ build = pub.allocate("intel-preview", "a" * 40, "1.0.0")
+ key = "releases/channel-builds/" + build["buildId"] + "/build.json"
+ objects[key] = canonical_json(with_arches(put_build(objects, build), ("x64",)))
+ pub.promote(build["buildId"])
+ target = pub._read("stable")[0]
+ target["policy"] = "stable-release"
+ stable = dict(build, channel="stable", identity=target["identity"], releaseTag="v2.0.0", version="2.0.0",
+ windowsVersion="2.0.0.0", sourceVersion="2.0.0", buildId="d" * 32)
+ stable_manifest = put_build(objects, stable)
+ stable_key = "releases/channel-builds/" + stable["buildId"] + "/build.json"
+
+ def publish_stable(arches):
+ raw = canonical_json(with_arches(stable_manifest, arches))
+ objects[stable_key] = raw
+ target.update(nextSequence=stable["sequence"] + 1, head={
+ "buildId": stable["buildId"], "sequence": stable["sequence"], "manifestKey": stable_key,
+ "sha256": hashlib.sha256(raw).hexdigest()})
+ objects["releases/channels/stable.json"] = canonical_json(target)
+
+ publish_stable(("arm64",))
+ with pytest.raises(ChannelError, match="lacks a package"):
+ pub.retire("intel-preview", "stable", "2.0.0")
+ assert pub._read("intel-preview")[0]["state"] == "active"
+ publish_stable(("arm64", "x64"))
+ assert pub.retire("intel-preview", "stable", "2.0.0")["destinationHead"] == target["head"]
+
+
def test_mutable_read_loss_recovery_never_clones_another_allocation():
from scripts.releases.channels import ChannelConflict
from hermes_cli.release_channels import canonical_json
diff --git a/tests/scripts/test_stable_release.py b/tests/scripts/test_stable_release.py
index 4b8ed4cd578..92d76efadb9 100644
--- a/tests/scripts/test_stable_release.py
+++ b/tests/scripts/test_stable_release.py
@@ -975,8 +975,8 @@ def _staged_receipt(tmp_path, r2_server, https_origin, monkeypatch, receipt):
https_origin.store = r2_server.store
built = tmp_path / "built"
built.mkdir(exist_ok=True)
- if receipt == "darwin-arm64":
- _stage_darwin_handoff(built, "arm64")
+ if receipt in ("darwin-arm64", "darwin-x64"):
+ _stage_darwin_handoff(built, receipt.split("-")[1])
elif receipt == "win32-bundle":
_stage_windows_handoff(built, "x64")
_stage_windows_handoff(built, "arm64")
@@ -1029,6 +1029,29 @@ def test_transitions_from_the_bundle_receipt_emit_two_windows_rows(tmp_path, r2_
assert macos["include"] == []
+def test_an_intel_receipt_upgrades_only_from_a_baseline_that_built_intel(tmp_path, r2_server, https_origin,
+ monkeypatch):
+ """Opting macOS Intel back in after a release that left it out has no OLD Intel package."""
+ from scripts.releases import stable
+
+ url, digest = _staged_receipt(tmp_path, r2_server, https_origin, monkeypatch, "darwin-x64")
+ full = _local_baseline(https_origin.base)
+ lean = dict(full, packages=[row for row in full["packages"]
+ if (row["platform"], row["arch"]) != ("macos", "x64")],
+ smoke_results={**full["smoke_results"], "smoke-darwin-x64": {"result": "skipped"}})
+ monkeypatch.setattr(stable, "output", lambda argv: json.dumps(
+ {"tagName": full["tag"], "isDraft": False, "isPrerelease": False}))
+ for baseline, arches, planned in ((lean, [], "none"), (full, ["x64"], "published")):
+ https_origin.store["baseline.json"] = (json.dumps(baseline).encode(), '"e"')
+ (tmp_path / "output").unlink(missing_ok=True)
+ stable.main(["transitions"], _transitions_env(tmp_path, https_origin.base, "darwin-x64", url, digest))
+ emitted = dict(line.split("=", 1)
+ for line in (tmp_path / "output").read_text(encoding="utf-8").splitlines())
+ assert emitted["baseline"] == planned
+ assert [row["arch"] for row in json.loads(emitted["macos"])["include"]] == arches
+ assert json.loads(emitted["windows"]) == {"include": []}
+
+
def test_missing_baseline_plans_no_upgrade_arm_but_a_missing_supplied_one_blocks(
tmp_path, r2_server, https_origin, monkeypatch):
from scripts.releases import stable
diff --git a/website/docs/developer-guide/stable-releases.md b/website/docs/developer-guide/stable-releases.md
index b3b460d8c7c..c1860ece647 100644
--- a/website/docs/developer-guide/stable-releases.md
+++ b/website/docs/developer-guide/stable-releases.md
@@ -174,12 +174,24 @@ 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, and its channel
-stays on the previous release that built it: the macOS feed then lists only the
-arm64 leg, the protected R2 head carries three native packages, and the APT
-indexes are not rewritten. 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 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`.
The claim push is the atomic version lock. Two callers may derive the same next
version, but only one push wins; the loser reports the winning tagger, time, and
diff --git a/website/docs/getting-started/platform-support.md b/website/docs/getting-started/platform-support.md
index 929a04061e3..75e98e51989 100644
--- a/website/docs/getting-started/platform-support.md
+++ b/website/docs/getting-started/platform-support.md
@@ -40,9 +40,11 @@ PRs will be accepted to fix issues with them, but they will take precedence belo
Stable releases build the macOS desktop bundle for Apple Silicon (`arm64`) only.
The Intel macOS (`x64`) bundle and the Termux APT package are **not built by
default**: a release includes them only when it is cut with
-`release.py release --include-macos-intel` or `--include-termux`. Releases
-without them leave the Intel macOS update feed and the Termux APT channel on
-the last release that built them.
+`release.py release --include-macos-intel` or `--include-termux`. A release
+without macOS Intel replaces the one shared macOS stable update feed with an
+arm64-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
+leaves the Termux APT channel on its previous release.
The `Hermes-Setup.dmg` bootstrap installer is built for Apple Silicon only, so
on an Intel Mac it reports "not supported on this Mac". Intel Macs can install
the [CLI](./installation.md#linux--macos--wsl2--android-termux) and run