From 95248ee721e3d189226971122b9cddd0abd04993 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 16 Oct 2026 04:51:21 +0000 Subject: [PATCH 1/6] ci: name the Intel Mac release package darwin-amd64 The packager now maps Darwin x86_64 to the darwin-amd64 name already used in release-platforms.json. The Intel smoke job prints that name and still withholds the tarball from GitHub Releases. Co-authored-by: Sash --- .github/workflows/ci.yml | 1 + docs/MAC.md | 5 ++- scripts/package-release-binaries-test.py | 54 ++++++++++++++++++++++++ scripts/package-release-binaries.sh | 7 +++ scripts/test-source-gate.sh | 1 + 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 scripts/package-release-binaries-test.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63afef588..fccdd003f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1579,6 +1579,7 @@ jobs: run: | set -euo pipefail [[ "$RUNNER_OS/$RUNNER_ARCH" == macOS/X64 ]] + [[ "$(scripts/package-release-binaries.sh --print-platform)" == darwin-amd64 ]] df -Pk . df -Pk . | awk 'NR == 2 { if ($4 < 8 * 1024 * 1024) { print "Intel runner has under 8 GiB free"; exit 1 } }' - name: build the gateway binary diff --git a/docs/MAC.md b/docs/MAC.md index fcc03c760..af327b887 100644 --- a/docs/MAC.md +++ b/docs/MAC.md @@ -29,8 +29,9 @@ A signed Intel release opens only when these gates move together: - The Mac Browser engine host is Apple silicon Virtualization.framework. See [Browser support](BROWSER_SUPPORT.md). This runbook claims no local Intel Browser engine. -- `scripts/package-release-binaries.sh` accepts `Darwin-arm64` and rejects - `Darwin-x86_64`. +- `scripts/package-release-binaries.sh` prints `darwin-amd64` for Darwin + x86_64. The package name is `elastos-runtime-darwin-amd64`. The Intel smoke + job checks that printed name. That job uploads no release tarball. - `scripts/ci-release-policy-test.py` keeps the release-package matrix on the three signed platforms above. diff --git a/scripts/package-release-binaries-test.py b/scripts/package-release-binaries-test.py new file mode 100644 index 000000000..193cf0e0b --- /dev/null +++ b/scripts/package-release-binaries-test.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +"""Package names for hosts that already have a native release build.""" + +import os +import stat +import subprocess +import tempfile +import unittest +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +SCRIPT = ROOT / "scripts/package-release-binaries.sh" + + +def package_name(system, machine): + with tempfile.TemporaryDirectory() as directory: + shim = Path(directory) / "uname" + shim.write_text( + "#!/bin/sh\n" + f'SYSTEM={system!r}\nMACHINE={machine!r}\n' + 'case "$1" in -s) printf "%s\\n" "$SYSTEM" ;; *) printf "%s\\n" "$MACHINE" ;; esac\n' + ) + shim.chmod(shim.stat().st_mode | stat.S_IEXEC) + env = os.environ.copy() + env["PATH"] = directory + os.pathsep + env["PATH"] + return subprocess.run( + ["bash", str(SCRIPT), "--print-platform"], + cwd=ROOT, env=env, text=True, capture_output=True, timeout=15) + + +class PackageReleaseNameTest(unittest.TestCase): + def test_native_hosts_use_the_release_platform_names(self): + expected = { + ("Linux", "x86_64"): "linux-amd64", + ("Linux", "aarch64"): "linux-arm64", + ("Linux", "arm64"): "linux-arm64", + ("Darwin", "arm64"): "darwin-arm64", + ("Darwin", "x86_64"): "darwin-amd64", + } + for host, name in expected.items(): + with self.subTest(host=host): + result = package_name(*host) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(result.stdout.strip(), name) + + def test_other_darwin_hosts_stop(self): + result = package_name("Darwin", "i386") + self.assertNotEqual(result.returncode, 0) + self.assertIn("Unsupported release platform: Darwin-i386", result.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/scripts/package-release-binaries.sh b/scripts/package-release-binaries.sh index a2c4911f7..46e745b64 100755 --- a/scripts/package-release-binaries.sh +++ b/scripts/package-release-binaries.sh @@ -13,6 +13,7 @@ platform() { Linux-x86_64) printf '%s\n' "linux-amd64" ;; Linux-aarch64|Linux-arm64) printf '%s\n' "linux-arm64" ;; Darwin-arm64) printf '%s\n' "darwin-arm64" ;; + Darwin-x86_64) printf '%s\n' "darwin-amd64" ;; *) echo "Unsupported release platform: $(uname -s)-$(uname -m)" >&2 exit 1 @@ -20,6 +21,12 @@ platform() { esac } +# CI on an Intel Mac prints this name. Packaging still requires built binaries. +if [[ "${1:-}" == --print-platform ]]; then + platform + exit 0 +fi + PLATFORM="$(platform)" PACKAGE="elastos-runtime-${PLATFORM}" STAGE_ROOT="$(mktemp -d)" diff --git a/scripts/test-source-gate.sh b/scripts/test-source-gate.sh index 171d2a5ea..910d0788b 100755 --- a/scripts/test-source-gate.sh +++ b/scripts/test-source-gate.sh @@ -35,6 +35,7 @@ release() { python3 scripts/media-tools-build-test.py python3 scripts/verify-linux-arm64-package-test.py python3 scripts/gateway-healthz-smoke-test.py + python3 scripts/package-release-binaries-test.py python3 scripts/verify-linux-engine-test.py python3 scripts/update-hop-compare-test.py python3 .github/scripts/release-mac-capacity-test.py From 3e52e38ea91347962240c43576b76473a8133d6e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 16 Oct 2026 05:33:11 +0000 Subject: [PATCH 2/6] ci: keep the Intel package key mapped to the refused release id darwin-amd64 is the package name. release-platforms.json maps it to x86_64-darwin. The signer allowlist still refuses that release id, so the name is not a signed download. Co-authored-by: Sash --- scripts/package-release-binaries-test.py | 13 +++++++++++++ scripts/package-release-binaries.sh | 3 +++ 2 files changed, 16 insertions(+) diff --git a/scripts/package-release-binaries-test.py b/scripts/package-release-binaries-test.py index 193cf0e0b..a77b5022a 100644 --- a/scripts/package-release-binaries-test.py +++ b/scripts/package-release-binaries-test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Package names for hosts that already have a native release build.""" +import json import os import stat import subprocess @@ -44,6 +45,18 @@ def test_native_hosts_use_the_release_platform_names(self): self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(result.stdout.strip(), name) + def test_intel_package_key_is_the_release_id_the_signer_refuses(self): + platforms = json.loads((ROOT / "scripts/release-platforms.json").read_text()) + self.assertEqual(platforms["darwin-amd64"], "x86_64-darwin") + signer = (ROOT / "scripts/release-signer.py").read_text() + self.assertIn( + 'set(platforms) <= {"x86_64-linux", "aarch64-linux", "aarch64-darwin"}, "release platforms refused"', + signer, + ) + result = package_name("Darwin", "x86_64") + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(result.stdout.strip(), "darwin-amd64") + def test_other_darwin_hosts_stop(self): result = package_name("Darwin", "i386") self.assertNotEqual(result.returncode, 0) diff --git a/scripts/package-release-binaries.sh b/scripts/package-release-binaries.sh index 46e745b64..3cd46dcf4 100755 --- a/scripts/package-release-binaries.sh +++ b/scripts/package-release-binaries.sh @@ -13,6 +13,9 @@ platform() { Linux-x86_64) printf '%s\n' "linux-amd64" ;; Linux-aarch64|Linux-arm64) printf '%s\n' "linux-arm64" ;; Darwin-arm64) printf '%s\n' "darwin-arm64" ;; + # darwin-amd64 is the package key for release id x86_64-darwin. + # scripts/release-platforms.json maps that key to the id. The signer + # refuses x86_64-darwin. This name is not a signed download. Darwin-x86_64) printf '%s\n' "darwin-amd64" ;; *) echo "Unsupported release platform: $(uname -s)-$(uname -m)" >&2 From 44b5b20d14e714534aaf9b3181a020eb6bb63cfc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 17 Oct 2026 05:39:23 +0000 Subject: [PATCH 3/6] fix: refuse an unsigned Intel tarball and test the signer gate Full packaging stops on darwin-amd64 before it writes a tarball, including a Rosetta shell. --print-platform still prints the name and writes nothing. The signer allowlist is one frozenset, and an optimized interpreter run refuses x86_64-darwin without writing a signature. Co-authored-by: Sash --- docs/MAC.md | 40 +++++++---------- scripts/package-release-binaries-test.py | 53 +++++++++++++++++++---- scripts/package-release-binaries.sh | 13 ++++-- scripts/release-signer-test.py | 55 ++++++++++++++++++++++++ scripts/release-signer.py | 13 +++++- 5 files changed, 136 insertions(+), 38 deletions(-) diff --git a/docs/MAC.md b/docs/MAC.md index af327b887..f24c24a4c 100644 --- a/docs/MAC.md +++ b/docs/MAC.md @@ -8,32 +8,24 @@ artifacts, and `.dmg` packaging work. The public release id for an Intel Mac is `x86_64-darwin`. The signed installer stops on that host before a download lookup. The message is -`macOS release lookup requires Apple silicon`. This runbook's source-home path -is the local build. A signed download for that id is a separate release decision. +`macOS release lookup requires Apple silicon`. + +A person with an Intel Mac has no signed download. The next step is the signed +installer on an Apple silicon Mac. The source-home commands later in this +runbook are a developer build. They are not the installer. + +The signed platform set is `SIGNED_RELEASE_PLATFORMS` in +`scripts/release-signer.py`. `scripts/release-platforms.json` maps the package +key `darwin-amd64` to `x86_64-darwin`. That id is outside the signed set. +`scripts/package-release-binaries.sh --print-platform` prints `darwin-amd64` +on Darwin x86_64 and writes nothing. The packaging path refuses to write a +tarball for that key, including when a Rosetta shell reports `x86_64`. CI job `gateway-smoke-macos-intel` builds the native `elastos` binary on -`macos-15-intel` and requires `GET /healthz` to return the two bytes `OK` from -the process that job started. That job is a readiness smoke. It publishes no -signed release. - -A signed Intel release opens only when these gates move together: - -- `scripts/release-signer.py` admits `x86_64-linux`, `aarch64-linux`, and - `aarch64-darwin`. It refuses `x86_64-darwin`. -- `scripts/prepare-release-platform.sh` prepares Linux x86_64, Linux ARM64, and - macOS ARM64. On Mac it requires the Rust host to be `aarch64-apple-darwin`. -- `scripts/install.sh` selects `aarch64-darwin` and stops for every other Mac - architecture. -- `components.json` publishes `darwin-arm64` payloads. An Intel install needs - its own payload set. -- The Mac Browser engine host is Apple silicon Virtualization.framework. See - [Browser support](BROWSER_SUPPORT.md). This runbook claims no local Intel - Browser engine. -- `scripts/package-release-binaries.sh` prints `darwin-amd64` for Darwin - x86_64. The package name is `elastos-runtime-darwin-amd64`. The Intel smoke - job checks that printed name. That job uploads no release tarball. -- `scripts/ci-release-policy-test.py` keeps the release-package matrix on the - three signed platforms above. +`macos-15-intel` and checks the `/healthz` owner response in +[the launcher contract](LAUNCHER_CONTRACT.md). That job uploads no release +tarball. This runbook claims no local Intel Browser engine. See +[Browser support](BROWSER_SUPPORT.md). ## From Fresh Mac To Home diff --git a/scripts/package-release-binaries-test.py b/scripts/package-release-binaries-test.py index a77b5022a..49db6b85e 100644 --- a/scripts/package-release-binaries-test.py +++ b/scripts/package-release-binaries-test.py @@ -45,17 +45,52 @@ def test_native_hosts_use_the_release_platform_names(self): self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(result.stdout.strip(), name) - def test_intel_package_key_is_the_release_id_the_signer_refuses(self): + def test_intel_package_key_prints_and_packaging_refuses_the_tarball(self): platforms = json.loads((ROOT / "scripts/release-platforms.json").read_text()) self.assertEqual(platforms["darwin-amd64"], "x86_64-darwin") - signer = (ROOT / "scripts/release-signer.py").read_text() - self.assertIn( - 'set(platforms) <= {"x86_64-linux", "aarch64-linux", "aarch64-darwin"}, "release platforms refused"', - signer, - ) - result = package_name("Darwin", "x86_64") - self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual(result.stdout.strip(), "darwin-amd64") + printed = package_name("Darwin", "x86_64") + self.assertEqual(printed.returncode, 0, printed.stderr) + self.assertEqual(printed.stdout.strip(), "darwin-amd64") + with tempfile.TemporaryDirectory() as directory: + shim = Path(directory) / "uname" + shim.write_text( + "#!/bin/sh\n" + "case \"$1\" in -s) printf '%s\\n' Darwin ;; *) printf '%s\\n' x86_64 ;; esac\n" + ) + shim.chmod(shim.stat().st_mode | stat.S_IEXEC) + env = os.environ.copy() + env["PATH"] = directory + os.pathsep + env["PATH"] + env["TMPDIR"] = directory + before = set(ROOT.glob("elastos-runtime-*.tar.gz")) + result = subprocess.run( + ["bash", str(SCRIPT)], + cwd=ROOT, env=env, text=True, capture_output=True, timeout=15) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertIn("darwin-amd64 is not a signed release platform", result.stderr) + self.assertEqual(set(ROOT.glob("elastos-runtime-*.tar.gz")), before) + self.assertEqual(list(Path(directory).glob("elastos-runtime-*")), []) + + def test_print_platform_writes_nothing(self): + with tempfile.TemporaryDirectory() as directory: + shim = Path(directory) / "uname" + shim.write_text( + "#!/bin/sh\n" + "case \"$1\" in -s) printf '%s\\n' Darwin ;; *) printf '%s\\n' x86_64 ;; esac\n" + ) + shim.chmod(shim.stat().st_mode | stat.S_IEXEC) + scratch = Path(directory) / "tmp" + scratch.mkdir() + env = os.environ.copy() + env["PATH"] = directory + os.pathsep + env["PATH"] + env["TMPDIR"] = str(scratch) + before = {path.name for path in ROOT.iterdir()} + result = subprocess.run( + ["bash", str(SCRIPT), "--print-platform"], + cwd=ROOT, env=env, text=True, capture_output=True, timeout=15) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(result.stdout.strip(), "darwin-amd64") + self.assertEqual({path.name for path in ROOT.iterdir()}, before) + self.assertEqual(list(scratch.iterdir()), []) def test_other_darwin_hosts_stop(self): result = package_name("Darwin", "i386") diff --git a/scripts/package-release-binaries.sh b/scripts/package-release-binaries.sh index 3cd46dcf4..3df342364 100755 --- a/scripts/package-release-binaries.sh +++ b/scripts/package-release-binaries.sh @@ -13,9 +13,8 @@ platform() { Linux-x86_64) printf '%s\n' "linux-amd64" ;; Linux-aarch64|Linux-arm64) printf '%s\n' "linux-arm64" ;; Darwin-arm64) printf '%s\n' "darwin-arm64" ;; - # darwin-amd64 is the package key for release id x86_64-darwin. - # scripts/release-platforms.json maps that key to the id. The signer - # refuses x86_64-darwin. This name is not a signed download. + # The package key for release id x86_64-darwin. Printing the name + # does not write a tarball. The packaging path below refuses it. Darwin-x86_64) printf '%s\n' "darwin-amd64" ;; *) echo "Unsupported release platform: $(uname -s)-$(uname -m)" >&2 @@ -24,13 +23,19 @@ platform() { esac } -# CI on an Intel Mac prints this name. Packaging still requires built binaries. +# CI on an Intel Mac prints this name. This branch writes nothing. if [[ "${1:-}" == --print-platform ]]; then platform exit 0 fi PLATFORM="$(platform)" +# A Darwin x86_64 shell includes Rosetta, where uname -m is x86_64. +# Refuse before staging so that shell cannot write a darwin-amd64 tarball. +if [[ "$PLATFORM" == darwin-amd64 ]]; then + echo "darwin-amd64 is not a signed release platform. See docs/MAC.md." >&2 + exit 1 +fi PACKAGE="elastos-runtime-${PLATFORM}" STAGE_ROOT="$(mktemp -d)" STAGE="${STAGE_ROOT}/${PACKAGE}" diff --git a/scripts/release-signer-test.py b/scripts/release-signer-test.py index 4174dd86e..48fb2fdfd 100644 --- a/scripts/release-signer-test.py +++ b/scripts/release-signer-test.py @@ -19,6 +19,29 @@ from unittest import mock SOURCE = Path(__file__).with_name("release-signer.py").resolve() +OPTIMIZED_SIGNER_RUN = r""" +import os, shutil, subprocess, sys, tempfile +from pathlib import Path +source_test = Path(sys.argv[1]).resolve() +root = Path(tempfile.mkdtemp(prefix="elastos-signer-", dir=Path.home())) +os.chmod(root, 0o700) +scripts = root / "scripts" +scripts.mkdir(mode=0o700) +for name in ("release-signer.py", "release-signer-test.py"): + destination = scripts / name + destination.write_bytes((source_test.parent / name).read_bytes()) + destination.chmod(0o700) +env = os.environ.copy() +env["ELASTOS_SIGNER_OPT_CHILD"] = "1" +try: + completed = subprocess.run( + [sys.executable, "-O", str(scripts / "release-signer-test.py"), + "SignerTests.test_prepare_refuses_x86_64_darwin_without_a_signature"], + cwd=root, env=env) + raise SystemExit(completed.returncode) +finally: + shutil.rmtree(root) +""" spec = importlib.util.spec_from_file_location("release_signer", SOURCE) S = importlib.util.module_from_spec(spec) sys.modules[spec.name] = S @@ -538,6 +561,38 @@ def test_changes_keep_other_release_fields_strict(self): with self.assertRaisesRegex(ValueError, "release fields refused"): self.prepare() + def test_prepare_refuses_x86_64_darwin_without_a_signature(self): + # python -O strips assert statements. This refusal must survive that. + # The signer walks parent directories and refuses a world-writable + # parent, so the optimized run uses a private directory under $HOME. + if os.environ.get("ELASTOS_SIGNER_OPT_CHILD") != "1": + self.no_process.stop() + try: + result = subprocess.run( + [sys.executable, "-O", "-c", OPTIMIZED_SIGNER_RUN, str(Path(__file__).resolve())], + text=True, capture_output=True, timeout=120) + finally: + self.no_process.start() + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertIn("ok", result.stderr.lower()) + return + self.assertGreaterEqual(sys.flags.optimize, 1) + self.assertNotIn("x86_64-darwin", S.SIGNED_RELEASE_PLATFORMS) + manifest_path = self.root / "signing-input.json" + manifest = S.parse_json(manifest_path.read_bytes()) + manifest["release"]["platforms"]["x86_64-darwin"] = copy.deepcopy( + manifest["release"]["platforms"]["x86_64-linux"]) + data = S.json_bytes(manifest) + manifest_path.write_bytes(data) + self.policy["manifest_sha256"] = S.sha256(data) + signed = self.base / "signed" + self.assertFalse(signed.exists()) + with self.assertRaisesRegex(ValueError, "release platforms refused"): + self.prepare() + self.assertFalse(signed.exists()) + self.assertFalse(any(path.name in {"release.json", "release-head.json"} + for path in self.snapshot.rglob("*"))) + def test_signer_accepts_all_three_release_platforms(self): platform = self.manifest["release"]["platforms"]["x86_64-linux"] self.manifest["release"]["platforms"] = { diff --git a/scripts/release-signer.py b/scripts/release-signer.py index 6b8dfb5f0..7f53f004f 100644 --- a/scripts/release-signer.py +++ b/scripts/release-signer.py @@ -99,6 +99,9 @@ CAPSULE_RECORD_SCHEMA = "elastos.capsule.record/v1" # A release is one UnixFS chunk; Runtime refuses larger release metadata. MAX_RELEASE_METADATA = 256 * 1024 +# The signed release ids. Package keys live in scripts/release-platforms.json. +# x86_64-darwin is mapped there and is absent from this set. +SIGNED_RELEASE_PLATFORMS = frozenset({"x86_64-linux", "aarch64-linux", "aarch64-darwin"}) def require(condition, message): @@ -106,6 +109,11 @@ def require(condition, message): raise ValueError(message) +def require_signed_release_platforms(platforms): + require(type(platforms) is dict and platforms and set(platforms) <= SIGNED_RELEASE_PLATFORMS, + "release platforms refused") + + def sha256(data): return hashlib.sha256(data).hexdigest() @@ -1041,6 +1049,9 @@ def prepare_from_root(policy, root, manifest_name, fetch, snapshot_root, held_ro require(sha256(manifest_data) == checked_hash(policy.get("manifest_sha256")), "manifest differs from operator approval") manifest = parse_json(manifest_data) require(set(manifest) == {"source", "version", "channel", "files", "installer", "release", "head", "provenance"}, "signing input fields refused") + # Refuse an unsigned platform before provenance or any signature bytes. + if type(manifest.get("release")) is dict and type(manifest["release"].get("platforms")) is dict: + require_signed_release_platforms(manifest["release"]["platforms"]) source = {field: policy[field] for field in ("commit", "tree")} require(manifest["source"] == source and manifest["version"] == policy["version"] and manifest["channel"] == policy["channel"], "input source/version/channel differs") records = manifest["files"] @@ -1081,7 +1092,7 @@ def prepare_from_root(policy, root, manifest_name, fetch, snapshot_root, held_ro if release["prev_release_cid"] is not None: cid_info(release["prev_release_cid"]) platforms = release["platforms"] - require(type(platforms) is dict and platforms and set(platforms) <= {"x86_64-linux", "aarch64-linux", "aarch64-darwin"}, "release platforms refused") + require_signed_release_platforms(platforms) advertised = set() approved_refs = {(record["cid"], record["sha256"]) for record in records.values()} def admit_ref(cid, digest, size=None, release_path=None): From bc643360719f72419dcd75229764bf1ff4e94b03 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 06:02:05 +0000 Subject: [PATCH 4/6] test: refuse an Intel Mac release through the signer CLI under python -O The old check ran prepare() in an optimized child and only looked for "ok". The new child runs main() with python -I -S -O on an x86_64-darwin input that passes every other gate. It must stop with "release platforms refused", build no key backend and write no output. A second case turns that refusal into an assert statement and proves the first check fails under -O. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K --- scripts/release-signer-test.py | 155 ++++++++++++++++++++++----------- 1 file changed, 106 insertions(+), 49 deletions(-) diff --git a/scripts/release-signer-test.py b/scripts/release-signer-test.py index 48fb2fdfd..050e40c0c 100644 --- a/scripts/release-signer-test.py +++ b/scripts/release-signer-test.py @@ -2,6 +2,7 @@ """Public-data/fake-backend refusal tests. One model catalogue round trip signs with a throwaway OpenSSL key; no other private keys or real signing.""" +import ast import base64 import copy import hashlib @@ -19,28 +20,22 @@ from unittest import mock SOURCE = Path(__file__).with_name("release-signer.py").resolve() -OPTIMIZED_SIGNER_RUN = r""" -import os, shutil, subprocess, sys, tempfile +# The child loads this test file from a private copy, runs main() on an Intel +# Mac release input and writes what happened as JSON. It asserts nothing, so a +# refusal that python -O strips shows up as a signed publication. +OPTIMIZED_CLI_CHILD = r""" +import importlib.util, json, sys from pathlib import Path -source_test = Path(sys.argv[1]).resolve() -root = Path(tempfile.mkdtemp(prefix="elastos-signer-", dir=Path.home())) -os.chmod(root, 0o700) -scripts = root / "scripts" -scripts.mkdir(mode=0o700) -for name in ("release-signer.py", "release-signer-test.py"): - destination = scripts / name - destination.write_bytes((source_test.parent / name).read_bytes()) - destination.chmod(0o700) -env = os.environ.copy() -env["ELASTOS_SIGNER_OPT_CHILD"] = "1" +spec = importlib.util.spec_from_file_location("signer_optimized_child", sys.argv[1]) +tests = importlib.util.module_from_spec(spec) +spec.loader.exec_module(tests) +case = tests.SignerTests("x86_64_darwin_cli_outcome") +case.setUp() try: - completed = subprocess.run( - [sys.executable, "-O", str(scripts / "release-signer-test.py"), - "SignerTests.test_prepare_refuses_x86_64_darwin_without_a_signature"], - cwd=root, env=env) - raise SystemExit(completed.returncode) + outcome = case.x86_64_darwin_cli_outcome() finally: - shutil.rmtree(root) + case.doCleanups() +Path(sys.argv[2]).write_text(json.dumps(outcome)) """ spec = importlib.util.spec_from_file_location("release_signer", SOURCE) S = importlib.util.module_from_spec(spec) @@ -561,37 +556,99 @@ def test_changes_keep_other_release_fields_strict(self): with self.assertRaisesRegex(ValueError, "release fields refused"): self.prepare() - def test_prepare_refuses_x86_64_darwin_without_a_signature(self): - # python -O strips assert statements. This refusal must survive that. - # The signer walks parent directories and refuses a world-writable - # parent, so the optimized run uses a private directory under $HOME. - if os.environ.get("ELASTOS_SIGNER_OPT_CHILD") != "1": - self.no_process.stop() + def x86_64_darwin_cli_outcome(self): + """Run main() on an x86_64-darwin input that is valid in every other way.""" + # Component keys admit the Intel package here, so the platform + # allowlist is the only check left that can refuse this input. + intel_components = mock.patch.dict(S.COMPONENT_KEYS, {"x86_64-darwin": ("darwin-amd64", "x86_64-darwin")}) + intel_components.start() + self.addCleanup(intel_components.stop) + platform = copy.deepcopy(self.manifest["release"]["platforms"]["x86_64-linux"]) + self.manifest["release"]["platforms"]["x86_64-darwin"] = platform + (self.root / "elastos-x86_64-darwin").write_bytes(self.binary) + self.manifest["files"]["elastos-x86_64-darwin"] = copy.deepcopy( + self.manifest["files"]["elastos-x86_64-linux"]) + self.approve_manifest() + policy_path = self.base / "operator-policy.json" + policy_path.write_bytes(S.json_bytes(self.policy)) + output = self.base / "publication" + argv = [str(SOURCE), "--policy", str(policy_path), "--input-root", str(self.root), + "--output-root", str(output)] + error = None + with mock.patch.object(sys, "argv", argv), mock.patch.object(S, "pinned_tools"), \ + mock.patch.object(S, "github_json", side_effect=self.fetch), \ + mock.patch.object(sys, "stdin", io.StringIO(DID + "\n")), \ + mock.patch.object(sys, "stderr", io.StringIO()), mock.patch("builtins.print"), \ + mock.patch.object(S, "OpenSSLBackend", return_value=FakeBackend()) as backend: try: - result = subprocess.run( - [sys.executable, "-O", "-c", OPTIMIZED_SIGNER_RUN, str(Path(__file__).resolve())], - text=True, capture_output=True, timeout=120) - finally: - self.no_process.start() - self.assertEqual(result.returncode, 0, result.stdout + result.stderr) - self.assertIn("ok", result.stderr.lower()) - return - self.assertGreaterEqual(sys.flags.optimize, 1) - self.assertNotIn("x86_64-darwin", S.SIGNED_RELEASE_PLATFORMS) - manifest_path = self.root / "signing-input.json" - manifest = S.parse_json(manifest_path.read_bytes()) - manifest["release"]["platforms"]["x86_64-darwin"] = copy.deepcopy( - manifest["release"]["platforms"]["x86_64-linux"]) - data = S.json_bytes(manifest) - manifest_path.write_bytes(data) - self.policy["manifest_sha256"] = S.sha256(data) - signed = self.base / "signed" - self.assertFalse(signed.exists()) - with self.assertRaisesRegex(ValueError, "release platforms refused"): - self.prepare() - self.assertFalse(signed.exists()) - self.assertFalse(any(path.name in {"release.json", "release-head.json"} - for path in self.snapshot.rglob("*"))) + S.main() + except Exception as refusal: # The parent decides which refusal is correct. + error = f"{type(refusal).__name__}: {refusal}" + return {"optimize": sys.flags.optimize, "isolated": sys.flags.isolated, "error": error, + "backend": backend.call_count, + "outputs": sorted(path.name for path in output.iterdir()) if output.exists() else None} + + def optimized_cli_outcome(self, signer_source, optimize=True): + """Run x86_64_darwin_cli_outcome under python -I -S -O with this signer source.""" + # The signer refuses a writable output parent, so the copy is private + # and sits beside the checkout like the other fixtures. + private = Path(tempfile.mkdtemp(prefix=".signer-optimized-", dir=SOURCE.parent.parent)) + self.addCleanup(shutil.rmtree, private) + private.chmod(0o700) + scripts = private / "scripts" + scripts.mkdir(mode=0o700) + (scripts / "release-signer.py").write_text(signer_source) + (scripts / "release-signer-test.py").write_bytes(Path(__file__).read_bytes()) + result_path = private / "outcome.json" + self.no_process.stop() + try: + result = subprocess.run( + [sys.executable, "-I", "-S", *(["-O"] if optimize else []), "-c", OPTIMIZED_CLI_CHILD, + str(scripts / "release-signer-test.py"), str(result_path)], + text=True, capture_output=True, timeout=120) + finally: + self.no_process.start() + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + outcome = json.loads(result_path.read_text()) + self.assertEqual(outcome["optimize"], 1 if optimize else 0, outcome) + return outcome + + def test_optimized_cli_refuses_x86_64_darwin_and_signs_nothing(self): + # python -O strips assert statements. The Intel refusal must not. + outcome = self.optimized_cli_outcome(SOURCE.read_text()) + self.assertEqual((outcome["optimize"], outcome["isolated"]), (1, 1), outcome) + self.assertEqual(outcome["error"], "ValueError: release platforms refused", outcome) + self.assertEqual(outcome["backend"], 0, outcome) + self.assertIsNone(outcome["outputs"], outcome) + + def test_optimized_cli_detects_a_refusal_written_as_assert(self): + # Rewrite every "release platforms refused" require() as an assert + # statement. Without -O that signer still refuses. Under -O the + # refusal is gone, so the check in the test above must fail. A later + # gate (the package artifact prefix) can still stop this input, which + # is why the test above names the refusal it expects. + class AssertRefusal(ast.NodeTransformer): + count = 0 + + def visit_Expr(self, node): + call = node.value + if (isinstance(call, ast.Call) and isinstance(call.func, ast.Name) and call.func.id == "require" + and len(call.args) == 2 and isinstance(call.args[1], ast.Constant) + and call.args[1].value == "release platforms refused"): + self.count += 1 + return ast.copy_location(ast.Assert(test=call.args[0], msg=call.args[1]), node) + return self.generic_visit(node) + + transform = AssertRefusal() + tree = ast.fix_missing_locations(transform.visit(ast.parse(SOURCE.read_text()))) + self.assertGreaterEqual(transform.count, 1) + weakened = ast.unparse(tree) + plain = self.optimized_cli_outcome(weakened, optimize=False) + self.assertEqual(plain["error"], "AssertionError: release platforms refused", plain) + optimized = self.optimized_cli_outcome(weakened) + self.assertEqual(optimized["optimize"], 1, optimized) + self.assertNotEqual(optimized["error"], "ValueError: release platforms refused", optimized) + self.assertNotEqual(optimized["error"], "AssertionError: release platforms refused", optimized) def test_signer_accepts_all_three_release_platforms(self): platform = self.manifest["release"]["platforms"]["x86_64-linux"] From f4945e969258860f75a53f9bdb17192c080308fc Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 06:05:01 +0000 Subject: [PATCH 5/6] fix: package only binaries that match the package name A Rosetta shell on Apple silicon reports uname -m x86_64. The packager now names a host darwin-amd64 only when sysctl shows Intel hardware. It stops when sysctl is missing, fails, or gives an unknown answer. Before it writes a tarball, each staged binary must pass the native header rule in scripts/release-platform-input.py for the package key. A universal binary, or one built for another processor, stops packaging. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K --- scripts/ci-release-policy-test.py | 26 ++- scripts/package-release-binaries-test.py | 199 ++++++++++++++++++----- scripts/package-release-binaries.sh | 58 ++++++- 3 files changed, 238 insertions(+), 45 deletions(-) diff --git a/scripts/ci-release-policy-test.py b/scripts/ci-release-policy-test.py index af3781a4a..d1f893367 100644 --- a/scripts/ci-release-policy-test.py +++ b/scripts/ci-release-policy-test.py @@ -20,6 +20,16 @@ WORKFLOW = Path(__file__).resolve().parents[1] / ".github/workflows/ci.yml" + + +def native_header(package_key): + """A minimal executable header that packaging accepts for this package key.""" + import struct + if package_key.startswith("linux-"): + machine = {"linux-amd64": 62, "linux-arm64": 183}[package_key] + return (b"\x7fELF\x02\x01\x01" + bytes(9) + struct.pack("&2\nexit 1\n") + elif sysctl is not None: + translated, arm64 = sysctl + executable(directory / "sysctl", textwrap.dedent(f"""\ + #!/bin/sh + [ "$1" = -in ] || exit 2 + case "$2" in + sysctl.proc_translated) printf '%s' {translated!r} ;; + hw.optional.arm64) printf '%s' {arm64!r} ;; + *) exit 2 ;; + esac + """)) + + +def run_script(directory, *args, cwd=ROOT, script=SCRIPT, extra_env=None, only_shims=False): + env = os.environ.copy() + if only_shims: + # Only the shims and dirname: a tool that is not shimmed is missing. + os.symlink(shutil.which("dirname"), Path(directory) / "dirname") + env["PATH"] = str(directory) + else: + env["PATH"] = str(directory) + os.pathsep + env["PATH"] + env.update(extra_env or {}) + return subprocess.run([BASH, str(script), *args], cwd=cwd, env=env, text=True, + capture_output=True, timeout=60) + + +def package_name(system, machine, sysctl=NATIVE_INTEL, only_shims=False): with tempfile.TemporaryDirectory() as directory: - shim = Path(directory) / "uname" - shim.write_text( - "#!/bin/sh\n" - f'SYSTEM={system!r}\nMACHINE={machine!r}\n' - 'case "$1" in -s) printf "%s\\n" "$SYSTEM" ;; *) printf "%s\\n" "$MACHINE" ;; esac\n' - ) - shim.chmod(shim.stat().st_mode | stat.S_IEXEC) - env = os.environ.copy() - env["PATH"] = directory + os.pathsep + env["PATH"] - return subprocess.run( - ["bash", str(SCRIPT), "--print-platform"], - cwd=ROOT, env=env, text=True, capture_output=True, timeout=15) + write_shims(directory, system, machine, sysctl) + return run_script(directory, "--print-platform", only_shims=only_shims) + + +def native_header(kind, machine): + if kind == "elf": + return (b"\x7fELF\x02\x01\x01" + bytes(9) + struct.pack("IIIIII", 2, 0x100000C, 0, 0, 0, 0)).ljust(64, b"\0") + + +ELF_AMD64 = native_header("elf", 62) +ELF_ARM64 = native_header("elf", 183) +MACHO_ARM64 = native_header("macho", 0x100000C) +MACHO_AMD64 = native_header("macho", 0x1000007) +UNIVERSAL = native_header("fat", 0) class PackageReleaseNameTest(unittest.TestCase): @@ -45,6 +97,31 @@ def test_native_hosts_use_the_release_platform_names(self): self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(result.stdout.strip(), name) + def test_native_intel_answers_name_darwin_amd64(self): + # sysctl -i prints nothing for an OID that an Intel macOS lacks. + for answers in (("0", "0"), ("", ""), ("0", ""), ("", "0")): + with self.subTest(answers=answers): + result = package_name("Darwin", "x86_64", answers) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(result.stdout.strip(), "darwin-amd64") + + def test_rosetta_shell_on_apple_silicon_is_not_named_darwin_amd64(self): + for answers in (("1", "1"), ("1", ""), ("0", "1"), ("", "1")): + with self.subTest(answers=answers): + result = package_name("Darwin", "x86_64", answers) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertEqual(result.stdout, "") + self.assertIn("Rosetta on an Apple silicon Mac", result.stderr) + + def test_intel_name_fails_closed_without_a_clear_sysctl_answer(self): + cases = {"missing": None, "fails": "fail", "unknown value": ("2", "0"), "text": ("yes", "")} + for case, sysctl in cases.items(): + with self.subTest(case=case): + result = package_name("Darwin", "x86_64", sysctl, only_shims=True) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertEqual(result.stdout, "") + self.assertIn("sysctl", result.stderr) + def test_intel_package_key_prints_and_packaging_refuses_the_tarball(self): platforms = json.loads((ROOT / "scripts/release-platforms.json").read_text()) self.assertEqual(platforms["darwin-amd64"], "x86_64-darwin") @@ -52,19 +129,9 @@ def test_intel_package_key_prints_and_packaging_refuses_the_tarball(self): self.assertEqual(printed.returncode, 0, printed.stderr) self.assertEqual(printed.stdout.strip(), "darwin-amd64") with tempfile.TemporaryDirectory() as directory: - shim = Path(directory) / "uname" - shim.write_text( - "#!/bin/sh\n" - "case \"$1\" in -s) printf '%s\\n' Darwin ;; *) printf '%s\\n' x86_64 ;; esac\n" - ) - shim.chmod(shim.stat().st_mode | stat.S_IEXEC) - env = os.environ.copy() - env["PATH"] = directory + os.pathsep + env["PATH"] - env["TMPDIR"] = directory + write_shims(directory, "Darwin", "x86_64") before = set(ROOT.glob("elastos-runtime-*.tar.gz")) - result = subprocess.run( - ["bash", str(SCRIPT)], - cwd=ROOT, env=env, text=True, capture_output=True, timeout=15) + result = run_script(directory, extra_env={"TMPDIR": directory}) self.assertEqual(result.returncode, 1, result.stdout) self.assertIn("darwin-amd64 is not a signed release platform", result.stderr) self.assertEqual(set(ROOT.glob("elastos-runtime-*.tar.gz")), before) @@ -72,21 +139,11 @@ def test_intel_package_key_prints_and_packaging_refuses_the_tarball(self): def test_print_platform_writes_nothing(self): with tempfile.TemporaryDirectory() as directory: - shim = Path(directory) / "uname" - shim.write_text( - "#!/bin/sh\n" - "case \"$1\" in -s) printf '%s\\n' Darwin ;; *) printf '%s\\n' x86_64 ;; esac\n" - ) - shim.chmod(shim.stat().st_mode | stat.S_IEXEC) + write_shims(directory, "Darwin", "x86_64") scratch = Path(directory) / "tmp" scratch.mkdir() - env = os.environ.copy() - env["PATH"] = directory + os.pathsep + env["PATH"] - env["TMPDIR"] = str(scratch) before = {path.name for path in ROOT.iterdir()} - result = subprocess.run( - ["bash", str(SCRIPT), "--print-platform"], - cwd=ROOT, env=env, text=True, capture_output=True, timeout=15) + result = run_script(directory, "--print-platform", extra_env={"TMPDIR": str(scratch)}) self.assertEqual(result.returncode, 0, result.stderr) self.assertEqual(result.stdout.strip(), "darwin-amd64") self.assertEqual({path.name for path in ROOT.iterdir()}, before) @@ -98,5 +155,71 @@ def test_other_darwin_hosts_stop(self): self.assertIn("Unsupported release platform: Darwin-i386", result.stderr) +class PackageBinaryArchitectureTest(unittest.TestCase): + """Packaging writes a tarball only when every binary matches its name.""" + + def package(self, system, machine, headers): + directory = tempfile.TemporaryDirectory() + self.addCleanup(directory.cleanup) + root = Path(directory.name) + scripts = root / "scripts" + scripts.mkdir() + for name in ("package-release-binaries.sh", "release-platform-input.py", "release-platforms.json", + "release-signer.py", "components-release-integrity-check.py", "browser-host-release.py"): + shutil.copy2(ROOT / "scripts" / name, scripts / name) + shims = root / "shims" + shims.mkdir() + write_shims(shims, system, machine) + names = sorted(headers) + executable(shims / "cargo", "#!/bin/sh\nprintf '%s' " + repr(json.dumps({ + "workspace_members": ["member"], + "packages": [{"id": "member", "targets": [{"name": name, "kind": ["bin"]} for name in names]}], + })) + "\n") + (root / "elastos").mkdir() + (root / "elastos/Cargo.toml").touch() + release = root / "elastos/target/release" + release.mkdir(parents=True) + for name, header in headers.items(): + (release / name).write_bytes(header + name.encode()) + (release / name).chmod(0o755) + env = {"TMPDIR": str(root), "COPYFILE_DISABLE": "1", "CARGO_TARGET_DIR": str(root / "elastos/target")} + result = run_script(shims, cwd=root, script=scripts / "package-release-binaries.sh", extra_env=env) + return result, sorted(path.name for path in root.glob("elastos-runtime-*")) + + def test_matching_binaries_are_packaged(self): + cases = {("Linux", "x86_64"): ("linux-amd64", ELF_AMD64), + ("Linux", "aarch64"): ("linux-arm64", ELF_ARM64), + ("Darwin", "arm64"): ("darwin-arm64", MACHO_ARM64)} + for host, (key, header) in cases.items(): + with self.subTest(host=host): + result, written = self.package(*host, {"elastos": header, "custody-provider": header}) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(written, [f"elastos-runtime-{key}.tar.gz", f"elastos-runtime-{key}.tar.gz.sha256"]) + tarball = Path(result.stdout.strip().splitlines()[-1].removeprefix("Wrote ")) + with tarfile.open(tarball) as archive: + self.assertEqual(sorted(Path(item.name).name for item in archive if item.isfile()), + ["custody-provider", "elastos"]) + + def test_binary_for_another_processor_or_universal_is_refused(self): + cases = { + "arm64 ELF named linux-amd64": (("Linux", "x86_64"), ELF_ARM64), + "x86_64 ELF named linux-arm64": (("Linux", "aarch64"), ELF_AMD64), + "x86_64 Mach-O named darwin-arm64": (("Darwin", "arm64"), MACHO_AMD64), + "universal Mach-O named darwin-arm64": (("Darwin", "arm64"), UNIVERSAL), + "Linux ELF named darwin-arm64": (("Darwin", "arm64"), ELF_ARM64), + "shell script named linux-amd64": (("Linux", "x86_64"), b"#!/bin/sh\n".ljust(64, b"#")), + "short file named linux-amd64": (("Linux", "x86_64"), b"\x7fELF"), + } + for case, (host, header) in cases.items(): + with self.subTest(case=case): + good = {"Linux-x86_64": ELF_AMD64, "Linux-aarch64": ELF_ARM64, "Darwin-arm64": MACHO_ARM64}["-".join(host)] + result, written = self.package(*host, {"elastos": good, "wrong-tool": header}) + self.assertEqual(result.returncode, 1, result.stdout) + self.assertIn("Refusing to package", result.stderr) + self.assertIn("wrong-tool", result.stderr) + self.assertNotIn("elastos:", result.stderr) + self.assertEqual(written, []) + + if __name__ == "__main__": unittest.main() diff --git a/scripts/package-release-binaries.sh b/scripts/package-release-binaries.sh index 3df342364..b31889ccb 100755 --- a/scripts/package-release-binaries.sh +++ b/scripts/package-release-binaries.sh @@ -8,6 +8,33 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +# A Rosetta shell on Apple silicon also reports uname -m x86_64. Name the +# host darwin-amd64 only when sysctl shows Intel hardware. sysctl -i prints +# nothing for an OID that this macOS does not have. Any other answer stops. +check_native_intel_mac() { + local translated arm64 + if ! command -v sysctl >/dev/null 2>&1; then + echo "sysctl is missing, so this Mac cannot be checked for Rosetta." >&2 + exit 1 + fi + if ! translated="$(sysctl -in sysctl.proc_translated)" \ + || ! arm64="$(sysctl -in hw.optional.arm64)"; then + echo "sysctl could not report the Mac processor type." >&2 + exit 1 + fi + case "${translated}/${arm64}" in + /|0/|/0|0/0) ;; + 1/*|*/1) + echo "This shell runs under Rosetta on an Apple silicon Mac. Open a native arm64 shell." >&2 + exit 1 + ;; + *) + echo "sysctl reported an unknown Mac processor type: ${translated}/${arm64}" >&2 + exit 1 + ;; + esac +} + platform() { case "$(uname -s)-$(uname -m)" in Linux-x86_64) printf '%s\n' "linux-amd64" ;; @@ -15,7 +42,10 @@ platform() { Darwin-arm64) printf '%s\n' "darwin-arm64" ;; # The package key for release id x86_64-darwin. Printing the name # does not write a tarball. The packaging path below refuses it. - Darwin-x86_64) printf '%s\n' "darwin-amd64" ;; + Darwin-x86_64) + check_native_intel_mac + printf '%s\n' "darwin-amd64" + ;; *) echo "Unsupported release platform: $(uname -s)-$(uname -m)" >&2 exit 1 @@ -30,8 +60,7 @@ if [[ "${1:-}" == --print-platform ]]; then fi PLATFORM="$(platform)" -# A Darwin x86_64 shell includes Rosetta, where uname -m is x86_64. -# Refuse before staging so that shell cannot write a darwin-amd64 tarball. +# Refuse before staging so no darwin-amd64 tarball is written. if [[ "$PLATFORM" == darwin-amd64 ]]; then echo "darwin-amd64 is not a signed release platform. See docs/MAC.md." >&2 exit 1 @@ -75,6 +104,29 @@ if [ -z "$(ls -A "${STAGE}")" ]; then exit 1 fi +# Each staged file must be a thin executable for this package name. A +# universal binary or one built for another processor stops packaging. +# check_native_header in scripts/release-platform-input.py holds the rule. +python3 -I -S - "${ROOT}" "${PLATFORM}" "${STAGE}"/* <<'PY' +import importlib.util, json, os, sys +from pathlib import Path +root, package_key, paths = Path(sys.argv[1]), sys.argv[2], sys.argv[3:] +spec = importlib.util.spec_from_file_location("release_platform_input", root / "scripts/release-platform-input.py") +inputs = importlib.util.module_from_spec(spec) +spec.loader.exec_module(inputs) +release_id = json.loads((root / "scripts/release-platforms.json").read_text())[package_key] +refused = [] +for path in map(Path, paths): + with path.open("rb") as binary: + header = binary.read(64) + try: + inputs.check_native_header(header, path.stat().st_mode, release_id, path.name) + except ValueError as error: + refused.append(str(error)) +if refused: + sys.exit("Refusing to package " + package_key + ":\n" + "\n".join(refused)) +PY + echo "Packaging ${PACKAGE}:" ls -l "${STAGE}" From 9ab437aebfedd54e40c8246cf7d6e9be5a842f35 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 06:06:17 +0000 Subject: [PATCH 6/6] docs: keep the Intel Mac record in one place docs/MAC.md#intel-mac now names the file that holds each Intel rule: signing, package name, packaging, and install. README, INSTALL, GETTING_STARTED and the launcher contract link there instead of restating Intel support. The signer constant name is no longer copied into the doc. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K --- README.md | 2 +- docs/GETTING_STARTED.md | 2 +- docs/INSTALL.md | 2 +- docs/LAUNCHER_CONTRACT.md | 4 ++-- docs/MAC.md | 23 +++++++++++++++++------ 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 787ac0814..bca8fda7e 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ journeys tested on that device. ## Install from the publisher -The public installer looks up signed releases for Linux x86_64/aarch64 and macOS Apple silicon. Intel Mac and other OS families fail closed. +The public installer looks up signed releases for Linux x86_64/aarch64 and macOS Apple silicon. Other OS families fail closed. For an Intel Mac, see [Intel Mac](docs/MAC.md#intel-mac). The maintainer release DID is `did:key:z6MkgwHd2BCWe1jHMXPiR6H1q1RFPcv1YzhMbK5G1kBarbfe`. Compare the diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 5cad100dc..289b94634 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -2,7 +2,7 @@ ## Install from the publisher -The public installer looks up signed releases for Linux x86_64/aarch64 and macOS Apple silicon. Intel Mac and other OS families fail closed. See the [Mac runbook](MAC.md) for source-home staging. +The public installer looks up signed releases for Linux x86_64/aarch64 and macOS Apple silicon. Other OS families fail closed. For an Intel Mac, see [Intel Mac](MAC.md#intel-mac). See the [Mac runbook](MAC.md) for source-home staging. ```bash curl -fsSL https://elastos.elacitylabs.com/install.sh | bash diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 637fc2705..0eb88be66 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -25,7 +25,7 @@ journeys tested on that device. ## Install from the publisher -The installer looks up signed releases for Linux x86_64/aarch64 and macOS Apple silicon. Intel Mac and other OS families fail closed. The signed release determines which binaries exist for a given platform. +The installer looks up signed releases for Linux x86_64/aarch64 and macOS Apple silicon. Other OS families fail closed. For an Intel Mac, see [Intel Mac](MAC.md#intel-mac). The signed release determines which binaries exist for a given platform. This checkout's installer combines installation, Home setup, and launch into one command: diff --git a/docs/LAUNCHER_CONTRACT.md b/docs/LAUNCHER_CONTRACT.md index b079a7c1c..ab2e25f6c 100644 --- a/docs/LAUNCHER_CONTRACT.md +++ b/docs/LAUNCHER_CONTRACT.md @@ -74,5 +74,5 @@ A supervisor uses these exit codes. It does not parse English sentences from stdout. Exit 0 covers more than one successful update outcome. A later issue owns a machine-readable update status. -Intel Mac's release id is `x86_64-darwin`. This contract does not publish a -download for that id. +This contract publishes no download for an Intel Mac. [Intel Mac](MAC.md#intel-mac) +records the current state. diff --git a/docs/MAC.md b/docs/MAC.md index ac1796554..e3df89d42 100644 --- a/docs/MAC.md +++ b/docs/MAC.md @@ -6,6 +6,9 @@ artifacts, and `.dmg` packaging work. ## Intel Mac +This section is the one record of Intel Mac support. Other documents link +here instead of repeating it. + The public release id for an Intel Mac is `x86_64-darwin`. `scripts/install.sh` stops on that host before a download lookup. The message is `macOS release lookup requires Apple silicon`. @@ -15,12 +18,20 @@ installer on an Apple silicon Mac. The source-home commands later in this runbook are a developer build. They are not the installer, and this note does not claim that build has passed on Intel. -The signed platform set is `SIGNED_RELEASE_PLATFORMS` in -`scripts/release-signer.py`. `scripts/release-platforms.json` maps the package -key `darwin-amd64` to `x86_64-darwin`. That id is outside the signed set. -`scripts/package-release-binaries.sh --print-platform` prints `darwin-amd64` -on Darwin x86_64 and writes nothing. The packaging path refuses to write a -tarball for that key, including when a Rosetta shell reports `x86_64`. +These files hold the rules: + +- Signing: the release platform allowlist in `scripts/release-signer.py`. + `x86_64-darwin` is not in it. `scripts/release-signer-test.py` runs the + signer with `python -O` on an `x86_64-darwin` input and requires the + refusal. +- Package name: `scripts/release-platforms.json` maps the package key + `darwin-amd64` to `x86_64-darwin`. +- Packaging: `scripts/package-release-binaries.sh`. `--print-platform` prints + `darwin-amd64` only when `sysctl` shows Intel hardware. It stops in a + Rosetta shell on Apple silicon and when `sysctl` is missing or unclear. + Packaging writes no `darwin-amd64` tarball. For the other keys, it stops + on a binary that does not match the key, which includes a universal binary. +- Install: the platform check in `scripts/install.sh`. CI job `gateway-smoke-macos-intel` builds the native `elastos` binary on `macos-15-intel`. It requires `GET /healthz` to return HTTP 200 and the two