Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(release): repair publication pipeline and official supplier (#1998)
Call White1b191200ce08
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex 21b304e42..557cbf87a 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -320,6 +320,10 @@ jobs:- name: Install build and test dependenciesrun: pip install -e . build pytest+ - name: Install pinned uv+ run: |+ python -m pip install --disable-pip-version-check --only-binary=:all: --no-deps uv==0.12.10+- name: Build Python distributionsrun: |python -m build --outdir dist packaging/avibe-memory@@ -629,6 +633,12 @@ jobs:needs:- resolve-tag- build+ # Latest is repository-wide: serialize its read/decide/edit across tags+ # and push/dispatch runs, without cancelling another queued publication.+ concurrency:+ group: avibe-official-release-finalization+ cancel-in-progress: false+ queue: maxruns-on: ubuntu-latestpermissions:actions: read@@ -659,11 +669,9 @@ jobs:GH_TOKEN: ${{ github.token }}shell: bashrun: |- LATEST_MODE="preserve"+ LATEST_MODE="auto"if [ "${{ needs.resolve-tag.outputs.prerelease }}" = "true" ]; thenLATEST_MODE="false"- elif [ "${{ github.event_name }}" = "push" ]; then- LATEST_MODE="true"fipython scripts/github_release.py finalize \diff --git a/.github/workflows/release_ai.yml b/.github/workflows/release_ai.ymlindex 021059d05..03b0b9aad 100644--- a/.github/workflows/release_ai.yml+++ b/.github/workflows/release_ai.yml@@ -28,6 +28,7 @@ permissions:jobs:resolve-show-runtime-ref:+ if: startsWith(github.event.inputs.tag || github.ref_name, 'gh-v')runs-on: ubuntu-latestoutputs:ref: ${{ steps.ref.outputs.ref }}@@ -109,6 +110,7 @@ jobs:show-router-${{ matrix.artifact }}.tsxmemory-runtime-bundles:+ if: startsWith(github.event.inputs.tag || github.ref_name, 'gh-v')runs-on: ${{ matrix.os }}strategy:matrix:@@ -342,6 +344,11 @@ jobs:release:needs: build-assets+ # Official assets belong to publish.yml; only previews require this build.+ if: >-+ ${{ !cancelled() && (needs.build-assets.result == 'success' ||+ (needs.build-assets.result == 'skipped' &&+ !startsWith(github.event.inputs.tag || github.ref_name, 'gh-v'))) }}runs-on: ubuntu-lateststeps:- name: Checkoutdiff --git a/docs/plans/release-pipeline-recovery.md b/docs/plans/release-pipeline-recovery.mdnew file mode 100644index 000000000..9f884b4cc--- /dev/null+++ b/docs/plans/release-pipeline-recovery.md@@ -0,0 +1,88 @@+# Release pipeline recovery++## Evidence and contract++The first repaired v3.1.0 push built every Show/Memory platform successfully,+but the official publish build job failed one of 321 installer regressions:+the real uv provenance test had no uv executable. PR CI supplied the tool;+the release consumer did not. Upload and PyPI jobs never ran. The notes+workflow separately rebuilt all assets although official publication never+consumed those artifacts.++Meanwhile, local/CI wheel preparation treated the repository-wide GitHub+Latest release as an Avibe release. After the incomplete v3.1.0 was withdrawn,+Latest named an engine release without a Show manifest. This also blocks a+workflow repair PR before it can safely restore publication.++The owner approved directed recovery of existing v3.1.0 on September 16, 2026,+and requested a complete audit of these connected release boundaries.+The product tag/source remains fixed; repaired automation is reviewed and+merged separately before explicitly targeting that tag.++## Smallest complete repair++- Supply the existing CI-pinned uv in the official release regression job.+- Build official artifacts only in Publish to PyPI. AI Notes skips its build+ chain for official tags, but preserves the complete GitHub-only preview+ path. A failed/cancelled preview build must never publish.+- Reuse the canonical tag producer to identify/order stable official Avibe+ releases. Paginate before choosing the newest official supplier; ignore+ unrelated engine releases, drafts, and prereleases. Select first, validate+ second: never silently fall back from a corrupt newest official release.+- Let the existing finalizer select Latest for stable official publication,+ including recovery dispatches, without displacing a newer official version.+ Preserve explicit false/preserve modes and all read-back checks.+- Serialize the complete official finalization job with one static,+ repository-wide concurrency group. Queue pending finalizers without cancelling+ the active one, so concurrent push/recovery drafts cannot both make a stale+ Latest decision. Keep builds and notes parallel.++No runtime code, new production dependency, asset overwrite bypass, test skip,+native engine, production configuration, installation, or service change.+No broad workflow rewrite or new publication mechanism: existing official+build/finalization and exact-source notes ownership remains authoritative.++## Acceptance++- Test actual workflow dependency order and official/preview job conditions.+- Exercise supplier pagination, version ordering, engine/draft/prerelease+ exclusions, explicit tags, invalid newest assets and byte-digest rejection.+- Exercise finalizer decisions against a newer official release and unrelated+ Latest, including exact remote command/read-back behavior.+- Exercise every admitted order of initially draft official releases, and bind+ the workflow's comparison/edit/readback to one shared job concurrency group+ with non-cancelling `queue: max` admission.+- Retain package, all-platform/Windows shell, runtime guard, real pip/uv and+ Docker installer, notes/source, immutable upload, and public companion gates.+- Run focused consuming tests and changed-file Ruff, then exact-head Codex+ review, all lint jobs and zero unresolved threads before merging.+- Only then dispatch each official workflow once at one fixed automation+ revision, targeting existing v3.1.0/source bb70e063. Independently verify all+ resulting public assets and core PyPI bytes; Memory stays GitHub-only.++Historical failed runs and old release backups are evidence, not gates to+erase. Publication cannot be reported complete from workflow success alone.++## Local validation evidence++- Release/version/supplier/finalizer/workflow consumers: initially 340 passed;+ 347 passed after adding cross-version finalization admission coverage, zero+ skips. The new workflow concurrency test failed before the fix. Actual+ finalizers retain the highest version in all six orders of three drafts.+- Native runtime and migration release guards: 698 passed, zero skips.+- Actual pip and workflow-pinned uv 0.12.10 HTTPS provenance: 2 passed+ (28 unrelated cases explicitly deselected).+- A real two-page release inventory selected official v3.0.14 despite the+ engine Latest release. Its public six-platform manifest bytes passed the+ actual repository/tag/digest validator. API reads used the existing opaque+ GitHub client; the manifest itself was fetched anonymously over HTTPS.+- Fresh core and Memory 3.1.0 sdists and wheels built in isolated environments,+ including wheels rebuilt from those sdists. Core's newly shared build helper+ therefore works outside the source checkout.+- Artifact-bound distribution matrix: 36 passed, zero skips, including actual+ wheel/sdist installation, resolver behavior, exact peer metadata, and builtin+ skill packaging. No package-contract version override was used.+- All seven changed Python files pass Ruff 0.4.9; whitespace checks pass.+- Local UI bytes are accepted rc11 fixtures, not future assets. No runtime+ archives were prepared or executed. Actual Docker and complete current-head+ CI/review remain external gates; no local Docker pass is claimed.diff --git a/pyproject.toml b/pyproject.tomlindex 400eb5b07..a88fb415a 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -133,6 +133,7 @@ include = ["main.py","scripts/prepare_local_show_runtime_manifest.py","scripts/show_runtime_manifest_asset.py",+ "scripts/release_package_version.py","ui/dist/**","vibe/show_runtime_manifest.json","vibe/tmux_runtime_manifest.json",diff --git a/scripts/github_release.py b/scripts/github_release.pyindex e67d79f76..9e1ae599c 100644--- a/scripts/github_release.py+++ b/scripts/github_release.py@@ -18,9 +18,12 @@ from urllib.parse import quoteNOTES_READY_MARKER_PREFIX = "<!-- avibe:release-notes=ready source="_SHA_RE = re.compile(r"[0-9a-f]{40}")-package_version_from_release_tag = run_path(+_version_helpers = run_path(str(Path(__file__).with_name("release_package_version.py"))-)["package_version_from_release_tag"]+)+package_version_from_release_tag = _version_helpers["package_version_from_release_tag"]+official_stable_version_key = _version_helpers["official_stable_version_key"]+latest_official_release = _version_helpers["latest_official_release"]class ReleaseError(RuntimeError):@@ -290,6 +293,20 @@ def finalize_release(_validate_publication_tag(tag)if get_release(repo, tag) is None:raise ReleaseError(f"Cannot finalize missing GitHub Release {tag}")+ if latest == "auto":+ key = official_stable_version_key(tag)+ if prerelease or key is None:+ latest = "false"+ else:+ completed = _run_gh(["api", "--paginate", "--slurp", f"repos/{repo}/releases?per_page=100"])+ try:+ pages = json.loads(completed.stdout)+ if not isinstance(pages, list) or any(not isinstance(page, list) for page in pages):+ raise ValueError("GitHub returned an invalid paginated release collection")+ newest = latest_official_release(release for page in pages for release in page)+ except ValueError as exc:+ raise ReleaseError(f"Cannot select latest official release: {exc}") from exc+ latest = "true" if newest is None or official_stable_version_key(newest["tag_name"]) <= key else "false"arguments = ["release",@@ -376,7 +393,7 @@ def _parser() -> argparse.ArgumentParser:finalize.add_argument("--repo", required=True)finalize.add_argument("--tag", required=True)finalize.add_argument("--prerelease", choices=("true", "false"), required=True)- finalize.add_argument("--latest", choices=("true", "false", "preserve"), required=True)+ finalize.add_argument("--latest", choices=("auto", "true", "false", "preserve"), required=True)return parserdiff --git a/scripts/release_package_version.py b/scripts/release_package_version.pyindex 36f24f118..5a8950c41 100644--- a/scripts/release_package_version.py+++ b/scripts/release_package_version.py@@ -5,7 +5,8 @@ from __future__ import annotationsimport argparseimport re-from collections.abc import Sequence+from collections.abc import Iterable, Sequence+from typing import Any_VERSION_PATTERN = re.compile(@@ -45,6 +46,43 @@ def package_version_from_release_tag(tag: str) -> str:return result+def official_stable_version_key(tag: object) -> tuple[int, int, int, int] | None:+ """Order canonical stable official versions, excluding preview/engine tags."""+ if not isinstance(tag, str) or not tag.startswith("v"):+ return None+ try:+ version = package_version_from_release_tag(tag)+ except ValueError:+ return None+ if tag != f"v{version}":+ return None+ match = _VERSION_PATTERN.fullmatch(version)+ if match is None or match["phase"] is not None:+ return None+ major, minor, patch = (int(part) for part in match["release"].split("."))+ post = int(match["post_number"]) if match["post_number"] is not None else -1+ return major, minor, patch, post+++def latest_official_release(releases: Iterable[Any]) -> dict[str, Any] | None:+ """Select by version, not repository-wide Latest or publication timestamp."""+ selected = None+ selected_key = None+ for release in releases:+ if not isinstance(release, dict):+ raise ValueError("GitHub release collection must contain objects")+ key = official_stable_version_key(release.get("tag_name"))+ if key is None:+ continue+ if not isinstance(release.get("draft"), bool) or not isinstance(release.get("prerelease"), bool):+ raise ValueError("Official release is missing draft/prerelease state")+ if release["draft"] or release["prerelease"]:+ continue+ if selected_key is None or key > selected_key:+ selected, selected_key = release, key+ return selected++def main(argv: Sequence[str] | None = None) -> int:parser = argparse.ArgumentParser(description=__doc__)parser.add_argument("tag", help="Release tag, for example gh-v3.0.10rc1")diff --git a/scripts/show_runtime_manifest_asset.py b/scripts/show_runtime_manifest_asset.pyindex 92ec66373..8a3212b49 100644--- a/scripts/show_runtime_manifest_asset.py+++ b/scripts/show_runtime_manifest_asset.py@@ -7,6 +7,7 @@ import reimport urllib.parseimport urllib.requestfrom pathlib import Path+from runpy import run_pathfrom typing import Any, Callable@@ -25,6 +26,9 @@ _COMMIT_RE = re.compile(r"[0-9a-f]{40}")_SHA256_RE = re.compile(r"[0-9a-f]{64}")_NODE_REQUIREMENT_CLAUSE_RE = re.compile(r"(?:\^|>=)?\d+\.\d+\.\d+")UrlOpener = Callable[..., Any]+latest_official_release = run_path(+ str(Path(__file__).with_name("release_package_version.py"))+)["latest_official_release"]def validate_manifest_bytes(content: bytes, *, release_tag: str | None = None) -> dict[str, Any]:@@ -82,11 +86,35 @@ def prepare_manifest(release_tag: str | None = None,opener: UrlOpener = urllib.request.urlopen,) -> dict[str, Any]:- release_url = _release_api_url(release_tag)- release = _read_json(release_url, opener=opener)+ if release_tag is None:+ releases = []+ for page_number in range(1, 101):+ page = _read_json(+ f"https://api.github.com/repos/{REPOSITORY}/releases?per_page=100&page={page_number}",+ opener=opener,+ )+ if not isinstance(page, list):+ raise RuntimeError("GitHub returned an invalid release collection")+ releases.extend(page)+ if len(page) < 100:+ break+ else:+ raise RuntimeError("GitHub release pagination exceeded 100 pages")+ try:+ release = latest_official_release(releases)+ except ValueError as exc:+ raise RuntimeError(str(exc)) from exc+ if release is None:+ raise RuntimeError("No published stable official Avibe release is available")+ else:+ release = _read_json(_release_api_url(release_tag), opener=opener)+ if not isinstance(release, dict):+ raise RuntimeError("GitHub returned an invalid release payload")resolved_tag = release.get("tag_name")if not isinstance(resolved_tag, str) or not resolved_tag:raise RuntimeError("GitHub release response is missing tag_name")+ if release_tag is not None and resolved_tag != release_tag:+ raise RuntimeError(f"GitHub release response does not match requested tag {release_tag}")assets = release.get("assets")if not isinstance(assets, list):raise RuntimeError(f"GitHub release {resolved_tag} has no assets")@@ -97,7 +125,11 @@ def prepare_manifest(asset = matches[0]download_url = asset.get("browser_download_url")digest = asset.get("digest")- if not isinstance(download_url, str) or not download_url.startswith("https://github.com/"):+ expected_url = (+ f"https://github.com/{REPOSITORY}/releases/download/"+ f"{urllib.parse.quote(resolved_tag, safe='')}/{MANIFEST_ASSET_NAME}"+ )+ if download_url != expected_url:raise RuntimeError(f"GitHub release {resolved_tag} has an invalid manifest download URL")if not isinstance(digest, str) or not digest.startswith("sha256:") or not _SHA256_RE.fullmatch(digest[7:]):raise RuntimeError(f"GitHub release {resolved_tag} is missing the manifest SHA256 digest")@@ -140,21 +172,17 @@ def _validate_archive(platform: str, archive: object, *, release_tag: str | Noneraise ValueError(f"Show Runtime archive {platform} does not belong to release {release_tag}")-def _release_api_url(release_tag: str | None) -> str:+def _release_api_url(release_tag: str) -> str:base = f"https://api.github.com/repos/{REPOSITORY}/releases"- if release_tag is None:- return f"{base}/latest"return f"{base}/tags/{urllib.parse.quote(release_tag, safe='')}"-def _read_json(url: str, *, opener: UrlOpener) -> dict[str, Any]:+def _read_json(url: str, *, opener: UrlOpener) -> Any:content = _read_bytes(url, opener=opener, accept="application/vnd.github+json")try:value = json.loads(content.decode("utf-8"))except (UnicodeDecodeError, json.JSONDecodeError) as exc:raise RuntimeError(f"GitHub returned invalid JSON from {url}") from exc- if not isinstance(value, dict):- raise RuntimeError(f"GitHub returned an invalid release payload from {url}")return valuediff --git a/tests/test_github_release.py b/tests/test_github_release.pyindex 1226bab37..17fbb9091 100644--- a/tests/test_github_release.py+++ b/tests/test_github_release.py@@ -1,6 +1,7 @@from __future__ import annotationsimport json+from itertools import permutationsimport subprocessfrom pathlib import Path@@ -451,6 +452,114 @@ def test_finalize_waits_for_release_and_latest_readback(assert sleeps == [1, 1][email protected]("newer", [False, True])+def test_auto_latest_uses_all_official_versions_instead_of_engine_latest(monkeypatch, newer):+ calls = []+ selected_latest = "model-hub-engine-v7.2.149-1"+ release_reads = iter([_release_payload(draft=True), _release_payload(draft=False)])+ releases = [+ {"tag_name": selected_latest, "draft": False, "prerelease": False},+ {"tag_name": "v3.0.13", "draft": False, "prerelease": False},+ {"tag_name": "v99.0.0", "draft": True, "prerelease": False},+ {"tag_name": "v88.0.0rc1", "draft": False, "prerelease": False},+ ]+ if newer:+ releases.append({"tag_name": "v3.1.0", "draft": False, "prerelease": False})++ def fake_run(arguments, *, check=True):+ nonlocal selected_latest+ calls.append(arguments)+ if "--paginate" in arguments:+ assert "--slurp" in arguments+ return _completed(arguments, stdout=json.dumps([releases[:2], releases[2:]]))+ if arguments[:2] == ["release", "edit"]:+ if "--latest" in arguments:+ selected_latest = TAG+ return _completed(arguments)+ if arguments[1].endswith("/releases/latest"):+ return _completed(arguments, stdout=selected_latest + "\n")+ return _completed(arguments, stdout=next(release_reads))++ monkeypatch.setattr(github_release, "_run_gh", fake_run)+ state = github_release.finalize_release(repo=REPO, tag=TAG, prerelease=False, latest="auto")+ assert not state.draft+ edit = next(call for call in calls if call[:2] == ["release", "edit"])+ assert ("--latest" in edit) is not newer+ assert ("--latest=false" in edit) is newer+ assert calls.index(edit) > next(i for i, call in enumerate(calls) if "--paginate" in call)++[email protected]("order", list(permutations(("v3.0.14", "v3.0.15", "v3.1.0"))))+def test_serialized_finalizers_keep_highest_version_for_every_admission_order(monkeypatch, order):+ # All releases start as drafts, as with overlapping push/dispatch builds.+ # The workflow concurrency contract admits one complete finalizer at a time.+ releases = {+ tag: {+ "tag_name": tag, "draft": True, "prerelease": False, "body": "notes",+ "html_url": f"https://github.com/{REPO}/releases/tag/{tag}",+ }+ for tag in order+ }+ latest = "model-hub-engine-v7.2.149-1"+ writes = []+ inventories = []++ def fake_run(arguments, *, check=True):+ nonlocal latest+ if arguments[:2] == ["release", "edit"]:+ tag = arguments[2]+ assert arguments[3:5] == ["--repo", REPO]+ assert "--draft=false" in arguments+ releases[tag]["draft"] = False+ if "--latest" in arguments:+ latest = tag+ else:+ assert "--latest=false" in arguments+ writes.append(tag)+ return _completed(arguments)+ assert arguments[0] == "api"+ if "--paginate" in arguments:+ inventories.append({tag for tag, item in releases.items() if not item["draft"]})+ return _completed(arguments, stdout=json.dumps([list(releases.values())]))+ if arguments[1].endswith("/releases/latest"):+ return _completed(arguments, stdout=latest + "\n")+ tag = arguments[1].rsplit("/", 1)[-1]+ if releases[tag]["draft"]:+ assert not check+ return _completed(arguments, returncode=1, stderr="gh: Not Found (HTTP 404)")+ return _completed(arguments, stdout=json.dumps(releases[tag]))++ monkeypatch.setattr(github_release, "_run_gh", fake_run)+ admitted = set()+ for tag in order:+ previous_reads = len(inventories)+ state = github_release.finalize_release(repo=REPO, tag=tag, prerelease=False, latest="auto")+ assert state.tag == tag and not state.draft+ # Both the draft fallback and auto-Latest decision read fresh state.+ assert inventories[previous_reads:] == [admitted, admitted]+ admitted = admitted | {tag}+ assert latest == max(admitted, key=github_release.official_stable_version_key)+ assert writes == list(order)+ assert latest == "v3.1.0"++[email protected]("payload", ["not json", "{}", "[{}]", "[[null]]",+ '[[{"tag_name":"v3.1.0"}]]'])+def test_auto_latest_does_not_publish_on_unreadable_selection(monkeypatch, payload):+ calls = []++ def fake_run(arguments, *, check=True):+ calls.append(arguments)+ if "--paginate" in arguments:+ return _completed(arguments, stdout=payload)+ return _completed(arguments, stdout=_release_payload(draft=True))++ monkeypatch.setattr(github_release, "_run_gh", fake_run)+ with pytest.raises(github_release.ReleaseError, match="Cannot select latest"):+ github_release.finalize_release(repo=REPO, tag=TAG, prerelease=False, latest="auto")+ assert not any(call[:2] == ["release", "edit"] for call in calls)++def test_release_workflows_stage_then_finalize_once() -> None:root = Path(__file__).resolve().parents[1]publish = (root / ".github/workflows/publish.yml").read_text(encoding="utf-8")@@ -488,5 +597,7 @@ def test_release_workflows_stage_then_finalize_once() -> None:assert "python scripts/github_release.py finalize" not in official_stepassert github_release.NOTES_READY_MARKER_PREFIX in notesassert "run=${GITHUB_RUN_ID}" in notes+ assert 'LATEST_MODE="auto"' in publish+ assert 'elif [ "${{ github.event_name }}" = "push" ]' not in publishassert "<!-- avibe:update-notification=none -->" in notesassert "<!-- vibe-remote:update-notification=none -->" in notesdiff --git a/tests/test_release_package_version.py b/tests/test_release_package_version.pyindex 010406a34..d655563cb 100644--- a/tests/test_release_package_version.py+++ b/tests/test_release_package_version.py@@ -5,7 +5,11 @@ from pathlib import Pathimport pytestfrom packaging.version import Version-from scripts.release_package_version import package_version_from_release_tag+from scripts.release_package_version import (+ latest_official_release,+ official_stable_version_key,+ package_version_from_release_tag,+)@pytest.mark.parametrize(@@ -64,3 +68,38 @@ def test_package_release_workflows_pin_scm_version_to_release_tag() -> None:assert "SETUPTOOLS_SCM_PRETEND_VERSION=$PACKAGE_VERSION" in workflowassert "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AVIBE_OS=$PACKAGE_VERSION" in workflowassert "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AVIBE_MEMORY=$PACKAGE_VERSION" in workflow++[email protected]("tag", [+ None, 310, "", "model-hub-engine-v7.2.149-1", "gh-v3.1.0",+ "v3.2.0rc1", "v3.2.0.dev1", "v3.2.0a1.post2", "v03.01.00",+ "v3.1.0+local", "v3.1.0 ", " v3.1.0",+])+def test_only_canonical_official_stable_versions_can_be_latest(tag):+ assert official_stable_version_key(tag) is None+++def test_stable_release_order_matches_package_version_order():+ tags = ["v3.0.9", "v3.0.10", "v3.1.0", "v3.1.0.post0", "v3.1.0.post2", "v4.0.0"]+ assert sorted(reversed(tags), key=official_stable_version_key) == sorted(+ tags, key=lambda tag: Version(tag[1:]),+ )+++def test_latest_official_release_ignores_repository_latest_and_publication_order():+ tags = ["v3.1.0.post1", "v3.1.0", "v3.0.14", "model-hub-engine-v99.0.0",+ "gh-v9.0.0", "v9.0.0rc1"]+ releases = [{"tag_name": tag, "draft": False, "prerelease": False} for tag in tags]+ releases += [+ {"tag_name": "v8.0.0", "draft": True, "prerelease": False},+ {"tag_name": "v7.0.0", "draft": False, "prerelease": True},+ ]+ assert latest_official_release(releases) == releases[0]+ assert latest_official_release(reversed(releases)) == releases[0]+ assert latest_official_release([]) is None++[email protected]("releases", [[None], [{"tag_name": "v3.1.0"}]])+def test_latest_selection_rejects_malformed_release_evidence(releases):+ with pytest.raises(ValueError):+ latest_official_release(releases)diff --git a/tests/test_release_verification.py b/tests/test_release_verification.pyindex 8e7303f27..9093cd8a4 100644--- a/tests/test_release_verification.py+++ b/tests/test_release_verification.py@@ -317,6 +317,72 @@ def _step(job: dict, name: str) -> dict:return step+def test_official_finalization_serializes_cross_version_decision_and_publication():+ workflow = yaml.safe_load((ROOT / ".github/workflows/publish.yml").read_text())+ job = workflow["jobs"]["finalize-github-release"]+ # A literal group is shared by every tag, branch and event. Keep only the+ # critical finalization job serialized; builds must remain independent.+ assert job["concurrency"] == {+ "group": "avibe-official-release-finalization",+ "cancel-in-progress": False,+ "queue": "max",+ }+ assert "concurrency" not in workflow+ assert "concurrency" not in workflow["jobs"]["build"]+ assert "wait-notes" in _step(job, "Wait for exact-source release notes")["run"]+ finalize = _step(job, "Publish GitHub Release")["run"]+ assert 'LATEST_MODE="auto"' in finalize+ assert "python scripts/github_release.py finalize" in finalize+ assert not job.get("continue-on-error")+++def test_release_installer_job_provisions_the_same_uv_as_its_ci_consumer():+ job = _job("publish.yml", "build")+ lint = _job("lint.yml", "install-upgrade-shards")+ setup = _step(job, "Install pinned uv")+ ci_setup = _step(lint, "Install pinned uv")+ consumer = _step(job, "Run release install and upgrade regressions")+ assert setup["run"] == ci_setup["run"]+ assert "--only-binary=:all: --no-deps uv==0.12.10" in setup["run"]+ assert job["steps"].index(setup) < job["steps"].index(consumer)+ assert job["steps"].index(consumer) < job["steps"].index(_step(job, "Upload GitHub release assets"))+ assert "tests/e2e/test_upgrade_command.py" in consumer["run"]+ assert not setup.get("if") and not setup.get("continue-on-error")+ assert not consumer.get("if") and not consumer.get("continue-on-error")++[email protected]("tag", ["v3.1.0", "v3.2.0rc1", "gh-v3.2.0rc1"])[email protected]("build_result", ["success", "skipped", "failure", "cancelled"])[email protected]("cancelled", [False, True])[email protected]("event", ["push", "workflow_dispatch"])+def test_notes_skip_unused_official_build_but_never_publish_a_failed_preview(tag, build_result, cancelled, event):+ workflow = yaml.safe_load((ROOT / ".github/workflows/release_ai.yml").read_text())+ jobs = workflow["jobs"]+ preview_condition = "startsWith(github.event.inputs.tag || github.ref_name, 'gh-v')"+ for name in ("resolve-show-runtime-ref", "memory-runtime-bundles"):+ assert jobs[name]["if"] == preview_condition+ assert jobs["show-runtime-bundles"]["needs"] == "resolve-show-runtime-ref"+ assert jobs["build-assets"]["needs"] == ["show-runtime-bundles", "memory-runtime-bundles"]+ assert jobs["release"]["needs"] == "build-assets"+ # Evaluate the actual bounded job expression for both event kinds. This+ # catches skipped-needs propagation without replacing the condition itself.+ expression = jobs["release"]["if"].strip().removeprefix("${{").removesuffix("}}").strip()+ expression = expression.replace("needs.build-assets.result", "build_result")+ expression = expression.replace("github.event.inputs.tag", "input_tag").replace("github.ref_name", "ref")+ expression = expression.replace("&&", " and ").replace("||", " or ").replace("!", " not ")+ expression = " ".join(expression.split())+ result = eval(expression, {"__builtins__": {}}, {+ "build_result": build_result, "input_tag": tag if event == "workflow_dispatch" else "",+ "ref": "master" if event == "workflow_dispatch" else tag,+ "cancelled": lambda: cancelled,+ "startsWith": lambda value, prefix: value.startswith(prefix),+ })+ expected = not cancelled and (+ build_result == "success" or (build_result == "skipped" and not tag.startswith("gh-v"))+ )+ assert result == expected++@pytest.mark.parametrize(("workflow_name", "job_name", "checkout_name", "workflow_ref"), WORKFLOWS)def test_release_verification_is_workflow_owned_after_tagged_artifacts_are_built(workflow_name: str, job_name: str, checkout_name: str, workflow_ref: str,diff --git a/tests/test_show_runtime_manifest_packaging.py b/tests/test_show_runtime_manifest_packaging.pyindex 6e38f4b7d..08175250e 100644--- a/tests/test_show_runtime_manifest_packaging.py+++ b/tests/test_show_runtime_manifest_packaging.py@@ -162,3 +162,108 @@ def test_prepare_manifest_rejects_a_release_asset_digest_mismatch(tmp_path: Pathwith pytest.raises(RuntimeError, match="digest mismatch"):prepare_manifest(tmp_path / "manifest.json", release_tag=RELEASE_TAG, opener=opener)++[email protected]("newest_broken", [False, True])+def test_default_supplier_paginates_official_releases_before_validating_assets(tmp_path, newest_broken):+ content = (json.dumps(_manifest()) + "\n").encode()+ url = f"https://github.com/avibe-bot/avibe/releases/download/{RELEASE_TAG}/show-runtime-manifest.json"+ official = {+ "tag_name": RELEASE_TAG, "draft": False, "prerelease": False,+ "assets": [{"name": "show-runtime-manifest.json", "browser_download_url": url,+ "digest": "sha256:" + hashlib.sha256(content).hexdigest()}],+ }+ first = [+ {"tag_name": f"model-hub-engine-v99.0.{index}", "draft": False, "prerelease": False}+ for index in range(100)+ ]+ second = [+ official,+ {"tag_name": "v3.0.7", "draft": False, "prerelease": False, "assets": []},+ {"tag_name": "v9.0.0", "draft": True, "prerelease": False},+ {"tag_name": "v8.0.0", "draft": False, "prerelease": True},+ {"tag_name": "v7.0.0rc1", "draft": False, "prerelease": False},+ {"tag_name": "gh-v6.0.0", "draft": False, "prerelease": False},+ ]+ if newest_broken:+ second.append({"tag_name": "v4.0.0", "draft": False, "prerelease": False, "assets": []})+ requests = []++ def opener(request, timeout):+ requests.append(request.full_url)+ if request.full_url == url:+ return _Response(content)+ assert request.full_url.startswith("https://api.github.com/repos/avibe-bot/avibe/releases?")+ assert "/latest" not in request.full_url+ if request.full_url.endswith("&page=1"):+ return _Response(json.dumps(first).encode())+ assert request.full_url.endswith("&page=2")+ return _Response(json.dumps(second).encode())++ output = tmp_path / "manifest.json"+ if newest_broken:+ output.write_bytes(b"previous verified manifest")+ with pytest.raises(RuntimeError, match="v4.0.0 must contain exactly one"):+ prepare_manifest(output, opener=opener)+ assert output.read_bytes() == b"previous verified manifest"+ assert requests == [+ f"https://api.github.com/repos/avibe-bot/avibe/releases?per_page=100&page={page}"+ for page in (1, 2)+ ]+ else:+ assert prepare_manifest(output, opener=opener)["runtime_version"] == RUNTIME_VERSION+ assert output.read_bytes() == content+ assert len(requests) == 3++[email protected]("payload", [[], {}, [None], [{"tag_name": "v3.1.0"}]])+def test_default_supplier_fails_closed_without_complete_release_evidence(tmp_path, payload):+ output = tmp_path / "manifest.json"+ with pytest.raises(RuntimeError):+ prepare_manifest(output, opener=lambda *args, **kwargs: _Response(json.dumps(payload).encode()))+ assert not output.exists()++[email protected]("mismatch", ["tag", "repository", "asset-tag"])+def test_explicit_supplier_cannot_redirect_manifest_identity(tmp_path, mismatch):+ content = json.dumps(_manifest()).encode()+ tag = "v3.0.9" if mismatch == "tag" else RELEASE_TAG+ repo = "other/repo" if mismatch == "repository" else "avibe-bot/avibe"+ asset_tag = "v3.0.9" if mismatch == "asset-tag" else RELEASE_TAG+ payload = {+ "tag_name": tag,+ "assets": [{"name": "show-runtime-manifest.json",+ "browser_download_url": f"https://github.com/{repo}/releases/download/{asset_tag}/show-runtime-manifest.json",+ "digest": "sha256:" + hashlib.sha256(content).hexdigest()}],+ }+ requests = []++ def opener(request, timeout):+ requests.append(request.full_url)+ assert "/releases/tags/" in request.full_url+ return _Response(json.dumps(payload).encode())++ with pytest.raises(RuntimeError, match="requested tag|invalid manifest download URL"):+ prepare_manifest(tmp_path / "manifest.json", release_tag=RELEASE_TAG, opener=opener)+ assert len(requests) == 1+++def test_manifest_build_helpers_are_in_the_sdist_contract(tmp_path):+ import runpy+ import shutil+ if sys.version_info >= (3, 11):+ import tomllib+ else:+ import tomli as tomllib++ repository = Path(__file__).resolve().parents[1]+ config = tomllib.loads((repository / "pyproject.toml").read_text())+ included = config["tool"]["hatch"]["build"]["targets"]["sdist"]["include"]+ # Recreate the actual explicitly shipped helper set away from this checkout.+ for name in included:+ if name.startswith("scripts/") and "*" not in name:+ target = tmp_path / name+ target.parent.mkdir(parents=True, exist_ok=True)+ shutil.copyfile(repository / name, target)+ helpers = runpy.run_path(str(tmp_path / "scripts/show_runtime_manifest_asset.py"))+ assert helpers["validate_manifest_bytes"](json.dumps(_manifest()).encode()) == _manifest()