From e4c4a852d04145dc117b71027ba184067ebef200 Mon Sep 17 00:00:00 2001 From: cflmy Date: Sun, 22 Nov 2026 22:10:34 +0800 Subject: [PATCH] Require complete same-SHA evidence for Linux RC and stable releases --- docs/releasing.md | 35 +++++++-- tools/ci/release_evidence.py | 88 +++++++++------------ tools/ci/test_release_evidence.py | 126 ++++++++++++++++-------------- 3 files changed, 138 insertions(+), 111 deletions(-) diff --git a/docs/releasing.md b/docs/releasing.md index f3cfb72..730404e 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -4,12 +4,16 @@ This document is the release-candidate procedure. It does **not** grant permission to tag or publish: a tag requires the gates below to be green on the exact commit and an explicit maintainer sign-off recorded in the release notes. -Two profiles are deliberately separate (see +Three profiles apply (see [`MARQDO_3_0_PRERELEASE_PLAN.md`](MARQDO_3_0_PRERELEASE_PLAN.md) §3): * **beta** — a prerelease (`-beta.N`) on the platform(s) the project can really test and fix. Known non-security gaps are allowed only when explicitly recorded. `3.0.0-beta.1` claims **Linux x86_64 (glibc)** only. +* **rc** — `-rc.N`. The current target is Linux x86_64 (glibc). + Record Windows and macOS as UNSUPPORTED for this scope. Require same-SHA + Linux CI, frozen extensions, clean install, version compatibility, strict + VM and fixed-node performance PASS. * **stable** — `3.0.0`/LTS. Not covered by beta exceptions; see [`STABLE_RELEASE_IMPLEMENTATION.md`](STABLE_RELEASE_IMPLEMENTATION.md) (historical roadmap input) and the public support matrix. @@ -64,6 +68,24 @@ JIT and built-in Knowledge/Proof/View are **not** beta gates; they are listed as unsupported/experimental in [`developers/release-limits.md`](developers/release-limits.md). +### Linux RC preconditions + +Use the frozen-SHA build and archive checks above. Additionally: + +- Strict L1 requires a same-SHA PASS on a disposable VM as a non-root user. + Record the strict evidence and verify the archived binary on that guest. +- Measure the packaged CLI on a dedicated fixed node with 5 warmups and + 20 samples or more for each of the nine workloads. Compare against a + correctness-verified baseline on the same node, CPU affinity, governor, + kernel and toolchain. Record investigation and resolution for any p50 + increase of at least 15% or median peak RSS increase of at least 20%. + Shared-host or unapproved measurements do not satisfy the RC gate. +- Version compatibility covers the locked Rust minimum, CLI and Analysis + product identity, Tool/project prerelease ranges, and beta migration. +- Use Ubuntu 24.04 (glibc 2.39) for the independent archive-only runtime + check. Task/Channel, Resource Control and native macOS/Windows remain + outside this candidate's support scope. + ## 2. Build and local gate ```bash @@ -172,8 +194,11 @@ python3 tools/ci/release_evidence.py --profile beta --target-sha "$sha" \ `BETA_RELEASE_CANDIDATE` is the only acceptable decision for a beta tag. A missing, skipped, failed or SHA-mismatched gate is `DO_NOT_RELEASE`; never -hand-edit a manifest to PASS. Stable releases use the default `--profile -stable` and additionally require Windows/macOS PASS and a strict PASS. +hand-edit a manifest to PASS. For a Linux RC, replace the profile with `--profile rc --require-release`, +declare both excluded platforms, and supply PASS for all six Linux and contract gates. Use the generated +`RC_RELEASE_CANDIDATE` decision before running the tagging commands. +Stable releases use `--profile stable --require-release` and require native +Windows and macOS PASS in addition to the Linux and contract gates. ## 6. Tagging and publication (owner approval required) @@ -189,10 +214,10 @@ git push origin "v${version}" Then create the Gitea release for the tag with `prerelease: true`, attach the tarball and its `.sha256`, and include the release notes. The notes must state: -* beta / non-LTS status and the Linux x86_64-only support claim; +* prerelease status, support lifetime and the Linux x86_64 platform scope; * the breaking RFC-LANG-0002 language change and no legacy path; * the strict policy (same-SHA evidence, or `strict: unsupported` fail-closed); -* the G4 Beta-only WARN environment and limits when applicable; +* the G4 result and its fixed-node comparison, or the documented exception for beta; * independently versioned protocols and stdlib/package versions; * the checksum-integrity-not-signature caveat and the known-limitations file; * the exact source SHA and links to the evidence manifest. diff --git a/tools/ci/release_evidence.py b/tools/ci/release_evidence.py index 64e0276..382c15f 100755 --- a/tools/ci/release_evidence.py +++ b/tools/ci/release_evidence.py @@ -5,16 +5,11 @@ Schema: `marqdo.release-gates.v1`. A missing, skipped, timed-out, failed or SHA-mismatched gate is never PASS. The tool only records supplied facts; it does not query CI and cannot turn an UNVERIFIED gate into a release. -Two profiles exist and both are explicit in the output: - -* `stable` — every required platform gate must PASS on the target SHA. -* `beta` — the supported platform set is the one declared in - `COMPATIBILITY.md` (Linux x86_64 for `3.0.0-beta.1`). `windows`/`macos` must - be explicitly `UNSUPPORTED` (not silently omitted). `strict_vm` may be PASS - with same-SHA disposable-VM evidence, or `UNSUPPORTED` when the tested policy - is an explicit fail-closed refusal; `extension`, `clean_install` and - `version_compat` must PASS. `performance` may be `WARN` only in beta and is - recorded with its reason. +The `rc` profile requires every gate on the target SHA. For a Linux-only RC, +Windows and macOS must be explicitly UNSUPPORTED; the stable profile requires +both to PASS. Strict VM, extension, clean install, version compatibility and +performance all require PASS in both profiles. The historical beta profile +retains its scoped exceptions, including a documented performance WARN. Gate spec: `name=STATE:tested_sha:run_url` (url may contain colons). @@ -29,7 +24,7 @@ Usage: --gate windows=UNSUPPORTED:$SHA:supported-platforms-exclude \ --gate macos=UNSUPPORTED:$SHA:supported-platforms-exclude \ --gate performance=WARN:$SHA:docs/evidence/... \ - --out/docs/evidence/ci/$SHA/manifest.json + --out docs/evidence/ci/$SHA/manifest.json """ import argparse @@ -40,22 +35,6 @@ import sys from pathlib import Path SCHEMA = "marqdo.release-gates.v1" -PROFILES = { - "stable": { - "required": ("linux", "windows", "macos", "strict_vm"), - "optional": ("performance",), - "windows_macos_unsupported_allowed": False, - "strict_unsupported_allowed": False, - "decision": "RELEASE_CANDIDATE", - }, - "beta": { - "required": ("linux", "strict_vm", "extension", "clean_install", "version_compat"), - "optional": ("windows", "macos", "performance"), - "windows_macos_unsupported_allowed": True, - "strict_unsupported_allowed": True, - "decision": "BETA_RELEASE_CANDIDATE", - }, -} GATES = ( "linux", "windows", @@ -66,6 +45,22 @@ GATES = ( "version_compat", "performance", ) +RC_PLATFORM_STATES = {"windows": {"UNSUPPORTED"}, "macos": {"UNSUPPORTED"}} +BETA_OPTIONAL = ("windows", "macos", "performance") +PROFILES = { + "stable": ("RELEASE_CANDIDATE", {}, ()), + "rc": ("RC_RELEASE_CANDIDATE", RC_PLATFORM_STATES, ()), + "beta": ( + "BETA_RELEASE_CANDIDATE", + { + "windows": {"PASS", "UNSUPPORTED"}, + "macos": {"PASS", "UNSUPPORTED"}, + "strict_vm": {"PASS", "UNSUPPORTED"}, + "performance": {"PASS", "WARN"}, + }, + BETA_OPTIONAL, + ), +} STATES = { "linux": {"PASS", "FAIL", "UNVERIFIED"}, "windows": {"PASS", "FAIL", "UNVERIFIED", "UNSUPPORTED"}, @@ -109,7 +104,7 @@ def build_manifest(target_sha: str, gates: list[str], profile: str = "stable") - if not SHA_RE.fullmatch(target_sha): raise ValueError(f"target SHA must be 40 lowercase hex characters: {target_sha!r}") try: - rules = PROFILES[profile] + release_decision, accepted_states, optional = PROFILES[profile] except KeyError: raise ValueError(f"unknown profile {profile!r}; expected {sorted(PROFILES)}") from None parsed = {} @@ -120,11 +115,11 @@ def build_manifest(target_sha: str, gates: list[str], profile: str = "stable") - parsed[name] = gate reasons = [] - for name in rules["required"] + rules["optional"]: + for name in GATES: gate = parsed.get(name) if gate is None: parsed[name] = {"state": "UNVERIFIED", "tested_sha": "", "run_url": ""} - if name in rules["required"]: + if name not in optional: reasons.append(f"{name}: missing gate") continue if gate["tested_sha"] != target_sha: @@ -132,25 +127,15 @@ def build_manifest(target_sha: str, gates: list[str], profile: str = "stable") - f"{name}: tested_sha {gate['tested_sha'] or '(missing)'} != target_sha {target_sha}" ) continue - if gate["state"] == "FAIL": - reasons.append(f"{name}: FAIL") - elif gate["state"] == "UNVERIFIED": - reasons.append(f"{name}: UNVERIFIED") - elif gate["state"] == "UNSUPPORTED": - allowed = False - if name in {"windows", "macos"}: - allowed = rules["windows_macos_unsupported_allowed"] - elif name == "strict_vm": - allowed = rules["strict_unsupported_allowed"] - if not allowed: - reasons.append(f"{name}: UNSUPPORTED is not allowed in the {profile} profile") - elif name == "performance": - if gate["state"] not in {"PASS", "WARN"}: - reasons.append(f"{name}: {gate['state']} is not PASS/WARN") - elif gate["state"] != "PASS": - reasons.append(f"{name}: {gate['state']} is not PASS") + allowed = accepted_states.get(name, {"PASS"}) + if gate["state"] not in allowed: + reasons.append( + f"{name}: {gate['state']} is not accepted; expected {' or '.join(sorted(allowed))}" + ) + elif not gate["run_url"].strip(): + reasons.append(f"{name}: missing evidence reference") - decision = rules["decision"] if not reasons else "DO_NOT_RELEASE" + decision = release_decision if not reasons else "DO_NOT_RELEASE" recorded = utc_now() return { "schema": SCHEMA, @@ -175,6 +160,11 @@ def main(argv: list[str]) -> int: parser.add_argument("--profile", choices=sorted(PROFILES), default="stable") parser.add_argument("--gate", action="append", default=[]) parser.add_argument("--out", default="") + parser.add_argument( + "--require-release", + action="store_true", + help="exit 1 when the recorded decision blocks publication", + ) args = parser.parse_args(argv) try: manifest = build_manifest(args.target_sha, args.gate, args.profile) @@ -187,7 +177,7 @@ def main(argv: list[str]) -> int: out.parent.mkdir(parents=True, exist_ok=True) out.write_text(text) sys.stdout.write(text) - return 0 + return int(args.require_release and manifest["release_decision"] == "DO_NOT_RELEASE") if __name__ == "__main__": diff --git a/tools/ci/test_release_evidence.py b/tools/ci/test_release_evidence.py index cf695ce..84f84c4 100644 --- a/tools/ci/test_release_evidence.py +++ b/tools/ci/test_release_evidence.py @@ -1,5 +1,8 @@ import importlib.util +import io +import json import unittest +from contextlib import redirect_stdout from pathlib import Path MODULE = Path(__file__).with_name("release_evidence.py") @@ -18,70 +21,79 @@ def gate(name: str, state: str, sha: str = SHA, url: str = "https://example.test class ReleaseEvidenceTests(unittest.TestCase): def test_all_required_pass_is_candidate(self) -> None: manifest = release_evidence.build_manifest( - SHA, - [ - gate("linux", "PASS"), - gate("windows", "PASS"), - gate("macos", "PASS"), - gate("strict_vm", "PASS"), - gate("performance", "WARN"), - ], + SHA, [gate(name, "PASS") for name in release_evidence.GATES] ) self.assertEqual(manifest["release_decision"], "RELEASE_CANDIDATE") self.assertEqual(manifest["reasons"], []) - def test_missing_strict_vm_is_not_release(self) -> None: - manifest = release_evidence.build_manifest( - SHA, - [ - gate("linux", "PASS"), - gate("windows", "PASS"), - gate("macos", "PASS"), - gate("performance", "PASS"), - ], - ) - self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") - self.assertTrue(any("strict_vm" in reason for reason in manifest["reasons"])) + def test_complete_linux_rc_is_candidate(self) -> None: + manifest = release_evidence.build_manifest(SHA, self.rc_gates(), profile="rc") + self.assertEqual(manifest["release_decision"], "RC_RELEASE_CANDIDATE") + self.assertEqual(manifest["reasons"], []) - def test_sha_mismatch_is_not_release(self) -> None: - manifest = release_evidence.build_manifest( - SHA, - [ - gate("linux", "PASS"), - gate("windows", "PASS", OTHER), - gate("macos", "PASS"), - gate("strict_vm", "PASS"), - gate("performance", "PASS"), - ], - ) - self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") - self.assertTrue(any("windows" in reason for reason in manifest["reasons"])) + @staticmethod + def rc_gates() -> list[str]: + return [ + gate(name, "UNSUPPORTED" if name in {"windows", "macos"} else "PASS") + for name in release_evidence.GATES + ] - def test_failure_is_not_release(self) -> None: - manifest = release_evidence.build_manifest( - SHA, - [ - gate("linux", "FAIL"), - gate("windows", "PASS"), - gate("macos", "PASS"), - gate("strict_vm", "PASS"), - gate("performance", "PASS"), - ], - ) - self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") + def test_rc_requires_same_sha_evidence_for_every_gate(self) -> None: + for original in self.rc_gates(): + name, details = original.split("=", 1) + state = details.split(":", 1)[0] + for replacement, reason in [ + ([], "missing gate"), + ([gate(name, state, OTHER)], "!= target_sha"), + ([gate(name, state, url="")], "missing evidence reference"), + ([gate(name, "FAIL")], "FAIL"), + ([gate(name, "UNVERIFIED")], "UNVERIFIED"), + ]: + with self.subTest(gate=name, reason=reason): + inputs = [spec for spec in self.rc_gates() if spec != original] + manifest = release_evidence.build_manifest( + SHA, inputs + replacement, profile="rc" + ) + self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") + self.assertEqual(len(manifest["reasons"]), 1) + self.assertIn(reason, manifest["reasons"][0]) - def test_unverified_performance_is_not_release(self) -> None: - manifest = release_evidence.build_manifest( - SHA, - [ - gate("linux", "PASS"), - gate("windows", "PASS"), - gate("macos", "PASS"), - gate("strict_vm", "PASS"), - gate("performance", "UNVERIFIED"), - ], - ) + def test_rc_rejects_beta_exceptions_and_platform_scope_changes(self) -> None: + for name, state in [ + ("strict_vm", "UNSUPPORTED"), + ("performance", "WARN"), + ("windows", "PASS"), + ("macos", "PASS"), + ]: + with self.subTest(gate=name, state=state): + inputs = [spec for spec in self.rc_gates() if not spec.startswith(f"{name}=")] + manifest = release_evidence.build_manifest( + SHA, inputs + [gate(name, state)], profile="rc" + ) + self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") + self.assertTrue(manifest["reasons"][0].startswith(f"{name}:")) + + def test_stable_requires_extension_install_version_and_performance(self) -> None: + names = ("extension", "clean_install", "version_compat", "performance") + for name in names: + with self.subTest(gate=name): + inputs = [gate(key, "PASS") for key in release_evidence.GATES if key != name] + manifest = release_evidence.build_manifest(SHA, inputs) + self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") + self.assertEqual(manifest["reasons"], [f"{name}: missing gate"]) + inputs = [gate(key, "WARN" if key == "performance" else "PASS") for key in release_evidence.GATES] + manifest = release_evidence.build_manifest(SHA, inputs) self.assertEqual(manifest["release_decision"], "DO_NOT_RELEASE") + self.assertIn("performance: WARN", manifest["reasons"][0]) + + def test_require_release_returns_failure_and_preserves_manifest(self) -> None: + output = io.StringIO() + with redirect_stdout(output): + status = release_evidence.main( + ["--target-sha", SHA, "--profile", "rc", "--require-release"] + ) + self.assertEqual(status, 1) + self.assertEqual(json.loads(output.getvalue())["release_decision"], "DO_NOT_RELEASE") def test_beta_profile_accepts_declared_linux_scope_with_warn_performance(self) -> None: manifest = release_evidence.build_manifest( @@ -119,7 +131,7 @@ class ReleaseEvidenceTests(unittest.TestCase): ) self.assertEqual(manifest["release_decision"], "BETA_RELEASE_CANDIDATE") - def test_beta_profile_requires_explicit_platform_and_extension_gates(self) -> None: + def test_beta_profile_requires_extension_but_retains_optional_platforms(self) -> None: manifest = release_evidence.build_manifest( SHA, [