The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
feat(ci): reuse release builds and stage draft assets before dev (#3215)
kekxy24461d5d7893
diff --git a/.github/actions/release-build-cache/action.yml b/.github/actions/release-build-cache/action.ymlnew file mode 100644index 000000000..cd03997cc--- /dev/null+++ b/.github/actions/release-build-cache/action.yml@@ -0,0 +1,78 @@+name: Verified release build cache+description: Keep verified producer outputs across attempts of the same release run.+inputs:+ mode: { description: Restore or save this producer, required: true }+ plan: { description: Release retry plan, required: true }+ unit: { description: Producer and platform, required: true }+ registry-ref: { description: GHCR version tag checked while the caller holds its publication lock, default: '' }+ dependency: { description: Local input file whose digest must match, default: '' }+ manifest: { description: Published OCI manifest hex digest, default: '' }+outputs:+ key:+ description: Digest-bound key recorded by the successful build job+ value: ${{ steps.pack.outputs.key }}+ hit:+ description: All files and the optional input digest matched+ value: ${{ steps.verify.outputs.hit == 'true' && (inputs.registry-ref == '' || steps.registry.outputs.hit == 'true') }}+runs:+ using: composite+ steps:+ - id: restore+ if: inputs.mode == 'restore' && fromJSON(inputs.plan).attempt == github.run_attempt && fromJSON(inputs.plan).sources[inputs.unit] != ''+ continue-on-error: true+ uses: actions/cache/restore@v4+ with:+ key: ${{ fromJSON(inputs.plan).sources[inputs.unit] }}+ path: .release-build-cache+ - id: verify+ if: inputs.mode == 'restore' && steps.restore.outputs.cache-hit == 'true'+ uses: actions/github-script@v8+ env:+ SOURCE: ${{ fromJSON(inputs.plan).sources[inputs.unit] }}+ UNIT: ${{ inputs.unit }}+ DEPENDENCY: ${{ inputs.dependency }}+ ACTION_DIR: ${{ github.action_path }}+ with:+ script: |+ const { restoreFiles } = await import(require('node:url').pathToFileURL(process.env.ACTION_DIR + '/files.mjs').href)+ const { UNIT, SOURCE, DEPENDENCY, GITHUB_WORKSPACE } = process.env+ const hit = await restoreFiles({ root: GITHUB_WORKSPACE, unit: UNIT, dependency: DEPENDENCY, digest: SOURCE.split('.')[4] })+ core.setOutput('hit', hit)+ - id: registry+ if: steps.verify.outputs.hit == 'true' && inputs.registry-ref != ''+ shell: bash+ env:+ REGISTRY_REF: ${{ inputs.registry-ref }}+ SOURCE: ${{ fromJSON(inputs.plan).sources[inputs.unit] }}+ GH_TOKEN: ${{ github.token }}+ run: |+ set -euo pipefail+ config="$RUNNER_TEMP/verify-ghcr-cache.json"+ printf '%s' "$GH_TOKEN" | oras login ghcr.io --username "$GITHUB_ACTOR" --password-stdin --registry-config "$config"+ expected="sha256:${SOURCE##*.}"+ if current=$(oras resolve --registry-config "$config" "$REGISTRY_REF") && [[ "$current" == "$expected" ]]; then+ echo "hit=true" >> "$GITHUB_OUTPUT"+ else+ echo "hit=false" >> "$GITHUB_OUTPUT"+ fi+ - id: pack+ if: inputs.mode == 'save'+ uses: actions/github-script@v8+ env:+ PREFIX: ${{ fromJSON(inputs.plan).key }}+ CHECK_ID: ${{ job.check_run_id }}+ MANIFEST: ${{ inputs.manifest }}+ UNIT: ${{ inputs.unit }}+ DEPENDENCY: ${{ inputs.dependency }}+ ACTION_DIR: ${{ github.action_path }}+ with:+ script: |+ const { saveFiles } = await import(require('node:url').pathToFileURL(process.env.ACTION_DIR + '/files.mjs').href)+ const { UNIT, DEPENDENCY, GITHUB_WORKSPACE } = process.env+ const receipt = await saveFiles({ root: GITHUB_WORKSPACE, unit: UNIT, dependency: DEPENDENCY })+ core.setOutput('key', [process.env.PREFIX, UNIT, process.env.GITHUB_RUN_ATTEMPT, process.env.CHECK_ID, receipt, process.env.MANIFEST].join('.'))+ - if: inputs.mode == 'save'+ uses: actions/cache/save@v4+ with:+ key: ${{ steps.pack.outputs.key }}+ path: .release-build-cachediff --git a/.github/actions/release-build-cache/files.mjs b/.github/actions/release-build-cache/files.mjsnew file mode 100644index 000000000..d68b5e206--- /dev/null+++ b/.github/actions/release-build-cache/files.mjs@@ -0,0 +1,80 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 BoxLite AI+import assert from 'node:assert/strict'+import { createHash } from 'node:crypto'+import { constants, createReadStream, globSync } from 'node:fs'+import { copyFile, lstat, mkdir, readFile, realpath, rm, writeFile } from 'node:fs/promises'+import { dirname, join, resolve } from 'node:path'++function members(unit) {+ if (unit === 'runner') return ['boxlite-runner-*-linux-amd64.tar.gz', 'boxlite-runner-*-linux-amd64.tar.gz.sha256', 'producer.json']+ if (unit === 'ghcr-runner') return ['runner.json', 'producer.json']+ if (/^ghcr-[a-z][a-z0-9-]*$/.test(unit)) return ['image.json', 'producer.json']+ const [, component, target] = /^(runtime|c|wheels|node)-([a-z0-9-]+)$/.exec(unit) || []+ switch (component) {+ case 'runtime': return ['boxlite-runtime-*-' + target + '.tar.gz', 'boxlite-cli-*.tar.gz', 'producer.json']+ case 'c': return ['boxlite-c-*-' + target + '.tar.gz', 'producer.json']+ case 'wheels': return ['wheelhouse/*.whl', 'wheelhouse/producer.json']+ case 'node': return ['sdks/node/artifacts-' + target + '.tar', 'sdks/node/packages/*.tgz', 'sdks/node/packages/producer.json']+ default: throw new Error('Unknown build cache unit: ' + unit)+ }+}++async function digest(file) {+ const hash = createHash('sha256')+ for await (const chunk of createReadStream(file)) hash.update(chunk)+ return hash.digest('hex')+}++async function inventory(root, unit) {+ const files = {}+ for (const pattern of members(unit)) {+ const names = globSync(pattern, { cwd: root }).sort()+ assert.ok(names.length, 'Missing build output: ' + pattern)+ for (const name of names) {+ const path = join(root, name)+ assert.equal(await realpath(path), resolve(await realpath(root), name))+ assert.ok((await lstat(path)).isFile(), 'Expected a regular file: ' + name)+ files[name] = await digest(path)+ }+ }+ return files+}++async function copyMembers(names, source, dest) {+ for (const name of names) {+ await mkdir(dirname(join(dest, name)), { recursive: true })+ await copyFile(join(source, name), join(dest, name), constants.COPYFILE_FICLONE)+ }+}++export async function saveFiles({ root, unit, dependency }) {+ const cache = join(root, '.release-build-cache')+ await rm(cache, { recursive: true, force: true })+ const files = await inventory(root, unit)+ await copyMembers(Object.keys(files), root, join(cache, 'files'))+ const receipt = { unit, dependency: dependency ? await digest(join(root, dependency)) : null, files }+ await writeFile(join(cache, 'receipt.json'), JSON.stringify(receipt))+ return digest(join(cache, 'receipt.json'))+}++export async function restoreFiles({ root, unit, dependency, digest: expected }) {+ const cache = join(root, '.release-build-cache')+ let names+ try {+ const receipt = join(cache, 'receipt.json')+ assert.equal(await digest(receipt), expected)+ const saved = JSON.parse(await readFile(receipt, 'utf8'))+ assert.equal(saved.unit, unit)+ assert.equal(saved.dependency, dependency ? await digest(join(root, dependency)) : null)+ const files = await inventory(join(cache, 'files'), unit)+ assert.deepEqual(files, saved.files)+ names = Object.keys(files)+ } catch (error) {+ console.warn('Rebuilding ' + unit + ': ' + error.message)+ return false+ }+ // Validate the complete set before exposing any member to packaging or publication.+ await copyMembers(names, join(cache, 'files'), root)+ return true+}diff --git a/.github/workflows/README.md b/.github/workflows/README.mdindex 9877484e0..839a9e461 100644--- a/.github/workflows/README.md+++ b/.github/workflows/README.md@@ -67,12 +67,14 @@ PRODUCT RELEASE (dispatch from main) mbuild-release creates or selects the dr│ ├─ build-go│ └─ build-runner-binary└─ publish images to GHCR- Runner archive to GHCR ──▶ verify pins ──▶ approved dev deployment- └─▶ dev E2E with Linux clients- ├─▶ prod approval + deployment- complete distribution + Go tests + successful dev E2E ─┴─▶ attach files- ──▶ PyPI and npm ──▶ publish GitHub Release ──┬─▶ crates.io- └─▶ verify public C SDK downloads → Go tag+ Each finished release component ──▶ its draft attachments+ All draft attachments + GHCR pins ──▶ release-candidate.json+ GHCR pins + runtime, wheels, Node, C ──▶ approved dev apply → dev E2E pass or approved waiver+ ├─▶ prod approval + deployment+ complete distribution + Go tests ─┴─▶ certify accepted files+ ──▶ PyPI and npm ──▶ publish GitHub Release+ ├─▶ crates.io+ └─▶ verify public C SDK downloads → Go tagSINGLE COMPONENT (dispatch from main) mbuild-release ──▶ component build + tests ──▶ component publicationbuild-only ──▶ artifacts from the selected source@@ -129,7 +131,7 @@ Set `TAG` to the existing stable version tag and start the product release fromgh workflow run mbuild-release.yml --ref main -f tag="$TAG"```-The parent creates or selects the draft, gathers the build outputs in Actions Artifacts and requests dev approval. Successful dev E2E allows the attachment job to upload the verified files. Once the attachments, PyPI and npm jobs succeed, the parent makes the Release public.+The parent uploads each completed component to the draft and writes the verified manifest once every component is present. A passing dev E2E or an [explicit waiver for that failed candidate](../../apps/infra/docs/release.md#review-a-failed-dev-e2e) gates automatic publication. After attachment verification and successful PyPI and npm publication, the parent makes the Release public. For emergency publication from the GitHub UI, follow the [manual draft publication procedure](../../apps/infra/docs/release.md#resume-from-a-complete-draft).Both full releases and standalone Go publication verify anonymous downloads of the versioned C SDK archives before pushing the Go module tag.@@ -381,6 +383,8 @@ A `uses: ./...` action is resolved from the **checked-out tree**, not from the rworkflow. Jobs that check out a caller-selected commit — `build-c` and `build-runner-binary`, when`deploy-infra` drives them — therefore need `.github/actions/` to exist in *that* commit. A commitpredating these directories fails with `Can't find 'action.yml'`; select a newer one.+Manual `deploy-infra` runs can restore caches for these builds. They receive read-only+cache access because they run from `main` and can select an open PR for deployment.## sccachediff --git a/.github/workflows/build-c.yml b/.github/workflows/build-c.ymlindex e729e2043..02218615d 100644--- a/.github/workflows/build-c.yml+++ b/.github/workflows/build-c.yml@@ -4,6 +4,10 @@ name: Build C SDKon:workflow_call:inputs:+ build_plan:+ description: Verified build plan for a full release run.+ type: string+ default: ''ref:description: 'Full commit SHA to build. Defaults to the event commit.'required: false@@ -83,7 +87,7 @@ jobs:strategy:fail-fast: falsematrix:- include: ${{ fromJson(inputs.linux_x64_only && '[{"os":"ubuntu-latest","target":"linux-x64-gnu","rust_target":"x86_64-unknown-linux-gnu"}]' || needs.resolve-ref.outputs.platforms) }}+ include: ${{ fromJSON(inputs.linux_x64_only && '[{"os":"ubuntu-latest","target":"linux-x64-gnu","rust_target":"x86_64-unknown-linux-gnu"}]' || needs.resolve-ref.outputs.platforms) }}steps:- name: Install BoxLite worker build tools@@ -104,18 +108,38 @@ jobs:ref: ${{ needs.resolve-ref.outputs.sha }}submodules: recursive+ - name: Check out release cache tooling+ if: inputs.build_plan != ''+ uses: actions/checkout@v5+ with:+ ref: ${{ github.sha }}+ path: .release-ci+ sparse-checkout: .github/actions/release-build-cache+ persist-credentials: false++ - name: Restore release build cache+ id: cache+ if: inputs.build_plan != ''+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: restore+ unit: c-${{ matrix.target }}+ plan: ${{ inputs.build_plan }}+- uses: ./.github/actions/setup-rust+ if: steps.cache.outputs.hit != 'true'with:toolchain: ${{ needs.resolve-ref.outputs.rust-toolchain }}cache: ${{ runner.os != 'Linux' }}- uses: ./.github/actions/sccache+ if: steps.cache.outputs.hit != 'true'- uses: ./.github/actions/build-guest- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')- name: Build C SDK (Linux)- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')uses: ./.github/actions/run-in-manylinuxwith:target: ${{ matrix.target }}@@ -127,7 +151,7 @@ jobs:bash scripts/build/fix-go-symbols.sh target/release/libboxlite.a- name: Build C SDK (macOS)- if: runner.os == 'macOS'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'macOS')run: |make setup:build runtime@@ -140,6 +164,7 @@ jobs:command -v sccache &>/dev/null && sccache --show-stats || true- name: Package C SDK archive+ if: steps.cache.outputs.hit != 'true'run: |VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')ARCHIVE_DIR="boxlite-c-v${VERSION}-${{ matrix.target }}"@@ -159,6 +184,7 @@ jobs:rm -rf "${ARCHIVE_DIR}"- name: Record build origin+ if: steps.cache.outputs.hit != 'true'working-directory: .run: |jq -n --arg sha "$(git rev-parse HEAD)" --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" \@@ -174,3 +200,16 @@ jobs:boxlite-c-v*-${{ matrix.target }}.tar.gz./producer.jsonretention-days: ${{ needs.resolve-ref.outputs.artifact-retention-days }}++ - name: Save release build cache+ id: saved+ if: inputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: save+ unit: c-${{ matrix.target }}+ plan: ${{ inputs.build_plan }}++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'diff --git a/.github/workflows/build-node.yml b/.github/workflows/build-node.ymlindex dec75e3a4..612feab25 100644--- a/.github/workflows/build-node.yml+++ b/.github/workflows/build-node.yml@@ -3,6 +3,10 @@ name: Build Node.json:workflow_call:inputs:+ build_plan:+ description: Verified build plan for a full release run.+ type: string+ default: ''ref:required: truetype: string@@ -40,7 +44,7 @@ jobs:strategy:fail-fast: falsematrix:- include: ${{ fromJson(needs.config.outputs.platforms) }}+ include: ${{ fromJSON(needs.config.outputs.platforms) }}steps:- name: Check out BoxLite runner setup@@ -60,23 +64,44 @@ jobs:ref: ${{ inputs.ref || github.sha }}submodules: recursive+ - name: Check out release cache tooling+ if: inputs.build_plan != ''+ uses: actions/checkout@v5+ with:+ ref: ${{ github.sha }}+ path: .release-ci+ sparse-checkout: .github/actions/release-build-cache+ persist-credentials: false++ - name: Restore release build cache+ id: cache+ if: inputs.build_plan != ''+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: restore+ unit: node-${{ matrix.target }}+ plan: ${{ inputs.build_plan }}+- name: Set up Node.js+ if: steps.cache.outputs.hit != 'true'uses: actions/setup-node@v4with:node-version: ${{ needs.config.outputs.node-build-version }}- uses: ./.github/actions/setup-rust+ if: steps.cache.outputs.hit != 'true'with:toolchain: ${{ needs.config.outputs.rust-toolchain }}cache: ${{ runner.os != 'Linux' }}- uses: ./.github/actions/sccache+ if: steps.cache.outputs.hit != 'true'- uses: ./.github/actions/build-guest- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')- name: Build Node.js package (Linux)- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')uses: ./.github/actions/run-in-manylinuxwith:target: ${{ matrix.target }}@@ -88,7 +113,7 @@ jobs:npm run artifacts- name: Build Node.js package (macOS)- if: runner.os == 'macOS'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'macOS')run: |make setup:build runtime@@ -104,6 +129,7 @@ jobs:# GitHub Actions upload-artifact uses ZIP which doesn't preserve permissions.# See: https://github.com/actions/upload-artifact/issues/38- name: Create artifact tarball+ if: steps.cache.outputs.hit != 'true'run: tar -cvf sdks/node/artifacts-${{ matrix.target }}.tar -C sdks/node native/boxlite.js npm/- name: Upload artifacts@@ -116,6 +142,7 @@ jobs:retention-days: ${{ needs.config.outputs.artifact-retention-days }}- name: Pack the native package and the Linux acceptance clients+ if: steps.cache.outputs.hit != 'true'working-directory: sdks/nodeenv:TARGET: ${{ matrix.target }}@@ -148,6 +175,19 @@ jobs:if-no-files-found: errorpath: sdks/node/packages/+ - name: Save release build cache+ id: saved+ if: inputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: save+ unit: node-${{ matrix.target }}+ plan: ${{ inputs.build_plan }}++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'+# ============================================================================# TEST# ============================================================================diff --git a/.github/workflows/build-runner-binary.yml b/.github/workflows/build-runner-binary.ymlindex 30e9f7935..70566512f 100644--- a/.github/workflows/build-runner-binary.yml+++ b/.github/workflows/build-runner-binary.yml@@ -3,6 +3,10 @@ name: Build Runner Binaryon:workflow_call:inputs:+ build_plan:+ description: Verified build plan for a full release run.+ type: string+ default: ''release_tag:description: Product release whose runner is assembled from the same-run C artifact.required: false@@ -145,17 +149,39 @@ jobs:# failed this step with the library sitting right there.cp "/tmp/$(basename "$archive" .tar.gz)/lib/libboxlite.a" sdks/go/libboxlite.a+ - name: Check out release cache tooling+ if: inputs.build_plan != ''+ uses: actions/checkout@v5+ with:+ ref: ${{ github.sha }}+ path: .release-ci+ sparse-checkout: .github/actions/release-build-cache+ persist-credentials: false++ - name: Restore release build cache+ id: cache+ if: inputs.build_plan != ''+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: restore+ unit: runner+ plan: ${{ inputs.build_plan }}+ dependency: sdks/go/libboxlite.a+- name: Rewrite go.work for minimal modules+ if: steps.cache.outputs.hit != 'true'run: |printf 'go 1.25.4\n\nuse (\n\t./runner\n\t./libs/common-go\n\t./libs/api-client-go\n\t../sdks/go\n)\n' > apps/go.work- name: Download Go dependencies+ if: steps.cache.outputs.hit != 'true'run: |go -C apps/runner mod downloadgo -C apps/libs/common-go mod downloadgo -C apps/libs/api-client-go mod download- name: Build runner+ if: steps.cache.outputs.hit != 'true'env:VERSION_IDENTITY: ${{ steps.artifact.outputs.identity }}run: |@@ -166,6 +192,7 @@ jobs:./runner/cmd/runner/- name: Package runner binary+ if: steps.cache.outputs.hit != 'true'env:ARCHIVE: ${{ steps.artifact.outputs.archive }}run: |@@ -175,6 +202,7 @@ jobs:sha256sum "$ARCHIVE" > "$ARCHIVE.sha256"- name: Record build origin+ if: steps.cache.outputs.hit != 'true'working-directory: .run: |jq -n --arg sha "$(git rev-parse HEAD)" --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" \@@ -191,3 +219,17 @@ jobs:boxlite-runner-*-linux-amd64.tar.gz.sha256producer.jsonretention-days: ${{ needs.resolve-ref.outputs.artifact-retention-days }}++ - name: Save release build cache+ id: saved+ if: inputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: save+ unit: runner+ plan: ${{ inputs.build_plan }}+ dependency: sdks/go/libboxlite.a++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'diff --git a/.github/workflows/build-runtime.yml b/.github/workflows/build-runtime.ymlindex 50207e15d..a24ecb224 100644--- a/.github/workflows/build-runtime.yml+++ b/.github/workflows/build-runtime.yml@@ -5,6 +5,10 @@ on:- cron: '0 1 * * 1'workflow_call:inputs:+ build_plan:+ description: Verified build plan for a full release run.+ type: string+ default: ''ref:required: truetype: string@@ -31,7 +35,7 @@ jobs:strategy:fail-fast: falsematrix:- include: ${{ fromJson(needs.config.outputs.platforms) }}+ include: ${{ fromJSON(needs.config.outputs.platforms) }}steps:- name: Check out BoxLite runner setup@@ -51,22 +55,42 @@ jobs:ref: ${{ inputs.ref || github.sha }}submodules: recursive+ - name: Check out release cache tooling+ if: inputs.build_plan != ''+ uses: actions/checkout@v5+ with:+ ref: ${{ github.sha }}+ path: .release-ci+ sparse-checkout: .github/actions/release-build-cache+ persist-credentials: false++ - name: Restore release build cache+ id: cache+ if: inputs.build_plan != ''+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: restore+ unit: runtime-${{ matrix.target }}+ plan: ${{ inputs.build_plan }}+- uses: ./.github/actions/setup-rust+ if: steps.cache.outputs.hit != 'true'with:toolchain: ${{ needs.config.outputs.rust-toolchain }}cache: ${{ runner.os != 'Linux' }}- uses: ./.github/actions/sccache+ if: steps.cache.outputs.hit != 'true'with:tolerate-failure: ${{ github.event_name != 'schedule' }}- uses: ./.github/actions/build-guest- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')with:show-sccache-stats: ${{ github.event_name == 'schedule' }}- name: Build and package runtime (Linux)- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')uses: ./.github/actions/run-in-manylinuxwith:target: ${{ matrix.target }}@@ -74,7 +98,7 @@ jobs:bash scripts/build/package-runtime.sh "$BOXLITE_CI_TARGET"- name: Build and package runtime (macOS)- if: runner.os == 'macOS'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'macOS')env:BOXLITE_CI_TARGET: ${{ matrix.target }}run: |@@ -92,6 +116,7 @@ jobs:retention-days: 7- name: Package CLI binary+ if: steps.cache.outputs.hit != 'true'run: |VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')CLI_BIN="target/release/boxlite"@@ -99,7 +124,7 @@ jobs:tar czf "boxlite-cli-v${VERSION}-${{ matrix.rust_target }}.tar.gz" -C target/release boxlite- name: Record CLI build origin- if: inputs.tag && matrix.target == 'linux-x64-gnu'+ if: steps.cache.outputs.hit != 'true' && (inputs.tag && (inputs.build_plan || matrix.target == 'linux-x64-gnu'))run: |jq -n --arg sha "$(git rev-parse HEAD)" --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" \'{sha:$sha,run:$run,attempt:$attempt}' > producer.json@@ -115,9 +140,22 @@ jobs:producer.jsonretention-days: 7+ - name: Save release build cache+ id: saved+ if: inputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: save+ unit: runtime-${{ matrix.target }}+ plan: ${{ inputs.build_plan }}++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'+package:name: Stage runtime distribution- needs: build+ needs: [config, build]runs-on: boxliteif: inputs.tag != ''permissions:@@ -137,7 +175,7 @@ jobs:- name: Download all build artifactsuses: actions/download-artifact@v4with:- pattern: "@(runtime|cli)-*"+ pattern: ${{ format('@(runtime|cli)-@({0})', join(fromJSON(needs.config.outputs.platforms).*.target, '|')) }}path: distmerge-multiple: truediff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.ymlindex 777f00d83..084b074d8 100644--- a/.github/workflows/build-wheels.yml+++ b/.github/workflows/build-wheels.yml@@ -3,6 +3,10 @@ name: Build Wheelson:workflow_call:inputs:+ build_plan:+ description: Verified build plan for a full release run.+ type: string+ default: ''ref:required: truetype: string@@ -23,7 +27,7 @@ jobs:strategy:fail-fast: truematrix:- include: ${{ fromJson(needs.config.outputs.platforms) }}+ include: ${{ fromJSON(needs.config.outputs.platforms) }}steps:- name: Check out BoxLite runner setup@@ -46,23 +50,44 @@ jobs:# cibuildwheel uses this interpreter range with environment updates disabled.# Its host interpreter needs the library path from the BoxLite tool cache.+ - name: Check out release cache tooling+ if: inputs.build_plan != ''+ uses: actions/checkout@v5+ with:+ ref: ${{ github.sha }}+ path: .release-ci+ sparse-checkout: .github/actions/release-build-cache+ persist-credentials: false++ - name: Restore release build cache+ id: cache+ if: inputs.build_plan != ''+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: restore+ unit: wheels-${{ matrix.os }}+ plan: ${{ inputs.build_plan }}+- name: Set up the Python interpreter used by cibuildwheel- if: matrix.os == 'ubuntu-latest'+ if: steps.cache.outputs.hit != 'true' && (matrix.os == 'ubuntu-latest')uses: actions/setup-python@v6with:python-version: '3.11 - 3.13'- uses: ./.github/actions/setup-rust+ if: steps.cache.outputs.hit != 'true'with:toolchain: ${{ needs.config.outputs.rust-toolchain }}cache: ${{ runner.os != 'Linux' }}- uses: ./.github/actions/sccache+ if: steps.cache.outputs.hit != 'true'- uses: ./.github/actions/build-guest- if: runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (runner.os == 'Linux')- name: Build wheels+ if: steps.cache.outputs.hit != 'true'uses: pypa/[email protected]env:CIBW_BUILD_VERBOSITY: 0@@ -72,13 +97,14 @@ jobs:package-dir: sdks/python- name: Return container cache to the runner- if: always() && runner.os == 'Linux'+ if: steps.cache.outputs.hit != 'true' && (always() && runner.os == 'Linux')run: |if [ -d "$SCCACHE_DIR" ]; thensudo chown -R "$(id -u):$(id -g)" "$SCCACHE_DIR"fi- name: Record build origin+ if: steps.cache.outputs.hit != 'true'working-directory: wheelhouserun: |jq -n --arg sha "$(git rev-parse HEAD)" --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" \@@ -94,3 +120,16 @@ jobs:./wheelhouse/*.whlwheelhouse/producer.jsonretention-days: 7++ - name: Save release build cache+ id: saved+ if: inputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: save+ unit: wheels-${{ matrix.os }}+ plan: ${{ inputs.build_plan }}++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'diff --git a/.github/workflows/deploy-infra.yml b/.github/workflows/deploy-infra.ymlindex de7c1942f..90461bca0 100644--- a/.github/workflows/deploy-infra.yml+++ b/.github/workflows/deploy-infra.yml@@ -50,6 +50,9 @@ on:required: falsetype: string+# This manual workflow can build a PR merge while running in main's cache scope.+cache-mode: read+permissions:contents: readid-token: writediff --git a/.github/workflows/e2e-cloud.yml b/.github/workflows/e2e-cloud.ymlindex 0e443ff11..395ac0d2c 100644--- a/.github/workflows/e2e-cloud.yml+++ b/.github/workflows/e2e-cloud.yml@@ -122,10 +122,14 @@ run-name: E2E cloud against ${{ inputs.stage || 'dev' }}${{ inputs.tag && formaton:workflow_call:outputs:+ failure_evidence_id:+ description: Immutable artifact recording verified clients and a failed release test+ value: ${{ jobs.e2e.outputs.failure_evidence_id }}release_result:description: Outcome of the release acceptance suitevalue: ${{ jobs.e2e.outputs.release_result }}inputs:+ allow_e2e_override: { required: false, type: boolean, default: false }candidate_id: { required: false, type: string }candidate_digest: { required: false, type: string }release_sha:@@ -270,10 +274,11 @@ jobs:name: E2E suite (${{ inputs.stage || 'dev' }})if: ${{ contains(fromJSON('["dev", "stage", "prod"]'), inputs.stage || 'dev') }}runs-on: ubuntu-latest- timeout-minutes: ${{ inputs.candidate_id && 165 || 45 }}+ timeout-minutes: 45cache-mode: readoutputs:release_result: ${{ steps.acceptance.outputs.result }}+ failure_evidence_id: ${{ steps.verdict.outputs.result == 'failure' && steps.receipt.outputs.artifact-id || '' }}env:# Precedence: a dispatch input overrides for one run; otherwise the# repo variable is the configured stack; otherwise the built-in@@ -549,9 +554,12 @@ jobs:# The identity lane reuses these builds but owns its boxes in p2's org.# A separate pytest process keeps the session runtime and auth cache scoped.- name: Run identity E2E (dev and stage)+ id: identity+ continue-on-error: &capture-release-e2e ${{ inputs.allow_e2e_override && inputs.stage == 'dev' && inputs.candidate_id != '' && inputs.deployment_attempt != '' }}if: ${{ (inputs.stage || 'dev') == 'dev' || inputs.stage == 'stage' }}timeout-minutes: 5env:+ BOXLITE_E2E_EXIT_FILE: ${{ inputs.allow_e2e_override && format('{0}/pytest-identities.exitcode', github.workspace) || '' }}BOXLITE_E2E_SKIP_PATH_VERIFY: '1'BOXLITE_E2E_PROFILE: p2BOXLITE_E2E_READONLY_PROFILE: p2_readonly@@ -569,9 +577,12 @@ jobs:# suite's organization has exhausted its image slots. Reuse the SDK# builds and p2 profile in a separate process before the p1 suite.- name: Run image catalog E2E (dev and stage)+ id: catalog+ continue-on-error: *capture-release-e2eif: ${{ (inputs.stage || 'dev') == 'dev' || inputs.stage == 'stage' }}timeout-minutes: 10env:+ BOXLITE_E2E_EXIT_FILE: ${{ inputs.allow_e2e_override && format('{0}/pytest-catalog.exitcode', github.workspace) || '' }}BOXLITE_E2E_SKIP_PATH_VERIFY: '1'BOXLITE_E2E_PROFILE: p2PYTEST_ADDOPTS: >-@@ -583,8 +594,11 @@ jobs:make test:rest:e2e AUTH=api-key FILTER=images_catalog- name: Run E2E suite+ id: suite+ continue-on-error: *capture-release-e2etimeout-minutes: 35env:+ BOXLITE_E2E_EXIT_FILE: ${{ inputs.allow_e2e_override && format('{0}/pytest-junit.exitcode', github.workspace) || '' }}BOXLITE_E2E_SKIP_PATH_VERIFY: '1'BOXLITE_E2E_PROFILE: p1BOXLITE_E2E_DOMAIN: ${{ (inputs.stage || 'dev') == 'dev' && vars.BOXLITE_E2E_DOMAIN || '' }}@@ -609,29 +623,41 @@ jobs:if: always()uses: actions/upload-artifact@v4with:- name: pytest-junit-${{ inputs.stage || 'dev' }}+ name: pytest-junit-${{ inputs.stage || 'dev' }}${{ inputs.allow_e2e_override && format('-{0}', github.run_attempt) || '' }}path: |pytest-junit.xmlpytest-identities.xmlpytest-catalog.xmlif-no-files-found: ignore+ - name: Classify completed release tests+ id: verdict+ if: *capture-release-e2e+ env:+ IDENTITY_RESULT: ${{ steps.identity.outcome }}+ CATALOG_RESULT: ${{ steps.catalog.outcome }}+ SUITE_RESULT: ${{ steps.suite.outcome }}+ run: python3 scripts/ci/release-e2e-result.py+- name: Record the deployed pins and tested client hashesif: success() && inputs.candidate_id && inputs.deployment_attemptenv:CANDIDATE: ${{ inputs.candidate_id }}DIGEST: ${{ inputs.candidate_digest }}SHA: ${{ inputs.release_sha }}+ DECISION: ${{ steps.verdict.outputs.result == 'failure' && 'failed' || 'passed' }}run: |- jq -n --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" --argjson id "$CANDIDATE" \+ jq -n --arg status "$DECISION" --slurpfile pins "$RELEASE_ASSET_DIR/release-candidate.json" \+ --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" --argjson id "$CANDIDATE" \--arg digest "$DIGEST" --arg tag "$RELEASE_TAG" --arg sha "$SHA" --slurpfile clients "$RELEASE_ASSET_DIR/tested-clients.json" \- '{run:$run,attempt:$attempt,candidate:$id,digest:$digest,tag:$tag,sha:$sha,clients:$clients[0]}' > acceptance.json+ '{run:$run,attempt:$attempt,candidate:$id,digest:$digest,tag:$tag,sha:$sha,clients:$clients[0],status:$status,images:$pins[0].images,runner:$pins[0].runner}' > acceptance.json- - name: Save dev acceptance for production retries+ - name: Save the release E2E result+ id: receiptif: success() && inputs.candidate_id && inputs.deployment_attemptuses: actions/upload-artifact@v4with:- name: dev-accepted-${{ inputs.candidate_id }}+ name: ${{ steps.verdict.outputs.result == 'failure' && 'dev-e2e-failed' || 'dev-accepted' }}-${{ inputs.candidate_id }}path: acceptance.jsonif-no-files-found: erroroverwrite: true@@ -640,7 +666,7 @@ jobs:id: acceptanceif: always() && inputs.deployment_attemptenv:- E2E_RESULT: ${{ job.status }}+ E2E_RESULT: ${{ job.status == 'success' && steps.verdict.outputs.result || job.status }}run: |echo "result=$E2E_RESULT" >> "$GITHUB_OUTPUT"echo "Dev cloud E2E for $RELEASE_TAG — $E2E_RESULT" >> "$GITHUB_STEP_SUMMARY"diff --git a/.github/workflows/mbuild-release.yml b/.github/workflows/mbuild-release.ymlindex 617be6b70..7d76c9b75 100644--- a/.github/workflows/mbuild-release.yml+++ b/.github/workflows/mbuild-release.yml@@ -47,8 +47,11 @@ jobs:runs-on: ubuntu-latestpermissions:contents: write+ actions: readoutputs:- sha: ${{ steps.ref.outputs.sha || steps.source.outputs.sha }}+ build_plan: ${{ steps.retry.outputs.plan }}+ sha: ${{ steps.ref.outputs.sha }}+ source_sha: ${{ steps.source.outputs.sha }}mode: ${{ steps.selection.outputs.mode }}builds: ${{ steps.selection.outputs.builds }}group: ${{ steps.selection.outputs.group }}@@ -175,44 +178,71 @@ jobs:echo "names=$names" >> "$GITHUB_OUTPUT"echo "$SHA declares $names"+ - name: Select reusable builds from this release run+ if: inputs.command == 'publish'+ id: retry+ env:+ SHA: ${{ steps.ref.outputs.sha }}+ TAG: ${{ inputs.tag }}+ run: node apps/infra/scripts/release-build-plan.mjs++ standalone-build:+ needs: resolve+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'build' }}+ cache-mode: read+ uses: ./.github/workflows/release-source-build.yml+ permissions:+ contents: read+ actions: read+ id-token: write+ attestations: write+ with:+ ref: ${{ needs.resolve.outputs.source_sha }}+ builds: ${{ needs.resolve.outputs.builds }}+ linux_x64_only: ${{ inputs.command == 'publish-runner' }}+build-runtime:needs: resolve- if: ${{ github.ref == 'refs/heads/main' && contains(fromJSON(needs.resolve.outputs.builds), 'runtime') }}+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'runtime') }}uses: ./.github/workflows/build-runtime.ymlpermissions:contents: readid-token: writeattestations: writewith:+ build_plan: ${{ needs.resolve.outputs.build_plan }}ref: ${{ needs.resolve.outputs.sha }}- tag: ${{ needs.resolve.outputs.mode != 'build' && inputs.tag || '' }}+ tag: ${{ inputs.tag }}build-wheels:needs: resolve- if: ${{ github.ref == 'refs/heads/main' && contains(fromJSON(needs.resolve.outputs.builds), 'wheels') }}+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'wheels') }}uses: ./.github/workflows/build-wheels.ymlwith:+ build_plan: ${{ needs.resolve.outputs.build_plan }}ref: ${{ needs.resolve.outputs.sha }}build-node:needs: resolve- if: ${{ github.ref == 'refs/heads/main' && contains(fromJSON(needs.resolve.outputs.builds), 'node') }}+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'node') }}uses: ./.github/workflows/build-node.ymlwith:+ build_plan: ${{ needs.resolve.outputs.build_plan }}ref: ${{ needs.resolve.outputs.sha }}build-c:needs: resolve- if: ${{ github.ref == 'refs/heads/main' && contains(fromJSON(needs.resolve.outputs.builds), 'c') }}+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'c') }}uses: ./.github/workflows/build-c.ymlwith:+ build_plan: ${{ needs.resolve.outputs.build_plan }}ref: ${{ needs.resolve.outputs.sha }}full_release: ${{ needs.resolve.outputs.mode == 'release' }}linux_x64_only: ${{ inputs.command == 'publish-runner' }}build-go:needs: [resolve, build-c]- if: ${{ github.ref == 'refs/heads/main' && contains(fromJSON(needs.resolve.outputs.builds), 'go') }}+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'go') }}permissions:contents: readactions: read@@ -222,12 +252,13 @@ jobs:build-runner-binary:needs: [resolve, build-c]- if: ${{ github.ref == 'refs/heads/main' && contains(fromJSON(needs.resolve.outputs.builds), 'runner') }}+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'runner') }}uses: ./.github/workflows/build-runner-binary.ymlwith:+ build_plan: ${{ needs.resolve.outputs.build_plan }}ref: ${{ needs.resolve.outputs.sha }}libboxlite_source: artifact- release_tag: ${{ needs.resolve.outputs.mode != 'build' && inputs.tag || '' }}+ release_tag: ${{ inputs.tag }}publish:concurrency:@@ -252,20 +283,41 @@ jobs:- uses: actions/checkout@v5with:persist-credentials: false+ - uses: oras-project/setup-oras@5e2f2482b30b0cb3e14e67f89a80c88c659a7c63 # v2.0.3+ if: >-+ fromJSON(needs.resolve.outputs.build_plan || '{}').attempt == github.run_attempt &&+ fromJSON(needs.resolve.outputs.build_plan || '{}').sources[format('ghcr-{0}', matrix.artifact)] != ''+ with:+ version: 1.3.6+ - name: Restore release build cache+ id: cache+ if: needs.resolve.outputs.build_plan != ''+ uses: ./.github/actions/release-build-cache+ with:+ mode: restore+ unit: ghcr-${{ matrix.artifact }}+ plan: ${{ needs.resolve.outputs.build_plan }}+ registry-ref: ghcr.io/${{ github.repository }}/${{ matrix.artifact }}:${{ inputs.tag }}-${{ needs.resolve.outputs.sha }}+- uses: actions/checkout@v5+ if: steps.cache.outputs.hit != 'true'with:persist-credentials: falseref: ${{ needs.resolve.outputs.sha }}path: release-source- uses: ./.github/actions/setup-infra+ if: steps.cache.outputs.hit != 'true'- name: Keep registry credentials out of HOME+ if: steps.cache.outputs.hit != 'true'run: |set -Eeuo pipefailinstall -d -m 700 "$RUNNER_TEMP/docker"echo "DOCKER_CONFIG=$RUNNER_TEMP/docker" >> "$GITHUB_ENV"- name: Build and upload+ if: steps.cache.outputs.hit != 'true'+ id: builtworking-directory: apps/infraenv:SHA: ${{ needs.resolve.outputs.sha }}@@ -277,6 +329,8 @@ jobs:set -Eeuo pipefailnpm run --silent mbuild publish -- --tag "$SHA" --ghcr "$GHCR_REPOSITORY" --artifact "$ARTIFACT" --version "$TAG" \--replace --output "$GITHUB_WORKSPACE/image.json"+ manifest=$(jq -er '.[0].digest' "$GITHUB_WORKSPACE/image.json")+ echo "manifest=${manifest#sha256:}" >> "$GITHUB_OUTPUT"jq -n --arg sha "$SHA" --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" \'{sha: $sha, run: $run, attempt: $attempt}' > "$GITHUB_WORKSPACE/producer.json"@@ -289,6 +343,20 @@ jobs:image.jsonproducer.json+ - name: Save release build cache+ id: saved+ if: needs.resolve.outputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.github/actions/release-build-cache+ with:+ mode: save+ unit: ghcr-${{ matrix.artifact }}+ plan: ${{ needs.resolve.outputs.build_plan }}+ manifest: ${{ steps.built.outputs.manifest }}++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'+- name: Reportif: always()env:@@ -321,15 +389,47 @@ jobs:runs-on: ubuntu-latestpermissions:contents: read+ actions: readpackages: writesteps:+ - name: Select the immutable Runner archive+ id: source+ run: |+ set -euo pipefail+ id=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts?name=runner-linux-amd64" \+ --jq '[.artifacts[] | select(.expired == false)] | select(length == 1) | .[0].id')+ [[ "$id" =~ ^[1-9][0-9]*$ ]]+ echo "id=$id" >> "$GITHUB_OUTPUT"- uses: actions/download-artifact@v4with:- name: runner-linux-amd64+ artifact-ids: ${{ steps.source.outputs.id }}+ merge-multiple: true+ - name: Check out release cache tooling+ if: needs.resolve.outputs.build_plan != ''+ uses: actions/checkout@v5+ with:+ ref: ${{ github.sha }}+ path: .release-ci+ sparse-checkout: .github/actions/release-build-cache+ persist-credentials: false+- uses: oras-project/setup-oras@5e2f2482b30b0cb3e14e67f89a80c88c659a7c63 # v2.0.3with:version: 1.3.6+ - name: Restore release build cache+ id: cache+ if: needs.resolve.outputs.build_plan != ''+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: restore+ unit: ghcr-runner+ plan: ${{ needs.resolve.outputs.build_plan }}+ registry-ref: ghcr.io/${{ github.repository }}/runner:${{ inputs.tag }}-${{ needs.resolve.outputs.sha }}+ dependency: boxlite-runner-${{ inputs.tag }}-linux-amd64.tar.gz+- name: Push the exact Runner archive+ if: steps.cache.outputs.hit != 'true'+ id: builtenv:TAG: ${{ inputs.tag }}SHA: ${{ needs.resolve.outputs.sha }}@@ -343,20 +443,34 @@ jobs:--annotation "org.opencontainers.image.revision=$SHA" --annotation "org.opencontainers.image.version=$TAG" \--annotation "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "$tarball:application/gzip"manifest=$(oras resolve --oci-layout "$layout")+ echo "manifest=${manifest#sha256:}" >> "$GITHUB_OUTPUT"archive="sha256:$(sha256sum "$tarball" | cut -d' ' -f1)"registry_config="$RUNNER_TEMP/oras-registry.json"printf '%s' "$GH_TOKEN" | oras login ghcr.io -u "$GITHUB_ACTOR" --password-stdin --registry-config "$registry_config"oras cp --from-oci-layout --to-registry-config "$registry_config" "$layout" "$repo:$TAG-$SHA"- [[ "$(oras resolve --registry-config "$registry_config" "$repo:$TAG-$SHA")" == "$manifest" ]]- oras manifest fetch --registry-config "$registry_config" "$repo@$manifest" | jq -e --arg archive "$archive" \- '.layers | length == 1 and .[0].digest == $archive' >/dev/null- # A fresh host has no Actions token. Exercise its read boundary before dev approval.- printf '{"auths":{}}\n' > "$RUNNER_TEMP/anonymous-registry.json"- oras manifest fetch --registry-config "$RUNNER_TEMP/anonymous-registry.json" "$repo@$manifest" >/dev/null- oras blob fetch --descriptor --registry-config "$RUNNER_TEMP/anonymous-registry.json" "$repo@$archive" >/dev/nulljq -n --arg manifest "$manifest" --arg archive "$archive" '{manifest: $manifest, archive: $archive}' > runner.jsonjq -n --arg sha "$SHA" --argjson run "$GITHUB_RUN_ID" --argjson attempt "$GITHUB_RUN_ATTEMPT" \'{sha: $sha, run: $run, attempt: $attempt}' > producer.json+ - name: Verify Runner pins and anonymous host download+ env:+ TAG: ${{ inputs.tag }}+ SHA: ${{ needs.resolve.outputs.sha }}+ run: |+ set -euo pipefail+ repo="ghcr.io/$GITHUB_REPOSITORY/runner"+ manifest=$(jq -er '.manifest | select(test("^sha256:[0-9a-f]{64}$"))' runner.json)+ archive=$(jq -er '.archive | select(test("^sha256:[0-9a-f]{64}$"))' runner.json)+ tarball="boxlite-runner-$TAG-linux-amd64.tar.gz"+ local_archive=$(sha256sum "$tarball")+ [[ "sha256:${local_archive%% *}" == "$archive" ]] || { echo 'Local Runner archive differs from the candidate' >&2; exit 1; }+ anonymous="$RUNNER_TEMP/anonymous-registry.json"+ printf '{"auths":{}}\n' > "$anonymous"+ resolved=$(oras resolve --registry-config "$anonymous" "$repo:$TAG-$SHA")+ [[ "$resolved" == "$manifest" ]] || { echo 'Runner tag differs from the candidate manifest' >&2; exit 1; }+ oras manifest fetch --registry-config "$anonymous" "$repo@$manifest" | jq -e --arg archive "$archive" \+ '.layers | length == 1 and .[0].digest == $archive' >/dev/null+ downloaded=$(oras blob fetch --output - --registry-config "$anonymous" "$repo@$archive" | sha256sum)+ [[ "sha256:${downloaded%% *}" == "$archive" ]] || { echo 'Anonymous Runner download differs from the candidate' >&2; exit 1; }- uses: actions/upload-artifact@v4with:name: ghcr-runner@@ -366,17 +480,91 @@ jobs:runner.jsonproducer.json+ - name: Save release build cache+ id: saved+ if: needs.resolve.outputs.build_plan != '' && steps.cache.outputs.hit != 'true'+ uses: ./.release-ci/.github/actions/release-build-cache+ with:+ mode: save+ unit: ghcr-runner+ plan: ${{ needs.resolve.outputs.build_plan }}+ dependency: boxlite-runner-${{ inputs.tag }}-linux-amd64.tar.gz+ manifest: ${{ steps.built.outputs.manifest }}++ - name: Build cache receipt ${{ steps.saved.outputs.key }}+ if: steps.saved.outputs.key != ''+ run: echo 'Recorded build output digests for whole-run retries.'++ draft-runtime:+ needs: [resolve, build-runtime]+ if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'+ uses: ./.github/workflows/release-draft-component.yml+ permissions: { contents: write, actions: read }+ with:+ tag: ${{ inputs.tag }}+ sha: ${{ needs.resolve.outputs.sha }}+ release_id: ${{ needs.resolve.outputs.release_id }}+ group: runtime-distribution++ draft-wheels:+ needs: [resolve, build-wheels]+ if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'+ uses: ./.github/workflows/release-draft-component.yml+ permissions: { contents: write, actions: read }+ with:+ tag: ${{ inputs.tag }}+ sha: ${{ needs.resolve.outputs.sha }}+ release_id: ${{ needs.resolve.outputs.release_id }}+ group: wheels-++ draft-node:+ needs: [resolve, build-node]+ if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'+ uses: ./.github/workflows/release-draft-component.yml+ permissions: { contents: write, actions: read }+ with:+ tag: ${{ inputs.tag }}+ sha: ${{ needs.resolve.outputs.sha }}+ release_id: ${{ needs.resolve.outputs.release_id }}+ group: node-packages++ draft-c:+ needs: [resolve, build-c]+ if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'+ uses: ./.github/workflows/release-draft-component.yml+ permissions: { contents: write, actions: read }+ with:+ tag: ${{ inputs.tag }}+ sha: ${{ needs.resolve.outputs.sha }}+ release_id: ${{ needs.resolve.outputs.release_id }}+ group: c-sdk-++ draft-runner:+ needs: [resolve, build-runner-binary]+ if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'+ uses: ./.github/workflows/release-draft-component.yml+ permissions: { contents: write, actions: read }+ with:+ tag: ${{ inputs.tag }}+ sha: ${{ needs.resolve.outputs.sha }}+ release_id: ${{ needs.resolve.outputs.release_id }}+ group: runner-linux-amd64+distribution:if: >-${{ !cancelled() && github.ref == 'refs/heads/main' &&((needs.resolve.outputs.mode == 'release' && needs.publish.result == 'success' && needs.publish-runner.result == 'success' &&- needs.build-runtime.result == 'success' && needs.build-wheels.result == 'success' && needs.build-node.result == 'success' && needs.build-c.result == 'success') ||+ needs.build-runtime.result == 'success' && needs.build-wheels.result == 'success' && needs.build-node.result == 'success' && needs.build-c.result == 'success' &&+ needs.draft-runtime.result == 'success' && needs.draft-wheels.result == 'success' && needs.draft-node.result == 'success' && needs.draft-c.result == 'success' && needs.draft-runner.result == 'success') ||(needs.resolve.outputs.mode == 'component' && needs.resolve.outputs.group != '' && needs[needs.resolve.outputs.producer].result == 'success')) }}+ concurrency:+ group: mbuild-release-assets-${{ inputs.tag }}+ queue: maxname: Verify release files- needs: [resolve, publish, publish-runner, build-runtime, build-wheels, build-node, build-c]+ needs: [resolve, publish, publish-runner, build-runtime, build-wheels, build-node, build-c, draft-runtime, draft-wheels, draft-node, draft-c, draft-runner]runs-on: ubuntu-latestpermissions:- contents: read+ contents: writeactions: readoutputs:candidate_id: ${{ steps.upload.outputs.artifact-id }}@@ -409,9 +597,18 @@ jobs:if-no-files-found: errorpath: candidate/+ - name: Complete the draft with its verified manifest+ if: needs.resolve.outputs.mode == 'release'+ env:+ RELEASE_ID: ${{ needs.resolve.outputs.release_id }}+ CANDIDATE_DIGEST: ${{ steps.stage.outputs.digest }}+ TAG: ${{ inputs.tag }}+ SHA: ${{ needs.resolve.outputs.sha }}+ run: node apps/infra/scripts/release-candidate.mjs draft-manifest+dev:name: Dev deployment and acceptance- needs: [resolve, publish, publish-runner]+ needs: [resolve, publish, publish-runner, build-runtime, build-c, build-wheels, build-node]if: ${{ needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main' }}permissions: &rollout-permissionscontents: read@@ -422,6 +619,7 @@ jobs:uses: ./.github/workflows/mdeploy-all.ymlwith:stage: dev+ allow_e2e_override: trueref: ${{ inputs.tag }}release_sha: ${{ needs.resolve.outputs.sha }}release_images: ${{ needs.resolve.outputs.artifacts }}@@ -434,6 +632,71 @@ jobs:BOXLITE_DEV_P2_API_KEY: ${{ secrets.BOXLITE_DEV_P2_API_KEY }}BOXLITE_DEV_P2_READONLY_API_KEY: ${{ secrets.BOXLITE_DEV_P2_READONLY_API_KEY }}+ request-e2e-override:+ name: Request review of failed dev E2E+ needs: [resolve, dev]+ if: >-+ ${{ !cancelled() && github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' &&+ needs.dev.result == 'success' && needs.dev.outputs.e2e_result == 'failure' &&+ needs.dev.outputs.failure_evidence_id != '' && needs.dev.outputs.deployment_attempt != '' }}+ runs-on: ubuntu-latest+ permissions:+ contents: read+ actions: read+ steps:+ - uses: actions/checkout@v5+ with:+ persist-credentials: false+ - name: Notify release reviewers of failed tests+ continue-on-error: true+ env:+ TAG: ${{ inputs.tag }}+ EVIDENCE_ID: ${{ needs.dev.outputs.failure_evidence_id }}+ DEPLOYMENT_ATTEMPT: ${{ needs.dev.outputs.deployment_attempt }}+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}+ run: node apps/infra/scripts/release-pipeline.mjs override-request++ e2e-override:+ name: Review failed dev E2E+ needs: [resolve, dev, request-e2e-override]+ if: github.ref == 'refs/heads/main' && needs.request-e2e-override.result == 'success'+ environment: release-e2e-override+ runs-on: ubuntu-latest+ permissions:+ contents: read+ actions: read+ outputs:+ attempt: ${{ steps.grant.outputs.attempt }}+ steps:+ - uses: actions/checkout@v5+ with:+ persist-credentials: false+ - uses: actions/download-artifact@v4+ with:+ artifact-ids: ${{ needs.dev.outputs.failure_evidence_id }}+ merge-multiple: true+ path: e2e-evidence+ - name: Verify the failed candidate and record its review+ env:+ TAG: ${{ inputs.tag }}+ SHA: ${{ needs.resolve.outputs.sha }}+ CANDIDATE: ${{ needs.dev.outputs.candidate_id }}+ DIGEST: ${{ needs.dev.outputs.candidate_digest }}+ PINS: ${{ needs.dev.outputs.registry_digests }}+ EVIDENCE_ID: ${{ needs.dev.outputs.failure_evidence_id }}+ DEPLOYMENT_ATTEMPT: ${{ needs.dev.outputs.deployment_attempt }}+ run: node apps/infra/scripts/release-e2e-override.mjs+ - uses: actions/upload-artifact@v4+ with:+ name: dev-accepted-${{ needs.dev.outputs.candidate_id }}+ path: acceptance.json+ overwrite: true+ if-no-files-found: error+ - id: grant+ env:+ DEPLOYMENT_ATTEMPT: ${{ needs.dev.outputs.deployment_attempt }}+ run: echo "attempt=$DEPLOYMENT_ATTEMPT" >> "$GITHUB_OUTPUT"+accepted-candidate:name: Locate the previously accepted candidateneeds: resolve@@ -470,8 +733,8 @@ jobs:group: mbuild-release-assets-${{ inputs.tag }}queue: maxname: Attach verified release files- needs: [resolve, distribution, build-go, dev, accepted-candidate]- if: ${{ !cancelled() && github.ref == 'refs/heads/main' && ((needs.dev.outputs.accepted_attempt != '' && needs.distribution.result == 'success' && needs.build-go.result == 'success') || needs.accepted-candidate.result == 'success' || (needs.resolve.outputs.mode == 'component' && needs.distribution.result == 'success')) }}+ needs: [resolve, distribution, build-go, dev, e2e-override, accepted-candidate]+ if: ${{ !cancelled() && github.ref == 'refs/heads/main' && ((needs.dev.result == 'success' && (needs.dev.outputs.accepted_attempt != '' || (needs.e2e-override.result == 'success' && needs.e2e-override.outputs.attempt != '')) && needs.distribution.result == 'success' && needs.build-go.result == 'success') || needs.accepted-candidate.result == 'success' || (needs.resolve.outputs.mode == 'component' && needs.distribution.result == 'success')) }}outputs:candidate: ${{ needs.distribution.outputs.candidate_id || needs.accepted-candidate.outputs.id }}digest: ${{ needs.distribution.outputs.digest || needs.accepted-candidate.outputs.digest }}@@ -500,7 +763,8 @@ jobs:DEPLOYMENT_ID: ${{ needs.dev.outputs.candidate_id }}DEPLOYMENT_DIGEST: ${{ needs.dev.outputs.candidate_digest }}DEPLOYMENT_PINS: ${{ needs.dev.outputs.registry_digests }}- ACCEPTED_ATTEMPT: ${{ needs.dev.outputs.accepted_attempt }}+ E2E_WAIVED: ${{ needs.e2e-override.result == 'success' }}+ ACCEPTED_ATTEMPT: ${{ needs.dev.outputs.accepted_attempt || needs.e2e-override.outputs.attempt }}run: |set -euo pipefailgh run download "$GITHUB_RUN_ID" --repo "$GITHUB_REPOSITORY" --name "dev-accepted-$DEPLOYMENT_ID" --dir "$RUNNER_TEMP/dev-receipt"@@ -512,11 +776,12 @@ jobs:DIGEST: ${{ needs.distribution.outputs.digest }}TAG: ${{ inputs.tag }}SHA: ${{ needs.resolve.outputs.sha }}- ACCEPTED: ${{ needs.dev.outputs.accepted_attempt }}+ ACCEPTED: ${{ needs.dev.outputs.accepted_attempt || needs.e2e-override.outputs.attempt }}run: |- jq -n --argjson run "$GITHUB_RUN_ID" --argjson attempt "$ACCEPTED" --argjson id "$CANDIDATE" \+ jq --argjson run "$GITHUB_RUN_ID" --argjson attempt "$ACCEPTED" --argjson id "$CANDIDATE" \--arg digest "$DIGEST" --arg tag "$TAG" --arg sha "$SHA" \- '{run: $run, attempt: $attempt, candidate: $id, digest: $digest, tag: $tag, sha: $sha}' > acceptance.json+ '(. | {status, approval}) + {run: $run, attempt: $attempt, candidate: $id, digest: $digest, tag: $tag, sha: $sha}' \+ "$RUNNER_TEMP/dev-receipt/acceptance.json" > acceptance.json- uses: actions/upload-artifact@v4if: inputs.command == 'publish'with:@@ -847,8 +1112,11 @@ jobs:prod:name: Production deployment- needs: [resolve, dev]- if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' && needs.dev.outputs.accepted_attempt != '' }}+ needs: [resolve, dev, e2e-override]+ if: >-+ ${{ !cancelled() && github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' &&+ needs.dev.result == 'success' && (needs.dev.outputs.accepted_attempt != '' ||+ (needs.e2e-override.result == 'success' && needs.e2e-override.outputs.attempt != '')) }}permissions: *rollout-permissionsuses: ./.github/workflows/mdeploy-all.ymlwith:@@ -858,7 +1126,8 @@ jobs:candidate_id: ${{ needs.dev.outputs.candidate_id }}candidate_digest: ${{ needs.dev.outputs.candidate_digest }}registry_digests: ${{ needs.dev.outputs.registry_digests }}- accepted_attempt: ${{ needs.dev.outputs.accepted_attempt }}+ accepted_attempt: ${{ needs.dev.outputs.accepted_attempt || needs.e2e-override.outputs.attempt }}+ e2e_waived: ${{ needs.e2e-override.result == 'success' }}components: api+runnerapply: trueconfirm: true@@ -867,7 +1136,7 @@ jobs:report:name: Report release failure- needs: [resolve, build-runtime, build-wheels, build-node, build-c, build-go, build-runner-binary, publish, publish-runner, distribution, dev, accepted-candidate, attach, pypi, npm, tag-go-module, finalize, publish_crates]+ needs: [resolve, build-runtime, build-wheels, build-node, build-c, build-go, build-runner-binary, publish, publish-runner, draft-runtime, draft-wheels, draft-node, draft-c, draft-runner, distribution, dev, request-e2e-override, e2e-override, accepted-candidate, attach, pypi, npm, tag-go-module, finalize, publish_crates]if: ${{ always() && !inputs['build-only'] && github.ref == 'refs/heads/main' && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}permissions:contents: readdiff --git a/.github/workflows/mdeploy-all.yml b/.github/workflows/mdeploy-all.ymlindex c3c215366..51a36b55b 100644--- a/.github/workflows/mdeploy-all.yml+++ b/.github/workflows/mdeploy-all.yml@@ -23,6 +23,8 @@ on:candidate_digest: { required: false, type: string }registry_digests: { required: false, type: string }release_sha: { required: true, type: string }+ allow_e2e_override: { required: false, type: boolean, default: false }+ e2e_waived: { required: false, type: boolean, default: false }accepted_attempt: { required: false, type: string }components: { required: true, type: string }apply: { required: true, type: boolean }@@ -46,6 +48,12 @@ on:accepted_attempt:description: Release deployment attempt that passed cloud acceptancevalue: ${{ jobs.e2e.outputs.release_result == 'success' && jobs.plan.outputs.deployment_attempt || '' }}+ failure_evidence_id:+ description: Immutable failure evidence from a completed release test+ value: ${{ jobs.e2e.outputs.failure_evidence_id }}+ deployment_attempt:+ description: Attempt that applied the dev release candidate+ value: ${{ jobs.plan.outputs.deployment_attempt }}e2e_result:description: Dev cloud acceptance outcome for release failure reportingvalue: ${{ jobs.e2e.outputs.release_result }}@@ -396,6 +404,8 @@ jobs:name: Verify dev acceptance for the production candidateif: inputs.release_sha && inputs.stage == 'prod'env:+ E2E_WAIVED: ${{ inputs.e2e_waived }}+ PINS: ${{ inputs.registry_digests }}ACCEPTED_ATTEMPT: ${{ inputs.accepted_attempt }}CANDIDATE: ${{ inputs.candidate_id }}DIGEST: ${{ inputs.candidate_digest }}@@ -407,9 +417,14 @@ jobs:[[ "$ACCEPTED_ATTEMPT" =~ ^[1-9][0-9]*$ && "$ACCEPTED_ATTEMPT" -le "$GITHUB_RUN_ATTEMPT" ]]receipt=$(mktemp -d "$RUNNER_TEMP/acceptance.XXXXXX")gh run download "$GITHUB_RUN_ID" --repo "$GITHUB_REPOSITORY" --name "dev-accepted-$CANDIDATE" --dir "$receipt"- jq -e --argjson run "$GITHUB_RUN_ID" --argjson id "$CANDIDATE" --argjson attempt "$ACCEPTED_ATTEMPT" \+ decision=passed+ if [[ "$E2E_WAIVED" == true ]]; then decision=waived; fi+ jq -e --arg decision "$decision" --argjson pins "$PINS" --argjson run "$GITHUB_RUN_ID" --argjson id "$CANDIDATE" --argjson attempt "$ACCEPTED_ATTEMPT" \--arg digest "$DIGEST" --arg tag "$TAG" --arg sha "$SHA" \- '.run == $run and .candidate == $id and .attempt == $attempt and .digest == $digest and .tag == $tag and .sha == $sha' \+ '.status == $decision and (.status == "passed" or (+ all(.approval.reviewer, .approval.reason; type == "string" and length > 0) and+ (.approval.evidence_id | test("^[1-9][0-9]*$")) and .images == $pins.images and .runner == $pins.runner+ )) and .run == $run and .candidate == $id and .attempt == $attempt and .digest == $digest and .tag == $tag and .sha == $sha' \"$receipt/acceptance.json" >/dev/null- name: Read immutable release image and Runner digests@@ -455,6 +470,7 @@ jobs:SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}DEPLOY_ENVIRONMENT: ${{ inputs.stage }}APPROVAL_PHASE: Release deployment approval+ E2E_WAIVED: ${{ inputs.e2e_waived }}ACCEPTED_TAG: ${{ inputs.stage == 'prod' && inputs.accepted_attempt && inputs.ref || '' }}run: node apps/infra/scripts/release-pipeline.mjs approval@@ -749,6 +765,7 @@ jobs:tag: ${{ inputs.ref }}candidate_id: ${{ needs.resolve.outputs.candidate_id }}candidate_digest: ${{ needs.resolve.outputs.candidate_digest }}+ allow_e2e_override: ${{ inputs.allow_e2e_override }}deployment_attempt: ${{ needs.plan.outputs.deployment_attempt || 'missing' }}secrets:BOXLITE_DEV_API_KEY: ${{ secrets.BOXLITE_DEV_API_KEY }}diff --git a/.github/workflows/release-draft-component.yml b/.github/workflows/release-draft-component.ymlnew file mode 100644index 000000000..4d1a6d321--- /dev/null+++ b/.github/workflows/release-draft-component.yml@@ -0,0 +1,39 @@+name: Upload component to release draft++on:+ workflow_call:+ inputs:+ tag: { required: true, type: string }+ sha: { required: true, type: string }+ release_id: { required: true, type: string }+ group: { required: true, type: string }++permissions:+ contents: write+ actions: read++concurrency:+ group: mbuild-release-assets-${{ inputs.tag }}+ cancel-in-progress: false+ queue: max++jobs:+ upload:+ if: github.ref == 'refs/heads/main'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v5+ with:+ persist-credentials: false+ - uses: actions/download-artifact@v4+ with:+ pattern: ${{ format('{0}*', inputs.group) }}+ path: staged+ - name: Verify and upload this component's draft files+ env:+ GH_TOKEN: ${{ github.token }}+ TAG: ${{ inputs.tag }}+ SHA: ${{ inputs.sha }}+ RELEASE_ID: ${{ inputs.release_id }}+ COMPONENT_GROUP: ${{ inputs.group }}+ run: node apps/infra/scripts/release-candidate.mjs draft-componentdiff --git a/.github/workflows/release-source-build.yml b/.github/workflows/release-source-build.ymlnew file mode 100644index 000000000..f830dea74--- /dev/null+++ b/.github/workflows/release-source-build.yml@@ -0,0 +1,69 @@+name: Standalone component build++on:+ workflow_call:+ inputs:+ ref:+ description: Resolved source commit+ type: string+ required: true+ builds:+ description: JSON array of selected components and their prerequisites+ type: string+ required: true+ linux_x64_only:+ description: Only build the C SDK required by the Linux Runner+ type: boolean+ required: true++permissions:+ contents: read++jobs:+ build-runtime:+ if: contains(fromJSON(inputs.builds), 'runtime')+ uses: ./.github/workflows/build-runtime.yml+ permissions:+ contents: read+ id-token: write+ attestations: write+ with:+ ref: ${{ inputs.ref }}+ tag: ''++ build-wheels:+ if: contains(fromJSON(inputs.builds), 'wheels')+ uses: ./.github/workflows/build-wheels.yml+ with:+ ref: ${{ inputs.ref }}++ build-node:+ if: contains(fromJSON(inputs.builds), 'node')+ uses: ./.github/workflows/build-node.yml+ with:+ ref: ${{ inputs.ref }}++ build-c:+ if: contains(fromJSON(inputs.builds), 'c')+ uses: ./.github/workflows/build-c.yml+ with:+ ref: ${{ inputs.ref }}+ linux_x64_only: ${{ inputs.linux_x64_only }}++ build-go:+ needs: build-c+ if: contains(fromJSON(inputs.builds), 'go')+ permissions:+ contents: read+ actions: read+ uses: ./.github/workflows/build-go.yml+ with:+ ref: ${{ inputs.ref }}++ build-runner-binary:+ needs: build-c+ if: contains(fromJSON(inputs.builds), 'runner')+ uses: ./.github/workflows/build-runner-binary.yml+ with:+ ref: ${{ inputs.ref }}+ libboxlite_source: artifactdiff --git a/apps/infra/deployment/release-safety.test.ts b/apps/infra/deployment/release-safety.test.tsindex 0995debe3..f34b80fa5 100644--- a/apps/infra/deployment/release-safety.test.ts+++ b/apps/infra/deployment/release-safety.test.ts@@ -1461,7 +1461,12 @@ test('cloud E2E requires the dev identity lane and forwards its scoped credentiaassert.equal(identity.env.BOXLITE_E2E_REQUIRE_IDENTITIES, '1')assertShellLine(identity.run, /make test:rest:e2e.*FILTER=preview_private_identity_permissions/)assertShellLine(identity.run, /unset BOXLITE_E2E_API_URL BOXLITE_E2E_API_KEY BOXLITE_E2E_PREFIX/)- assert.equal(identity['continue-on-error'], undefined)+ assert.equal(+ identity['continue-on-error'],+ "${{ inputs.allow_e2e_override && inputs.stage == 'dev' && inputs.candidate_id != '' && inputs.deployment_attempt != '' }}",+ )+ assert.equal(workflow.on.workflow_call.inputs.allow_e2e_override.default, false)+ assert.equal(steps.find((step: any) => step.id === 'verdict').env.IDENTITY_RESULT, '${{ steps.identity.outcome }}')const configure = steps.find((step: any) => step.name === 'Configure pytest profiles')assert.ok(configure)@@ -1711,7 +1716,7 @@ test('a job calling a reusable workflow grants at least what that workflow asks}}// Keep the permission sweep in sync with every local workflow call.- assert.equal(checked, 16, `expected every local reusable call to be swept, saw ${checked}`)+ assert.equal(checked, 28, `expected every local reusable call to be swept, saw ${checked}`)})test('every reusable workflow is called with the inputs it declares', () => {@@ -1751,8 +1756,8 @@ test('every reusable workflow is called with the inputs it declares', () => {checked += 1}}- // Three configuration calls, four deploy-infra calls, eight release calls and one mdeploy-all E2E call.- assert.equal(checked, 16, `expected every reusable-workflow call swept, saw ${checked}`)+ // Three configuration calls, four deploy-infra calls, fourteen release calls, six standalone build calls and one mdeploy-all E2E call.+ assert.equal(checked, 28, `expected every reusable-workflow call swept, saw ${checked}`)})/**@@ -1844,7 +1849,7 @@ test('every workflow that selects a deployment Environment does so from an allow// line. Listed here deliberately: the point of pinning the set is that a// seventh deploy workflow is a reviewed addition rather than one that// appeared.- ['build-apps-api-image.yml', 'deploy-infra.yml', 'deploy-release.yml', 'mbuild.yml', 'mdeploy-all.yml', 'publish-plugins.yml'],+ ['build-apps-api-image.yml', 'deploy-infra.yml', 'deploy-release.yml', 'mbuild-release.yml', 'mbuild.yml', 'mdeploy-all.yml', 'publish-plugins.yml'],'the swept set no longer matches the deployment workflows',)})diff --git a/apps/infra/deployment/workflow-checks.test.ts b/apps/infra/deployment/workflow-checks.test.tsindex fc313b228..eebde6074 100644--- a/apps/infra/deployment/workflow-checks.test.ts+++ b/apps/infra/deployment/workflow-checks.test.ts@@ -129,7 +129,14 @@ test('Linux x64 wheel packaging initializes the host Python used by cibuildwheelconst python = steps.findIndex((step: any) => step.uses?.startsWith('actions/setup-python@'))const build = steps.findIndex((step: any) => step.uses?.startsWith('pypa/cibuildwheel@'))assert.ok(python >= 0 && python < build, 'prepare the host interpreter before invoking cibuildwheel')- assert.equal(steps[python].if, "matrix.os == 'ubuntu-latest'")+ const guard = new Parser(new Lexer(steps[python].if).lex().tokens, ['matrix', 'steps'], []).parse()+ for (const os of ['ubuntu-latest', 'ubuntu-24.04-arm', 'macos-15']) {+ for (const hit of ['true', '']) {+ const context = { matrix: { os }, steps: { cache: { outputs: { hit } } } }+ const actual = new Evaluator(guard, JSON.parse(JSON.stringify(context), data.reviver)).evaluate()+ assert.equal(actual.coerceString(), String(os === 'ubuntu-latest' && hit !== 'true'))+ }+ }assert.equal(steps[python].with['python-version'], '3.11 - 3.13')})diff --git a/apps/infra/docs/release.md b/apps/infra/docs/release.mdindex 4798df7a2..aea7f0b84 100644--- a/apps/infra/docs/release.md+++ b/apps/infra/docs/release.md@@ -18,18 +18,37 @@ The run creates the draft or selects the existing draft for that tag. Configure| Stage | Outputs and checks || --- | --- || Build | Runtime and CLI, wheels, npm packages and C SDK archives build in parallel and enter Actions Artifacts. Go tests and the Linux Runner build link the C archives from this run. |-| Prepare dev | `mbuild publish` pushes the declared images to GHCR. The Runner job uploads the original tarball as an OCI layer. Once the GHCR producers finish, the dev preparation job verifies image and Runner digests, saves the deployment candidate and requests dev approval. SDK tests and distribution packaging continue in parallel. |+| Fill the draft | Each completed Runtime, wheels, Node, C or Runner component uploads its verified assets to the draft. The complete distribution job checks all asset digests and writes `release-candidate.json` last. |+| Prepare dev | `mbuild publish` pushes the declared images to GHCR. The Runner job uploads the original tarball as an OCI layer. Once the GHCR producers and the Runtime, C, wheels and Node build workflows finish, dev preparation verifies the image and Runner digests, saves the deployment candidate and requests approval. A failed prerequisite stops dev before it acquires the stage lock. || Dev approval and E2E | Approve the dev Environment in the run. The cloud suite reads only the Linux x64 CLI, Python wheel, C SDK and two npm tarballs from this run. It records their checksums with the accepted deployment digests. |-| Publish | Dev E2E success opens prod approval immediately. In parallel, publication waits for the complete distribution and Go tests, compares the tested client bytes, and attaches the verified files to the draft. The top-level PyPI and npm jobs publish the accepted packages. |+| Publish | A passing dev E2E or a recorded [waiver](#review-a-failed-dev-e2e) opens prod approval immediately. In parallel, publication waits for the complete distribution and Go tests, compares the tested client bytes against the draft and records the accepted candidate. The top-level PyPI and npm jobs publish the accepted packages. || Release and prod | When those publishers succeed, the workflow marks the draft public. Rust crates can then publish, and the Go job verifies the public C SDK downloads before tagging the tested commit. Approved prod deployment uses the same GHCR digests and can finish while the release is still a draft. |The C SDK and Runner workflows each load CI configuration and validate the build commit in one preparation job. A regular release skips the lookup for a previous acceptance receipt. Once its own attachments succeed, npm and PyPI can start. Finalization requires both to succeed.The Runner package at `ghcr.io/boxlite-ai/boxlite/runner` must allow anonymous pulls from hosts. First boot and in-place upgrade verify the OCI manifest against the release tag, source commit and archive digest before extracting the binary. Dev and prod receive those pins from the candidate. A version-only manual rollout reads the same pins from the published `release-candidate.json`.+### Review a failed dev E2E++During a full release on `main`, all three dev test lanes must produce JUnit results. If a test fails, the release webhook sends **View failed E2E logs** and **Review E2E waiver** to Release Slack. A deployment failure, missing client, missing report, pytest setup error or cancellation stops the release.++1. Inspect the failed attempt, then open **Review deployments → release-e2e-override** in the same run.+2. To proceed, enter `waive <evidence-ID> <reason>` in the review comment and approve. Copy the evidence ID from Slack or the run summary, for example `waive 809 known failure tracked in #123`. Rejecting the request blocks automatic publication and prod.+3. The workflow records the GitHub reviewer and reason against the tested artifacts, then starts publication and requests the separate prod approval. The prod webhook reports **dev E2E failed · waived**.++The waiver Environment requires reviewers, allows the `main` branch only, and has no cloud credentials. The dev deployment lock is free while reviewers decide. To retest, cancel the waiting run and choose **Re-run all jobs** so the same attempt deploys and tests the candidate.++A new failure artifact needs its own approval. Standalone E2E runs keep their normal failure behavior.+### Retries-Rerunning the API build replaces that API version's GHCR tag with the rebuilt manifest. Other successful matrix entries keep their digests. A failed Docker upload retries the image already built by that job.+**Re-run all jobs** checks the original producer's successful job record for this run, tag and source commit. Each platform restores its files from Actions Cache, verifies the recorded file set and SHA-256 digests, and uploads fresh Actions Artifacts for this attempt. A missing cache, changed file or failed producer rebuilds that platform.++A partial rerun can copy an earlier job’s execution timeline under a new check ID. The planner keeps the original receipt, while a later build or failure supersedes it.++The Runner build also checks the input C library digest. Each GHCR publisher checks the live tag against the cached manifest while holding its publication lock. Before uploading Runner pins, it resolves the tag anonymously, reads the manifest, and downloads and hashes the blob against this run’s archive. Packaging, draft attachment and dev acceptance use the current attempt's uploads even when every platform reused its build.++**Re-run a specific build job** uses the previous attempt's selection and rebuilds the selected producer. Selecting an individual API image rebuilds and replaces that version's API tag. Starting a new release run or a standalone component publication builds fresh outputs.For a failed production job, use **Re-run failed jobs** in the original release run. Before requesting approval and after approval, production checks the saved dev acceptance against the run ID, accepted attempt, candidate artifact ID, manifest digest, tag and source commit. A different candidate needs its own dev E2E.@@ -72,10 +91,25 @@ If Go tagging fails on a draft, finish the full release first. On a public ReleaFor example, `gh workflow run mbuild-release.yml --ref main -f command=publish-wheels -f tag=v1.2.3` selects fresh wheel publication. Set `build-only=true` to keep a standalone build in Actions. Use `source-ref` to build a branch or commit. A complete `publish` with `build-only=true` stages the GHCR images and Runner.+A standalone build can restore existing GitHub Actions caches and upload its artifacts. GitHub grants it read-only cache access because its source can be a PR branch even when the dispatch runs on `main`. A tagged full release can save verified outputs for another attempt of that run.+Component builds can overlap while a full release waits for prod approval. Jobs writing the same Release assets take a per-tag lock. Package publishers take a lock per registry and version. GitHub allows up to 100 pending jobs per group with `queue: max`.On a full release retry, a rebuilt macOS wheel changes the distribution manifest. The run verifies all files again. It can reuse successful dev E2E if every tested Linux client hash and every deployment digest still matches the receipt.+### Resume from a complete draft++A partial draft contains the components that finished. Sealing and final publication both compare the live managed attachments with the candidate. If a rebuild drops or renames a distribution file, the workflow stops and lists the extra filenames for a maintainer to review and remove before retrying.++Maintainer attachments such as release notes can stay alongside the distribution. When a rebuild changes draft bytes, the workflow removes the old manifest before replacing its first changed attachment.++1. Stop new publications for the tag. In Actions, cancel every queued or running full release, component publication and repair for that tag, including runs waiting for approval.+2. Wait until all of those runs show **Completed**. A cancellation request can leave an attachment upload in progress. The GitHub Release page operates outside the workflow's concurrency group.+3. Check the draft assets against the complete `release-candidate.json` and confirm the intended dev acceptance before clicking **Publish release**. A partial draft can lack the manifest or a component even if other assets are visible.+4. After publication, use the component repair commands below for missing attachments. A manual production deployment still requires its own approval.++Dispatch `mdeploy-all` on `main` with the public tag and `stage=prod` to deploy its pinned artifacts through prod approval. Check PyPI, npm, crates.io and the Go module separately because publishing through the GitHub UI leaves their status unchanged.+### Manually republish a componentOpen **Actions → mbuild-release → Run workflow** on `main`, select the product tag and choose `repair-runtime`, `repair-wheels`, `repair-node` or `repair-c`. Enter the candidate artifact ID from the original run. The matching dev acceptance receipt and candidate artifact must still be available. This command rechecks the tag and candidate and restores the selected attachments. Wheel and Node repairs also run the top-level PyPI or npm publisher. A repair on a draft leaves publication and prod approval to the original run.@@ -90,4 +124,4 @@ Approve each cloud Environment in the parent run. The dev deployment and E2E sha| Standalone dev and stage rollout results | Dev Slack || Standalone prod approval and rollout result | Release Slack |-Deployment results include a button to the originating run. The prod approval message includes successful dev acceptance. For standalone deployments, use the [deployment runbook](deployment.md#deploy-through-github-actions).+Deployment results include a button to the originating run. The prod approval message shows whether dev E2E passed or a reviewer waived the failure. For standalone deployments, use the [deployment runbook](deployment.md#deploy-through-github-actions).diff --git a/apps/infra/mbuild/test/mbuild-release-workflow.test.ts b/apps/infra/mbuild/test/mbuild-release-workflow.test.tsindex 7eaabdaf4..8abf733c4 100644--- a/apps/infra/mbuild/test/mbuild-release-workflow.test.ts+++ b/apps/infra/mbuild/test/mbuild-release-workflow.test.ts@@ -13,7 +13,7 @@ const commands = source.split('\n').filter((line) => !/^\s*#/.test(line)).join('test('release publication runs from main with package write access and no cloud environment', () => {for (const [name, job] of Object.entries<any>(workflow.jobs)) {assert.match(job.if, /github\.ref == 'refs\/heads\/main'/, name)- assert.equal(job.environment, undefined)+ assert.equal(job.environment, name === 'e2e-override' ? 'release-e2e-override' : undefined)}assert.equal(workflow.jobs.publish.permissions.packages, 'write')assert.equal(workflow.permissions['id-token'], undefined)diff --git a/apps/infra/mdeploy/test/stage-e2e.test.ts b/apps/infra/mdeploy/test/stage-e2e.test.tsindex a2cab4117..85b3c40e7 100644--- a/apps/infra/mdeploy/test/stage-e2e.test.ts+++ b/apps/infra/mdeploy/test/stage-e2e.test.ts@@ -26,6 +26,7 @@ const evaluate = (key: 'inputs',value: new data.Dictionary({ key: 'stage', value: new data.StringData(stage) },+ { key: 'allow_e2e_override', value: new data.BooleanData(false) },{ key: 'sweep', value: new data.BooleanData(sweepRequested) },{ key: 'api_url', value: new data.StringData(apiUrl) },{ key: 'tag', value: new data.StringData(tag) },@@ -93,7 +94,10 @@ test('catalog cases use independent quota in a separate dev/stage process', () =assert.equal(catalog.env.BOXLITE_E2E_PROFILE, 'p2')assert.match(catalog.run, /unset BOXLITE_E2E_API_URL BOXLITE_E2E_API_KEY BOXLITE_E2E_PREFIX/)assert.match(catalog.run, /make test:rest:e2e AUTH=api-key FILTER=images_catalog/)- assert.equal(catalog['continue-on-error'], undefined)+ for (const stage of ['dev', 'stage', 'prod']) {+ assert.equal(evaluate(catalog['continue-on-error'], stage).coerceString(), 'false')+ }+ assert.equal(steps.find((step: any) => step.id === 'verdict').env.CATALOG_RESULT, '${{ steps.catalog.outcome }}')for (const stage of ['', 'dev', 'stage', 'prod', 'typo']) {assert.equal(evaluate(catalog.if, stage).coerceString(), String(['', 'dev', 'stage'].includes(stage)))}diff --git a/apps/infra/scripts/release-build-plan.mjs b/apps/infra/scripts/release-build-plan.mjsnew file mode 100644index 000000000..2a4c236d7--- /dev/null+++ b/apps/infra/scripts/release-build-plan.mjs@@ -0,0 +1,70 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 BoxLite AI+import assert from 'node:assert/strict'+import { execFileSync } from 'node:child_process'+import { createHash } from 'node:crypto'+import { appendFileSync } from 'node:fs'+import { pathToFileURL } from 'node:url'++export function buildKey(tag, sha, run) {+ assert.match(tag, /^v\d+\.\d+\.\d+$/)+ assert.match(sha, /^[0-9a-f]{40}$/)+ assert.match(String(run), /^[1-9]\d*$/)+ return 'release-output-v1-' + createHash('sha256').update([tag, sha, run].join('@')).digest('base64url')+}++const hash = /^[0-9a-f]{64}$/+export function planBuilds({ key, attempt, jobs }) {+ // A subsequent failure or explicit rebuild supersedes the earlier output, even if its cache survives.+ const latest = new Map()+ const executions = new Set()+ for (const job of [...jobs].sort((a, b) => a.run_attempt - b.run_attempt)) {+ if (job.run_attempt >= attempt || job.conclusion === 'skipped') continue+ // Partial reruns can copy the entire execution timeline into a later attempt with a new check ID.+ if (job.started_at && job.completed_at && Array.isArray(job.steps)) {+ const timeline = job.steps.map(step => [step.number, step.name, step.status, step.conclusion, step.started_at, step.completed_at])+ const execution = JSON.stringify([job.name, job.started_at, job.completed_at, job.conclusion, timeline])+ if (executions.has(execution)) continue+ executions.add(execution)+ }+ const saved = job.steps?.find(step => step.name.startsWith('Build cache receipt ') && step.conclusion === 'success')+ const reused = job.steps?.some(step => step.name === 'Save release build cache' && step.conclusion === 'skipped')+ if (job.conclusion === 'success' && !saved && reused) continue+ latest.set(job.name, { job, saved })+ }+ const sources = {}+ for (const { job, saved } of latest.values()) {+ if (job.conclusion !== 'success' || !saved) continue+ // The receipt digest comes from the original job's GitHub timeline, outside the mutable cache service.+ const source = saved.name.slice('Build cache receipt '.length)+ const [prefix, unit, origin, check, receipt, manifest, ...extra] = source.split('.')+ if (prefix !== key || !hash.test(receipt) || extra.length || !/^[a-z][a-z0-9-]*$/.test(unit)) continue+ if (job.run_attempt !== Number(origin) || check !== job.check_run_url?.split('/').pop()) continue+ if (unit.startsWith('ghcr-') && !hash.test(manifest)) continue+ sources[unit] = source+ }+ return { key, attempt, sources }+}++function pages(path, field) {+ const data = execFileSync('gh', ['api', '--paginate', '--slurp', 'repos/' + process.env.GITHUB_REPOSITORY + '/actions/' + path],+ { encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 })+ return JSON.parse(data).flatMap(page => page[field])+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ const { TAG, SHA, GITHUB_RUN_ID, GITHUB_RUN_ATTEMPT, GITHUB_OUTPUT } = process.env+ const attempt = Number(GITHUB_RUN_ATTEMPT)+ assert.ok(Number.isSafeInteger(attempt) && attempt > 0)+ const key = buildKey(TAG, SHA, GITHUB_RUN_ID)+ let sources = {}+ if (attempt > 1) {+ try {+ const jobs = pages('runs/' + GITHUB_RUN_ID + '/jobs?filter=all&per_page=100', 'jobs')+ sources = planBuilds({ key, attempt, jobs }).sources+ } catch (error) {+ console.warn('Build cache lookup unavailable; rebuilding: ' + error.message)+ }+ }+ appendFileSync(GITHUB_OUTPUT, 'plan=' + JSON.stringify({ key, attempt, sources }) + '\n')+}diff --git a/apps/infra/scripts/release-build-plan.test.mjs b/apps/infra/scripts/release-build-plan.test.mjsnew file mode 100644index 000000000..3c6195d29--- /dev/null+++ b/apps/infra/scripts/release-build-plan.test.mjs@@ -0,0 +1,65 @@+import assert from 'node:assert/strict'+import { readFileSync } from 'node:fs'+import test from 'node:test'+import { load } from 'js-yaml'+import { buildKey, planBuilds } from './release-build-plan.mjs'++const sha = '1'.repeat(40)+const receipt = '2'.repeat(64)+const manifest = '3'.repeat(64)+const key = buildKey('v1.2.3', sha, 10)+const workflow = load(readFileSync(new URL('../../../.github/workflows/mbuild-release.yml', import.meta.url)))+const receiptStep = workflow.jobs.publish.steps.find(step => step.name?.includes('steps.saved.outputs.key')).name++function producer(unit, attempt, check, published = '') {+ const source = [key, unit, attempt, check, receipt, published].join('.')+ return {+ name: unit, run_attempt: attempt, check_run_url: 'https://api.github.com/repos/boxlite-ai/boxlite/check-runs/' + check,+ conclusion: 'success',+ steps: [{ name: receiptStep.replace('${{ steps.saved.outputs.key }}', source), conclusion: 'success' }],+ }+}+const select = (jobs, options) => planBuilds({ key, attempt: 4, jobs, ...options }).sources++test('resolve uses the completed producer receipt even after GitHub removes all previous artifacts', () => {+ const job = producer('wheels-ubuntu-latest', 1, 123)+ const previousHit = { ...job, run_attempt: 2, steps: [{ name: 'Save release build cache', conclusion: 'skipped' }] }+ assert.equal(select([previousHit, job])[job.name], [key, job.name, 1, 123, receipt, ''].join('.'))+ for (const wrongKey of [buildKey('v1.2.4', sha, 10), buildKey('v1.2.3', 'a'.repeat(40), 10), buildKey('v1.2.3', sha, 11)])+ assert.deepEqual(select([job], { key: wrongKey }), {})+ assert.deepEqual(select([{ ...job, check_run_url: 'checks/124' }]), {})+ assert.deepEqual(select([{ ...job, run_attempt: 2 }]), {})+ assert.deepEqual(select([{ ...job, steps: [{ ...job.steps[0], conclusion: 'skipped' }] }]), {})+ for (const conclusion of ['failure', 'timed_out', 'cancelled'])+ assert.deepEqual(select([job, { ...previousHit, conclusion }]), {})+ assert.deepEqual(select([job, { ...previousHit, steps: [] }]), {}, 'unknown later output invalidates the old receipt')+ const rebuilt = producer(job.name, 3, 456)+ assert.equal(select([rebuilt, previousHit, job])[job.name], [key, job.name, 3, 456, receipt, ''].join('.'))+})++test('only well-formed GHCR receipt digests reach publisher jobs', () => {+ for (const name of ['api','runner']) {+ const job = producer('ghcr-' + name, 1, 123, manifest)+ assert.ok(select([job])[job.name])+ assert.deepEqual(select([producer(job.name, 1, 123, 'invalid')]), {})+ }+})++test('carried jobs retain the originating check and cannot undo a real rebuild or failure', () => {+ // GitHub run 46630105219 retained the macOS wheel timeline from attempt 2 in attempt 5.+ const built = { ...producer('wheels-macos-15', 2, 142585460576),+ started_at: '2026-12-01T10:58:35Z', completed_at: '2026-12-01T11:31:41Z' }+ const copy = { ...built, run_attempt: 5, check_run_url: 'checks/142687754565' }+ const retry = jobs => select(jobs, { attempt: 6 })+ const first = retry([built])+ assert.ok(first[built.name])+ assert.deepEqual(retry([copy, built]), first)+ assert.deepEqual(retry([copy]), {}, 'a copy alone cannot authenticate a receipt')+ const failed = { ...built, run_attempt: 3, conclusion: 'failure', steps: [] }+ assert.deepEqual(retry([copy, built, failed]), {})+ const replacement = { ...producer(built.name, 4, 4321), started_at: built.started_at, completed_at: built.completed_at }+ assert.deepEqual(retry([copy, replacement, built]), retry([replacement]))+ assert.notDeepEqual(retry([replacement]), first)+ const failedCopy = { ...failed, run_attempt: 5, check_run_url: 'checks/12345' }+ assert.deepEqual(retry([failedCopy, failed, replacement]), retry([replacement]))+})diff --git a/apps/infra/scripts/release-candidate-stage.test.mjs b/apps/infra/scripts/release-candidate-stage.test.mjsindex 3f3c3446e..d41943c7b 100644--- a/apps/infra/scripts/release-candidate-stage.test.mjs+++ b/apps/infra/scripts/release-candidate-stage.test.mjs@@ -1,7 +1,7 @@import assert from 'node:assert/strict'import { spawnSync } from 'node:child_process'import { createHash } from 'node:crypto'-import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { appendFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'import { tmpdir } from 'node:os'import { join } from 'node:path'import test from 'node:test'@@ -55,10 +55,24 @@ test('stage binds candidate files and GHCR pins to the tagged commit and producecase "$*" in*commits/refs%2Ftags%2F*) printf '{"sha":"%s"}\\n' "$SHA" ;;*actions/runs/10/artifacts*) cat index.json ;;- *attempts/2/jobs*) cat jobs.json ;;*releases/7/assets*) jq -s '[.]' uploads.jsonl ;;- *releases/7) printf '{"tag_name":"v1.2.3","draft":true}' ;;- 'release upload '*) name=$(basename "$4"); digest=$(shasum -a 256 "$4" | cut -d' ' -f1); jq -nc --arg name "$name" --arg digest "sha256:$digest" '{name:$name,digest:$digest,state:"uploaded"}' >>uploads.jsonl ;;+ 'api --method PATCH '*) touch public ;;+ *releases/7) if test -f public; then printf '{"tag_name":"v1.2.3","draft":false}'; else printf '{"tag_name":"v1.2.3","draft":true}'; fi ;;+ 'api --method DELETE '*)+ id=$(basename "$4")+ jq -sc --argjson id "$id" '.[]|select(.id != $id)' uploads.jsonl > next+ mv next uploads.jsonl+ echo "delete $id" >>changes ;;+ 'release upload '*)+ name=$(basename "$4")+ digest=$(shasum -a 256 "$4" | cut -d' ' -f1)+ if test "$7" = '--clobber'; then+ jq -sc --arg name "$name" '.[]|select(.name != $name)' uploads.jsonl > next+ mv next uploads.jsonl+ fi+ echo "upload $name" >>changes+ id=$(wc -l <changes)+ jq -nc --argjson id "$id" --arg name "$name" --arg digest "sha256:$digest" '{id:$id,name:$name,digest:$digest,state:"uploaded"}' >>uploads.jsonl ;;*) exit 2 ;;esac`,@@ -108,6 +122,65 @@ esacconst names = readFileSync(join(dir, 'uploads.jsonl'), 'utf8').trim().split('\n').map((line) => JSON.parse(line).name)assert.deepEqual(names.sort(), Object.keys(runtime).sort(), 'Each runtime file, including install.sh.sha256, uploads exactly once across retries')}+ const draft = (group, output) => stage(output, 'draft-component', { COMPONENT_GROUP: group, IMAGES: '[]', RELEASE_ID: '7' })+ const seal = () => stage('candidate', 'draft-manifest', { CANDIDATE_DIGEST: fingerprint, RELEASE_ID: '7' })+ const assets = () => readFileSync(join(dir, 'uploads.jsonl'), 'utf8').trim().split('\n').filter(Boolean).map(line => JSON.parse(line))+ writeFileSync(join(dir, 'uploads.jsonl'), '')+ const first = draft('runtime-distribution', 'early-runtime')+ assert.equal(first.status, 0, first.stderr)+ assert.deepEqual(assets().map(asset => asset.name).sort(), runtimeNames.sort())+ assert.match(seal().stderr, /Draft asset missing or different/)+ for (const [n, group] of ['wheels-', 'node-packages', 'c-sdk-', 'runner-linux-amd64'].entries()) {+ const partial = draft(group, 'early-' + n)+ assert.equal(partial.status, 0, partial.stderr)+ }+ // An older wheel was attached by a successful build but is absent from this candidate.+ const staleWheel = 'boxlite-' + version + '-cp311-cp311-macosx_11_0_arm64.whl'+ const obsolete = join(dir, 'staged/wheels-macos-15', staleWheel)+ writeFileSync(obsolete, 'previous wheel')+ const previousWheels = draft('wheels-', 'previous-wheels')+ assert.equal(previousWheels.status, 0, previousWheels.stderr)+ rmSync(obsolete)+ const replaced = draft('wheels-', 'current-wheels')+ assert.equal(replaced.status, 0, replaced.stderr)+ const unrelated = { id: 501, name: 'maintainer-notes.pdf', state: 'uploaded', digest: hash('notes') }+ appendFileSync(join(dir, 'uploads.jsonl'), JSON.stringify(unrelated) + '\n')+ const extra = assets().find(asset => asset.name === staleWheel)+ const setAssets = list => writeFileSync(join(dir, 'uploads.jsonl'), list.map(item => JSON.stringify(item)).join('\n') + '\n')+ await t.test('seal names an obsolete managed attachment before writing the manifest', () => {+ const changes = readFileSync(join(dir, 'changes'), 'utf8')+ const rejected = seal()+ assert.notEqual(rejected.status, 0, 'sealed a draft containing a stale wheel')+ assert.ok(rejected.stderr.includes(staleWheel), rejected.stderr)+ assert.equal(readFileSync(join(dir, 'changes'), 'utf8'), changes)+ })+ setAssets(assets().filter(asset => asset.name !== staleWheel && asset.name !== 'release-candidate.json'))+ const sealed = seal()+ assert.equal(sealed.status, 0, sealed.stderr)+ assert.equal(assets().at(-1).name, 'release-candidate.json')+ assert.ok(assets().some(asset => asset.name === unrelated.name))+ await t.test('finalize checks the live assets again before making the draft public', () => {+ appendFileSync(join(dir, 'uploads.jsonl'), JSON.stringify(extra) + '\n')+ const final = stage('candidate', 'finalize', { CANDIDATE_DIGEST: fingerprint, RELEASE_ID: '7' })+ assert.notEqual(final.status, 0, 'published a stale wheel added after sealing')+ assert.ok(final.stderr.includes(staleWheel), final.stderr)+ assert.equal(existsSync(join(dir, 'public')), false)+ })+ setAssets(assets().filter(asset => asset.name !== staleWheel))+ const old = assets().at(-1)+ writeFileSync(join(dir, 'public'), '')+ const original = readFileSync(join(runtimeDir, 'install.sh'))+ writeFileSync(join(runtimeDir, 'install.sh'), 'rebuilt installer')+ assert.match(draft('runtime-distribution', 'public-refused').stderr, /Expected the matching draft release/)+ assert.equal(assets().at(-1).id, old.id)+ rmSync(join(dir, 'public'))+ const updated = draft('runtime-distribution', 'replaced-draft')+ assert.equal(updated.status, 0, updated.stderr)+ assert.deepEqual(readFileSync(join(dir, 'changes'), 'utf8').trim().split('\n').slice(-2), ['delete ' + old.id, 'upload install.sh'])+ assert.ok(!assets().some(asset => asset.name === 'release-candidate.json'))+ assert.equal(assets().find(asset => asset.name === 'install.sh').digest, hash('rebuilt installer'))+ assert.match(seal().stderr, /Draft asset missing or different: install.sh/)+ writeFileSync(join(runtimeDir, 'install.sh'), original)const e2e = join(dir, 'linux-clients')const clients = {}for (const [group, files] of Object.entries(linuxClients(tag))) {@@ -157,23 +230,16 @@ esacif (!index.some((item) => item.name === name)) index.push({ name, id: index.length + 1, expired: false })}writeFileSync(join(dir, 'index.json'), JSON.stringify([{ artifacts: index }]))- writeFileSync(- join(dir, 'jobs.json'),- JSON.stringify([{ jobs: [{ name: 'build-runtime / Build Runtime (darwin-arm64)', status: 'in_progress' }] }]),- )const ready = stage('unused', 'client-ids')assert.equal(ready.status, 0, ready.stderr)assert.deepEqual(ready.stdout.trim().split(',').map(Number),Object.keys(linuxClients(tag)).map((name) => index.find((item) => item.name === name).id),)- writeFileSync(- join(dir, 'jobs.json'),- JSON.stringify([- { jobs: [{ name: 'build-node / Build (linux-x64-gnu)', status: 'completed', conclusion: 'failure' }] },- ]),- )- assert.match(stage('unused', 'client-ids').stderr, /Linux client build failed/)+ const incomplete = index.filter(({ name }) => name !== 'npm-linux-x64-gnu')+ writeFileSync(join(dir, 'index.json'), JSON.stringify([{ artifacts: incomplete }]))+ assert.match(stage('unused', 'client-ids').stderr, /Missing Linux client artifact: npm-linux-x64-gnu/)+ writeFileSync(join(dir, 'index.json'), JSON.stringify([{ artifacts: index }]))writeFileSync(join(dir, 'candidate', archive), 'different')await assert.rejects(verifyCandidate(join(dir, 'candidate'), { tag, sha, fingerprint }), /Changed release asset/)writeFileSync(join(runtimeDir, 'producer.json'), JSON.stringify({ run: 99, attempt: 1, sha }))diff --git a/apps/infra/scripts/release-candidate.mjs b/apps/infra/scripts/release-candidate.mjsindex d078e1b1c..b8b98afcc 100644--- a/apps/infra/scripts/release-candidate.mjs+++ b/apps/infra/scripts/release-candidate.mjs@@ -7,7 +7,6 @@ import { createHash } from 'node:crypto'import { createReadStream } from 'node:fs'import { copyFile, mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises'import { join } from 'node:path'-import { setTimeout as delay } from 'node:timers/promises'import { pathToFileURL } from 'node:url'const digestPattern = /^sha256:[a-f0-9]{64}$/@@ -109,38 +108,12 @@ export function verifyAcceptedDistribution(candidate, acceptance, pins) {}}-async function clientArtifactIds(tag) {- const groups = Object.keys(linuxClients(tag))- const run = numberId(process.env.GITHUB_RUN_ID)- const attempt = numberId(process.env.GITHUB_RUN_ATTEMPT)- const deadline = Date.now() + 120 * 60_000- const producers = ['Build Runtime (linux-x64-gnu)', 'Build (linux-x64-gnu)', 'Build wheels on ubuntu-latest']- while (Date.now() < deadline) {- const jobs = JSON.parse(- gh(- 'api',- '--paginate',- '--slurp',- 'repos/' +- process.env.GITHUB_REPOSITORY +- '/actions/runs/' +- run +- '/attempts/' +- attempt +- '/jobs?per_page=100',- ),- ).flatMap((page) => page.jobs)- const index = artifactIndex(run)- const missing = groups.filter((group) => !index.has(group))- const linuxJobs = jobs.filter((job) => producers.some((name) => job.name.endsWith(' / ' + name)))- const failed = linuxJobs.find((job) => ['failure', 'cancelled', 'timed_out'].includes(job.conclusion))- assert.ok(!failed, 'Linux client build failed: ' + failed?.name)- if (!missing.length && !linuxJobs.some((job) => job.status !== 'completed'))- return groups.map((group) => numberId(index.get(group))).join(',')- console.error('Waiting for Linux release clients: ' + (missing.join(', ') || 'producer completion'))- await delay(30_000)- }- throw new Error('Timed out waiting for Linux client artifacts from this run')+function clientArtifactIds(tag) {+ const index = artifactIndex(process.env.GITHUB_RUN_ID)+ return Object.keys(linuxClients(tag)).map((name) => {+ assert.ok(index.has(name), 'Missing Linux client artifact: ' + name)+ return numberId(index.get(name))+ }).join(',')}async function prepareClients(candidate, directory) {@@ -205,7 +178,7 @@ async function stage(mode, component) {}}const candidate = { tag, sha, run, attempt, producers, assets }- if (mode === 'component' && component !== 'runner-linux-amd64') {+ if (mode === 'draft-component' || (mode === 'component' && component !== 'runner-linux-amd64')) {assert.ok(Object.keys(assets).length, 'No files for selected component')} else {const images = {}@@ -250,6 +223,18 @@ function releaseAssets(releaseId) {),).flat()}+// Reserve product distribution filenames across platforms, including targets retired since the first draft.+const managedAssets = [+ /^(?:install\.sh(?:\.sha256)?|SHA256SUMS)$/,+ /^boxlite-\d+\.\d+\.\d+-.+\.whl$/,+ /^boxlite-(?:cli|runtime|runner|c)-v\d+\.\d+\.\d+-.+\.tar\.gz(?:\.sha256)?$/,+ /^boxlite-ai-boxlite-(?:[a-z0-9-]+-)?\d+\.\d+\.\d+\.tgz$/,+]+function assertNoExtraManagedAssets(uploaded, expected) {+ const extra = [...uploaded.keys()].filter(name => !Object.hasOwn(expected, name) && managedAssets.some(pattern => pattern.test(name)))+ assert.ok(!extra.length, 'Release contains managed assets outside the candidate: ' + extra.sort().join(', '))+}+async function verifyPublicCArchives(tag, releaseId) {const release = api('releases/' + numberId(releaseId))assert.equal(release.tag_name, tag, 'Unexpected product release')@@ -269,6 +254,43 @@ async function verifyPublicCArchives(tag, releaseId) {assert.equal('sha256:' + hash.digest('hex'), asset.digest, 'Public C SDK digest mismatch: ' + name)}}+// Actions serializes writers per tag. UI publication requires operators to cancel and drain those writers first.+async function syncDraft(candidate, releaseId, manifestOnly) {+ const id = numberId(releaseId)+ const assertDraft = () => {+ const release = api('releases/' + id)+ assert.ok(release.draft && release.tag_name === candidate.tag, 'Expected the matching draft release')+ }+ const inventory = () => new Map(releaseAssets(id).map(asset => [asset.name, asset]))+ const matches = (asset, digest) => asset?.state === 'uploaded' && asset.digest === digest+ const verify = (list, expected) => {+ for (const [name, { digest }] of Object.entries(expected))+ assert.ok(matches(list.get(name), digest), 'Draft asset missing or different: ' + name)+ }+ assertDraft()+ const current = inventory()+ let expected = candidate.assets+ if (manifestOnly) {+ assertNoExtraManagedAssets(current, expected)+ verify(current, expected)+ expected = { [metadata]: { digest: await fileDigest(join(bundle, metadata)) } }+ }+ const changed = Object.entries(expected).filter(([name, { digest }]) => !matches(current.get(name), digest))+ if (!changed.length) return+ // A manifest certifies the entire set. Invalidate it before updating any member.+ if (current.has(metadata)) {+ assertDraft()+ gh('api', '--method', 'DELETE', 'repos/' + process.env.GITHUB_REPOSITORY + '/releases/assets/' + numberId(current.get(metadata).id))+ }+ for (const [name] of changed) {+ assertDraft()+ const args = ['release', 'upload', candidate.tag, join(bundle, name), '--repo', process.env.GITHUB_REPOSITORY]+ if (name !== metadata && current.has(name)) args.push('--clobber')+ gh(...args)+ }+ verify(inventory(), expected)+}+async function publishFiles(candidate, id, scope, finalize = false) {const release = api('releases/' + numberId(id))assert.equal(release.tag_name, candidate.tag)@@ -281,6 +303,7 @@ async function publishFiles(candidate, id, scope, finalize = false) {const uploadedAssets = () => new Map(releaseAssets(id).map((entry) => [entry.name, entry]))if (!finalize) {const existing = uploadedAssets()+ if (!scope) assertNoExtraManagedAssets(existing, files)const missing = []for (const [name, { digest }] of Object.entries(files)) {if (existing.has(name))@@ -291,6 +314,7 @@ async function publishFiles(candidate, id, scope, finalize = false) {gh('release', 'upload', candidate.tag, join(bundle, name), '--repo', process.env.GITHUB_REPOSITORY)}const uploaded = uploadedAssets()+ if (!scope) assertNoExtraManagedAssets(uploaded, files)for (const [name, { digest }] of Object.entries(files)) {assert.equal(uploaded.get(name)?.state, 'uploaded', 'Incomplete upload ' + name)assert.equal(uploaded.get(name)?.digest, digest, 'Uploaded asset differs from candidate: ' + name)@@ -312,14 +336,16 @@ async function main(command) {if (command === 'verify-public-c') return verifyPublicCArchives(tag, RELEASE_ID)if (command === 'client-ids') {await tagIdentity(tag, sha)- console.log(await clientArtifactIds(tag))+ console.log(clientArtifactIds(tag))return}- if (['stage', 'deployment', 'component'].includes(command)) {- const group = command === 'component' ? process.env.COMPONENT_GROUP : ''- if (command === 'component')+ if (['stage', 'deployment', 'component', 'draft-component'].includes(command)) {+ const component = command === 'component' || command === 'draft-component'+ const group = component ? process.env.COMPONENT_GROUP : ''+ if (component)assert.ok(['runtime-distribution', 'wheels-', 'node-packages', 'c-sdk-', 'runner-linux-amd64'].includes(group), 'Unknown component group')- await stage(command, group)+ const candidate = await stage(command, group)+ if (command === 'draft-component') await syncDraft(candidate, RELEASE_ID, false)console.log(await fileDigest(join(bundle, metadata)))return}@@ -328,12 +354,21 @@ async function main(command) {if (command === 'clients') return prepareClients(candidate, process.env.CLIENT_ARTIFACT_DIR)if (command === 'check-acceptance') {const acceptance = await readJson(process.env.ACCEPTANCE_FILE)+ assert.equal(acceptance.status, process.env.E2E_WAIVED === 'true' ? 'waived' : 'passed')+ const pins = JSON.parse(process.env.DEPLOYMENT_PINS)+ if (acceptance.status === 'waived') {+ assert.ok(acceptance.approval?.reviewer && acceptance.approval.reason)+ assert.match(acceptance.approval.evidence_id, /^[1-9]\d*$/)+ assert.deepEqual(acceptance.images, pins.images)+ assert.deepEqual(acceptance.runner, pins.runner)+ }assert.equal(acceptance.digest, process.env.DEPLOYMENT_DIGEST)assert.equal(acceptance.candidate, numberId(process.env.DEPLOYMENT_ID))assert.equal(acceptance.attempt, numberId(process.env.ACCEPTED_ATTEMPT))- return verifyAcceptedDistribution(candidate, acceptance, JSON.parse(process.env.DEPLOYMENT_PINS))+ return verifyAcceptedDistribution(candidate, acceptance, pins)}await tagIdentity(tag, sha)+ if (command === 'draft-manifest') return syncDraft(candidate, RELEASE_ID, true)if (command === 'attach') return publishFiles(candidate, RELEASE_ID, process.env.REPAIR_GROUP)if (command === 'finalize') return publishFiles(candidate, RELEASE_ID, undefined, true)throw new Error('Unknown release candidate operation ' + command)diff --git a/apps/infra/scripts/release-e2e-override.mjs b/apps/infra/scripts/release-e2e-override.mjsnew file mode 100644index 000000000..534b7a630--- /dev/null+++ b/apps/infra/scripts/release-e2e-override.mjs@@ -0,0 +1,42 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 BoxLite AI++import assert from 'node:assert/strict'+import { execFileSync } from 'node:child_process'+import { readFileSync, writeFileSync } from 'node:fs'+import { pathToFileURL } from 'node:url'+import { linuxClients } from './release-candidate.mjs'++export function approveFailedTests(evidence, reviews, env) {+ const { GITHUB_RUN_ID, DEPLOYMENT_ATTEMPT, CANDIDATE, DIGEST, TAG, SHA, PINS, EVIDENCE_ID } = env+ for (const value of [GITHUB_RUN_ID, DEPLOYMENT_ATTEMPT, CANDIDATE, EVIDENCE_ID]) assert.match(value, /^[1-9]\d*$/)+ assert.match(DIGEST, /^sha256:[a-f0-9]{64}$/)+ for (const [key, value] of Object.entries({+ status: 'failed', run: Number(GITHUB_RUN_ID), attempt: Number(DEPLOYMENT_ATTEMPT),+ candidate: Number(CANDIDATE), digest: DIGEST, tag: TAG, sha: SHA,+ })) assert.equal(evidence[key], value, 'Failure evidence differs from deployment: ' + key)++ const pins = JSON.parse(PINS)+ assert.equal(pins.tag, TAG)+ assert.equal(pins.sha, SHA)+ assert.deepEqual(evidence.images, pins.images)+ assert.deepEqual(evidence.runner, pins.runner)+ for (const name of Object.values(linuxClients(TAG)).flat()) assert.match(evidence.clients[name], /^sha256:[a-f0-9]{64}$/)++ // Review history is run-scoped. The immutable evidence ID ties a review to this failed candidate.+ const prefix = 'waive ' + EVIDENCE_ID + ' '+ const review = reviews.find(r => r.state === 'approved' && r.user?.login &&+ r.environments?.some(e => e.name === 'release-e2e-override') &&+ r.comment?.startsWith(prefix) && r.comment.slice(prefix.length).trim())+ assert.ok(review, 'Approve release-e2e-override with the comment "' + prefix + '<reason>"')+ return { ...evidence, status: 'waived', approval: {+ reviewer: review.user.login, reason: review.comment.slice(prefix.length).trim(), evidence_id: EVIDENCE_ID,+ } }+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ const { GITHUB_REPOSITORY, GITHUB_RUN_ID } = process.env+ const reviews = JSON.parse(execFileSync('gh', ['api', 'repos/' + GITHUB_REPOSITORY + '/actions/runs/' + GITHUB_RUN_ID + '/approvals'], { encoding: 'utf8' }))+ const evidence = JSON.parse(readFileSync('e2e-evidence/acceptance.json', 'utf8'))+ writeFileSync('acceptance.json', JSON.stringify(approveFailedTests(evidence, reviews, process.env)) + '\n')+}diff --git a/apps/infra/scripts/release-e2e-override.test.mjs b/apps/infra/scripts/release-e2e-override.test.mjsnew file mode 100644index 000000000..71aae207b--- /dev/null+++ b/apps/infra/scripts/release-e2e-override.test.mjs@@ -0,0 +1,144 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 BoxLite AI++import assert from 'node:assert/strict'+import { execFileSync, spawnSync } from 'node:child_process'+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { fileURLToPath } from 'node:url'+import test from 'node:test'+import { load } from 'js-yaml'+import { linuxClients } from './release-candidate.mjs'+import { approveFailedTests } from './release-e2e-override.mjs'++const workflow = name => load(readFileSync(new URL('../../../.github/workflows/' + name + '.yml', import.meta.url), 'utf8'))+const e2e = workflow('e2e-cloud')+const release = workflow('mbuild-release')+const rollout = workflow('mdeploy-all')++function temporaryDirectory(t) {+ const dir = mkdtempSync(join(tmpdir(), 'boxlite-review-e2e-'))+ t.after(() => rmSync(dir, { recursive: true, force: true }))+ return dir+}++test('the REST E2E target preserves the original pytest exit code across make', t => {+ const cwd = temporaryDirectory(t)+ mkdirSync(join(cwd, 'apps/e2e'), { recursive: true })+ const target = fileURLToPath(new URL('../../../make/test.mk', import.meta.url))+ const exitFile = join(cwd, 'lane.exitcode')+ writeFileSync(join(cwd, 'python3'), '#!/bin/sh\n[ "$1" = -m ] && [ "$2" = pytest ] || exit 99\nexit "$PYTEST_STATUS"\n', { mode: 0o755 })+ for (const code of [0, 1, 2, 3, 137]) {+ const result = spawnSync('make', ['-f', target, 'test:rest:e2e'], { cwd, env: {+ ...process.env, PATH: cwd + ':' + process.env.PATH, BOXLITE_E2E_EXIT_FILE: exitFile, PYTEST_STATUS: String(code),+ } })+ assert.equal(result.status === 0, code === 0)+ assert.equal(readFileSync(exitFile, 'utf8').trim(), String(code))+ }+})++test('release-only test outcomes require complete and consistent JUnit evidence', t => {+ const cwd = temporaryDirectory(t)+ const script = fileURLToPath(new URL('../../../scripts/ci/release-e2e-result.py', import.meta.url))+ const env = { ...process.env, GITHUB_OUTPUT: join(cwd, 'output'), IDENTITY_RESULT: 'success', CATALOG_RESULT: 'success', SUITE_RESULT: 'success' }+ const report = body => '<testsuites><testsuite><testcase>' + body + '</testcase></testsuite></testsuites>'+ for (const name of ['pytest-identities', 'pytest-catalog']) {+ writeFileSync(join(cwd, name + '.xml'), report(''))+ writeFileSync(join(cwd, name + '.exitcode'), '0')+ }+ function classify(body, outcome, exitCode = outcome === 'success' ? 0 : 1) {+ writeFileSync(join(cwd, 'pytest-junit.exitcode'), String(exitCode))+ const path = join(cwd, 'pytest-junit.xml')+ if (body === null) rmSync(path, { force: true })+ else writeFileSync(path, body)+ writeFileSync(env.GITHUB_OUTPUT, '')+ const result = spawnSync('python3', [script], { cwd, env: { ...env, SUITE_RESULT: outcome } })+ return result.status === 0 ? readFileSync(env.GITHUB_OUTPUT, 'utf8').trim() : 'blocked'+ }+ assert.equal(classify(report(''), 'success'), 'result=success')+ assert.equal(classify(report('<failure/>'), 'failure'), 'result=failure')+ for (const code of [2, 3, 4, 5, 137]) assert.equal(classify(report('<failure/>'), 'failure', code), 'blocked')+ for (const [xml, outcome] of [+ [report(''), 'failure'], [report('<failure/>'), 'cancelled'], [report('<failure/>'), 'success'],+ [report('<error/>'), 'failure'], [report('<skipped/>'), 'success'], [null, 'failure'], ['<partial>', 'failure'],+ ]) assert.equal(classify(xml, outcome), 'blocked')+})++test('the review authorizes only the candidate, run and immutable failure artifact named in the GitHub approval', t => {+ const cwd = temporaryDirectory(t)+ const tag = 'v1.2.3'+ const sha = 'a'.repeat(40)+ const digest = 'sha256:' + 'b'.repeat(64)+ const pins = { tag, sha, images: { api: digest }, runner: { manifest: digest, archive: digest } }+ const clients = Object.fromEntries(Object.values(linuxClients(tag)).flat().map(name => [name, digest]))+ writeFileSync(join(cwd, 'release-candidate.json'), JSON.stringify(pins))+ writeFileSync(join(cwd, 'tested-clients.json'), JSON.stringify(clients))+ const env = { ...process.env, TAG: tag, SHA: sha, CANDIDATE: '12', DIGEST: digest, PINS: JSON.stringify(pins),+ EVIDENCE_ID: '55', GITHUB_RUN_ID: '83', DEPLOYMENT_ATTEMPT: '2' }+ const writer = e2e.jobs.e2e.steps.find(step => step.name === 'Record the deployed pins and tested client hashes')+ execFileSync('bash', ['-eu', '-c', writer.run], { cwd, env: { ...env, GITHUB_RUN_ATTEMPT: '2', RELEASE_TAG: tag, RELEASE_ASSET_DIR: cwd, DECISION: 'failed' } })+ const evidence = JSON.parse(readFileSync(join(cwd, 'acceptance.json'), 'utf8'))+ const review = { state: 'approved', user: { login: 'reviewer' }, environments: [{ name: 'release-e2e-override' }], comment: 'waive 55 incident #123' }+ const receipt = approveFailedTests(evidence, [review], env)+ assert.deepEqual(receipt, { ...evidence, status: 'waived', approval: { reviewer: 'reviewer', reason: 'incident #123', evidence_id: '55' } })+ for (const change of [{ run: 84 }, { attempt: 1 }, { candidate: 13 }, { digest: 'sha256:' + 'c'.repeat(64) }, { tag: 'v1.2.4' }, { sha: 'b'.repeat(40) },+ { images: {} }, { runner: {} }, { clients: {} }, { status: 'passed' }]) {+ assert.throws(() => approveFailedTests({ ...evidence, ...change }, [review], env), undefined, JSON.stringify(change))+ }+ for (const change of [{ state: 'rejected' }, { user: {} }, { comment: 'waive 55 ' }, { comment: 'waive 56 different failure' }, { environments: [{ name: 'prod' }] }]) {+ assert.throws(() => approveFailedTests(evidence, [{ ...review, ...change }], env), /Approve release-e2e-override/)+ }+ assert.throws(() => approveFailedTests(evidence, [], env))+})++test('only release test steps tolerate failure and the protected review gates both downstream paths', () => {+ assert.equal(release.jobs.dev.with.allow_e2e_override, true)+ for (const definition of [rollout, e2e]) {+ assert.equal(definition.on.workflow_call.inputs.allow_e2e_override.default, false)+ assert.equal(definition.on.workflow_dispatch.inputs.allow_e2e_override, undefined)+ }+ assert.deepEqual(e2e.jobs.e2e.steps.filter(step => String(step['continue-on-error']).includes('allow_e2e_override')).map(step => step.id), ['identity', 'catalog', 'suite'])+ const jobs = release.jobs+ assert.equal(jobs['e2e-override'].environment, 'release-e2e-override')+ assert.deepEqual(jobs['e2e-override'].permissions, { contents: 'read', actions: 'read' })+ assert.equal(jobs['e2e-override'].steps.find(step => step.uses?.startsWith('actions/download-artifact')).with['artifact-ids'], '${{ needs.dev.outputs.failure_evidence_id }}')+ const needs = {+ resolve: { outputs: { mode: 'release' } }, dev: { result: 'success', outputs: { e2e_result: 'failure', failure_evidence_id: '55', deployment_attempt: '2', accepted_attempt: '' } },+ 'request-e2e-override': { result: 'success' }, 'e2e-override': { result: 'skipped', outputs: { attempt: '' } },+ distribution: { result: 'success' }, 'build-go': { result: 'success' }, 'accepted-candidate': { result: 'skipped' },+ }+ function selected(id, cancelled = false) {+ const condition = jobs[id].if.replace(/^\$\{\{\s*|\s*\}\}$/g, '').replace(/needs\.([\w]+-[\w-]+)/g, "needs['$1']")+ return Boolean(new Function('needs', 'github', 'cancelled', 'return (' + condition + ')')(needs, { ref: 'refs/heads/main' }, () => cancelled))+ }+ function downstream() { return ['prod', 'attach'].map(id => selected(id)) }+ assert.equal(selected('request-e2e-override'), true)+ assert.equal(selected('request-e2e-override', true), false)+ for (const key of ['failure_evidence_id', 'deployment_attempt']) {+ const value = needs.dev.outputs[key]+ needs.dev.outputs[key] = ''+ assert.equal(selected('request-e2e-override'), false)+ needs.dev.outputs[key] = value+ }+ needs.resolve.outputs.mode = 'component'+ assert.equal(selected('request-e2e-override'), false)+ needs.resolve.outputs.mode = 'release'+ for (const result of ['skipped', 'failure', 'cancelled']) {+ needs['e2e-override'].result = result+ assert.deepEqual(downstream(), [false, false])+ }+ needs['e2e-override'].result = 'success'+ assert.deepEqual(downstream(), [false, false])+ needs['e2e-override'].outputs.attempt = '2'+ assert.deepEqual(downstream(), [true, true])+ needs.dev.result = 'failure'+ assert.equal(selected('request-e2e-override'), false)+ assert.deepEqual(downstream(), [false, false])+ needs.dev.result = 'success'+ needs.dev.outputs.e2e_result = 'success'+ needs.dev.outputs.accepted_attempt = '2'+ needs['e2e-override'] = { result: 'skipped', outputs: { attempt: '' } }+ assert.equal(selected('request-e2e-override'), false)+ assert.deepEqual(downstream(), [true, true])+})diff --git a/apps/infra/scripts/release-pipeline.mjs b/apps/infra/scripts/release-pipeline.mjsindex d356059a2..327cb42a6 100644--- a/apps/infra/scripts/release-pipeline.mjs+++ b/apps/infra/scripts/release-pipeline.mjs@@ -163,7 +163,9 @@ export const releaseReport = ({ repo, tag, runId, results }) => {if (results.dev && results.dev.result !== 'skipped') {const e2e = results.dev.outputs?.e2e_resultif (!e2e || e2e === 'skipped') rows.push(['Dev deployment and acceptance', results.dev.result])- if (e2e) rows.push(['E2E cloud', e2e])+ const waiver = results['e2e-override']?.result+ if (e2e) rows.push(['E2E cloud', waiver === 'success' ? 'failure (waived)' : e2e])+ if (waiver && waiver !== 'skipped') rows.push(['E2E waiver', waiver])}for (const [job, label] of Object.entries({attach: 'Draft attachments', pypi: 'PyPI', npm: 'npm', 'tag-go-module': 'Go module tag',@@ -282,10 +284,30 @@ if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1],},})+ } else if (process.argv[2] === 'override-request') {+ const { TAG, EVIDENCE_ID, DEPLOYMENT_ATTEMPT, GITHUB_REPOSITORY, GITHUB_RUN_ID } = process.env+ const title = TAG + ': dev E2E failed · release review required'+ const actions = runButton(GITHUB_REPOSITORY, GITHUB_RUN_ID, 'Review E2E waiver')+ const review = actions.elements[0]+ actions.elements.unshift({+ type: 'button', text: { type: 'plain_text', text: 'View failed E2E logs' },+ url: review.url + '/attempts/' + id(Number(DEPLOYMENT_ATTEMPT)),+ })+ const instruction = 'Approve release-e2e-override with the comment: waive ' + id(Number(EVIDENCE_ID)) + ' <reason>'+ if (process.env.GITHUB_STEP_SUMMARY) appendFileSync(process.env.GITHUB_STEP_SUMMARY, '`' + instruction + '`\n')+ await sendRunSlack({+ environment: 'release-e2e-override', phase: 'E2E waiver requested',+ payload: { text: title, blocks: [+ { type: 'header', text: { type: 'plain_text', text: title } },+ { type: 'section', text: { type: 'plain_text', text: instruction } },+ actions,+ ] },+ })} else if (process.argv[2] === 'approval') {const { DEPLOY_ENVIRONMENT, APPROVAL_PHASE, GITHUB_RUN_ID, ACCEPTED_TAG } = process.env+ const acceptance = process.env.E2E_WAIVED === 'true' ? 'dev E2E failed · waived' : 'dev E2E passed'const title = ACCEPTED_TAG- ? ACCEPTED_TAG + ': dev E2E passed · review prod deployment'+ ? ACCEPTED_TAG + ': ' + acceptance + ' · review prod deployment': 'Deployment review requested'try {await notifyApproval(GITHUB_RUN_ID, DEPLOY_ENVIRONMENT, APPROVAL_PHASE, title)diff --git a/apps/infra/scripts/release-pipeline.test.mjs b/apps/infra/scripts/release-pipeline.test.mjsindex a868decfe..fbc37e544 100644--- a/apps/infra/scripts/release-pipeline.test.mjs+++ b/apps/infra/scripts/release-pipeline.test.mjs@@ -321,3 +321,26 @@ test('asset preflight rejects an invalid webhook before reading GitHub and worksassert.equal(assets.status, 0, assets.stderr)assert.equal(assets.requests.length, 2)})++test('release webhook links the failed attempt and its approval with a candidate-specific instruction', t => {+ const cli = cliHarness(t)+ const request = cli('override-request', { EVIDENCE_ID: '809', DEPLOYMENT_ATTEMPT: '2' })+ assert.equal(request.status, 0, request.stderr)+ const notice = request.requests.find(r => r.url === webhook).body+ assert.match(JSON.stringify(notice), /waive 809/)+ assert.deepEqual(notice.blocks.at(-1).elements.map(b => b.text.text), ['View failed E2E logs', 'Review E2E waiver'])+ const run = 'https://github.com/' + repo + '/actions/runs/10'+ assert.deepEqual(notice.blocks.at(-1).elements.map(b => b.url), [run + '/attempts/2', run])+ assert.match(request.summary, /waive 809 <reason>/)+ const rejected = cli('report', { RELEASE_RESULTS: JSON.stringify({+ dev: { result: 'success', outputs: { e2e_result: 'failure' } }, 'e2e-override': { result: 'failure' },+ }) })+ assert.match(rejected.summary, /E2E waiver \| failure/)+ assert.equal(rejected.requests.find(r => r.url === webhook).body.blocks.at(-1).elements[0].url, run)+})++test('prod review of a waived candidate never announces a passing test suite', t => {+ const result = cliHarness(t)('approval', { DEPLOY_ENVIRONMENT: 'prod', ACCEPTED_TAG: tag, E2E_WAIVED: 'true' })+ const message = result.requests.find(req => req.url === webhook).body+ assert.match(message.text, /failed.*waived.*prod/i)+})diff --git a/apps/infra/scripts/release-registry-retry.test.mjs b/apps/infra/scripts/release-registry-retry.test.mjsnew file mode 100644index 000000000..f3f8041f9--- /dev/null+++ b/apps/infra/scripts/release-registry-retry.test.mjs@@ -0,0 +1,115 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 BoxLite AI+import assert from 'node:assert/strict'+import { spawnSync } from 'node:child_process'+import { createHash } from 'node:crypto'+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { delimiter, join } from 'node:path'+import { fileURLToPath } from 'node:url'+import test from 'node:test'+import { data, Evaluator, Lexer, Parser } from '@actions/expressions'+import { load } from 'js-yaml'+import { buildKey } from './release-build-plan.mjs'++const root = fileURLToPath(new URL('../../../', import.meta.url))+const jobs = load(readFileSync(join(root, '.github/workflows/mbuild-release.yml'), 'utf8')).jobs+const cache = load(readFileSync(join(root, '.github/actions/release-build-cache/action.yml'), 'utf8'))+const hash = bytes => createHash('sha256').update(bytes).digest('hex')+const tag = 'v1.2.3'+const sha = '1'.repeat(40)+const manifest = 'sha256:' + hash('manifest')+const blob = 'sha256:' + hash('runner bytes')+const source = [buildKey(tag, sha, 10), 'ghcr-runner', 1, 123, hash('receipt'), manifest.slice(7)].join('.')++function evaluate(expression, context) {+ const raw = expression.replace(/^\$\{\{\s*|\s*\}\}$/g, '')+ const ast = new Parser(new Lexer(raw).lex().tokens, Object.keys(context), []).parse()+ return new Evaluator(ast, JSON.parse(JSON.stringify(context), data.reviver)).evaluate().coerceString()+}++function fixture(t) {+ const dir = mkdtempSync(join(tmpdir(), 'boxlite-publisher-'))+ t.after(() => rmSync(dir, { recursive: true, force: true }))+ const env = { ...process.env, PATH: dir + delimiter + process.env.PATH, GITHUB_REPOSITORY: 'boxlite-ai/boxlite',+ GITHUB_OUTPUT: join(dir, 'outputs'), RUNNER_TEMP: dir, GITHUB_ACTOR: 'fixture', GH_TOKEN: 'fixture',+ GITHUB_RUN_ATTEMPT: '2', GITHUB_RUN_ID: '10', TAG: tag, SHA: sha, REGISTRY_CONFIG: join(dir, 'auth.json'),+ DENY_LOGIN: '0', DENY_MANIFEST: '0', DENY_BLOB: '0', BLOB_BYTES: 'runner bytes', REMOTE: manifest, BLOB: blob }+ writeFileSync(env.GITHUB_OUTPUT, '')+ writeFileSync(join(dir, 'oras'), `#!/bin/sh+set -eu+case "$1" in+ login) cat >/dev/null; exit "$DENY_LOGIN" ;;+ resolve) printf '%s\\n' "$REMOTE" ;;+ manifest|blob)+ test "$2" = fetch+ case "$*" in *anonymous*) ;; *) exit 4 ;; esac+ jq -e '. == {"auths":{}}' "$RUNNER_TEMP/anonymous-registry.json" >/dev/null+ if [ "$1" = manifest ]; then+ test "$DENY_MANIFEST" = 0+ printf '{"layers":[{"digest":"%s"}]}\\n' "$BLOB"+ else+ test "$DENY_BLOB" = 0+ case "$*" in *'--output -'*) printf '%s' "$BLOB_BYTES" ;; *) exit 5 ;; esac+ fi ;;+ *) exit 6 ;;+esac+`, { mode: 0o755 })+ return { dir, env }+}++test('resolve still plans a full retry when registry login is unavailable', t => {+ const { dir, env } = fixture(t)+ const wheel = [buildKey(tag, sha, 10), 'wheels-macos-15', 1, 321, hash('wheel'), ''].join('.')+ const producer = { name: 'build wheels on macOS', conclusion: 'success', run_attempt: 1,+ check_run_url: 'checks/321', steps: [{ name: 'Build cache receipt ' + wheel, conclusion: 'success' }] }+ writeFileSync(join(dir, 'jobs.json'), JSON.stringify([{ jobs: [producer] }]))+ writeFileSync(join(dir, 'gh'), '#!/bin/sh\ncat "$RUNNER_TEMP/jobs.json"\n', { mode: 0o755 })+ const step = jobs.resolve.steps.find(step => step.id === 'retry')+ const result = spawnSync('bash', ['-c', step.run], { cwd: root, env: { ...env, DENY_LOGIN: '1' }, encoding: 'utf8' })+ assert.equal(result.status, 0, result.stderr)+ assert.equal(JSON.parse(readFileSync(env.GITHUB_OUTPUT, 'utf8').trim().slice(5)).sources['wheels-macos-15'], wheel)+ assert.ok(!jobs.resolve.steps.some(step => step.uses?.startsWith('oras-project/')))+})++test('a tag changed after resolve turns a verified local cache hit into a publisher miss', t => {+ const { dir, env } = fixture(t)+ const check = cache.runs.steps.find(step => step.id === 'registry')+ for (const remote of [manifest, 'sha256:' + hash('replacement')]) {+ const outputs = {}+ if (check) {+ writeFileSync(env.GITHUB_OUTPUT, '')+ const result = spawnSync('bash', ['-c', check.run], { cwd: dir, env: { ...env, REMOTE: remote, SOURCE: source,+ REGISTRY_REF: 'ghcr.io/boxlite-ai/boxlite/runner:' + tag + '-' + sha }, encoding: 'utf8' })+ assert.equal(result.status, 0, result.stderr)+ for (const line of readFileSync(env.GITHUB_OUTPUT, 'utf8').trim().split('\n')) {+ const [key, value] = line.split('=')+ outputs[key] = value+ }+ }+ const context = { inputs: { 'registry-ref': 'ghcr.io/boxlite-ai/boxlite/runner:' + tag + '-' + sha },+ steps: { verify: { outputs: { hit: 'true' } }, registry: { outputs } } }+ assert.equal(evaluate(cache.outputs.hit.value, context), String(remote === manifest))+ }+ for (const job of [jobs.publish, jobs['publish-runner']]) {+ assert.ok(job.concurrency.group)+ assert.ok(job.steps.find(step => step.id === 'cache').with['registry-ref'])+ assert.match(job.steps.find(step => step.id === 'built').if, /steps.cache.outputs.hit != 'true'/)+ }+})++test('a cached Runner must be anonymously downloadable before pins are uploaded', t => {+ const { dir, env } = fixture(t)+ const job = jobs['publish-runner']+ const upload = job.steps.findIndex(step => step.with?.name === 'ghcr-runner')+ const step = job.steps.slice(0, upload).find(step => step.run?.includes('anonymous-registry.json'))+ const hit = { steps: { cache: { outputs: { hit: 'true' } } } }+ assert.ok(step && (!step.if || evaluate(step.if, hit) === 'true'), 'a cache hit skips anonymous verification')+ writeFileSync(join(dir, 'runner.json'), JSON.stringify({ manifest, archive: blob }))+ writeFileSync(join(dir, 'boxlite-runner-' + tag + '-linux-amd64.tar.gz'), 'runner bytes')+ for (const [overrides, success] of [[{}, true], [{ BLOB: 'sha256:' + hash('wrong layer') }, false], [{ DENY_MANIFEST: '1' }, false], [{ DENY_BLOB: '1' }, false],+ [{ BLOB_BYTES: 'wrong bytes' }, false], [{ REMOTE: 'sha256:' + hash('replacement') }, false]]) {+ const result = spawnSync('bash', ['-c', step.run], { cwd: dir, env: { ...env, ...overrides }, encoding: 'utf8' })+ assert.equal(result.status === 0, success, JSON.stringify(overrides) + ' ' + result.stderr)+ }+})diff --git a/apps/infra/scripts/release-retry-contract.test.mjs b/apps/infra/scripts/release-retry-contract.test.mjsnew file mode 100644index 000000000..21ff23237--- /dev/null+++ b/apps/infra/scripts/release-retry-contract.test.mjs@@ -0,0 +1,73 @@+import assert from 'node:assert/strict'+import { createHash } from 'node:crypto'+import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import test from 'node:test'+import { data, Evaluator, Lexer, Parser } from '@actions/expressions'+import { minimatch } from 'minimatch'+import { load } from 'js-yaml'++const root = new URL('../../../', import.meta.url)+const workflow = name => load(readFileSync(new URL('.github/workflows/' + name + '.yml', root)))+const release = workflow('mbuild-release')+const platforms = JSON.parse(readFileSync(new URL('.github/ci-config.json', root))).platforms++test('the exact Runner ID extracts alongside the checksum consumer', () => {+ const steps = release.jobs['publish-runner'].steps+ const download = steps.find(step => step.with?.['artifact-ids'])+ assert.equal(download.with['merge-multiple'], true, 'ID downloads otherwise extract to runner-linux-amd64/')+ assert.match(steps.find(step => step.id === 'built').run, /sha256sum --check --strict "\$tarball.sha256"/)+})++test('runtime packaging downloads every platform member and excludes aggregate output', () => {+ const step = workflow('build-runtime').jobs.package.steps.find(step => step.with?.pattern)+ const input = step.with.pattern+ let pattern = input+ if (input.startsWith('${{')) {+ const context = { needs: { config: { outputs: { platforms: JSON.stringify(platforms) } } } }+ const ast = new Parser(new Lexer(input.slice(3, -2)).lex().tokens, ['needs'], []).parse()+ pattern = new Evaluator(ast, JSON.parse(JSON.stringify(context), data.reviver)).evaluate().value+ }+ for (const { target } of platforms) {+ for (const group of ['runtime','cli']) assert.ok(minimatch(group + '-' + target, pattern))+ }+ assert.equal(minimatch('runtime-distribution', pattern), false, 'an old aggregate could overwrite a new platform archive')+ assert.equal(minimatch('cli-distribution', pattern), false)+})++test('a cache hit runs the wheel producer through its normal artifact upload', () => {+ const producer = workflow('build-wheels').jobs.build_wheels+ assert.equal(producer.if, undefined, 'all wheel jobs are skipped on a verified all-hit plan')+ const build = producer.steps.find(step => step.uses?.startsWith('pypa/cibuildwheel@'))+ assert.match(build.if, /steps\.cache\.outputs\.hit/)+ const upload = producer.steps.find(step => step.uses?.startsWith('actions/upload-artifact@'))+ assert.equal(upload.if, undefined, 'current-attempt wheel artifacts must exist after restore')+})++test('cached output survives removal of the original artifact and rejects changed bytes or native input', async t => {+ const producer = workflow('build-runner-binary').jobs.build+ assert.ok(producer.steps.some(step => step.id === 'cache'), 'runner has no durable build-output cache')+ const { saveFiles, restoreFiles } = await import(new URL('.github/actions/release-build-cache/files.mjs', root))+ const dir = mkdtempSync(join(tmpdir(), 'release-output-'))+ t.after(() => rmSync(dir, {recursive:true, force:true}))+ const dep = join(dir, 'sdks/go/libboxlite.a')+ mkdirSync(join(dir, 'sdks/go'), {recursive:true})+ writeFileSync(dep, 'library A')+ const name = 'boxlite-runner-v1.0.0-linux-amd64.tar.gz'+ writeFileSync(join(dir,name), 'candidate')+ writeFileSync(join(dir,name + '.sha256'), createHash('sha256').update('candidate').digest('hex') + ' ' + name)+ writeFileSync(join(dir,'producer.json'), '{"attempt":1}')+ const args = { root:dir, unit:'runner', dependency:'sdks/go/libboxlite.a' }+ const digest = await saveFiles(args)+ rmSync(join(dir,name))+ assert.ok(await restoreFiles({...args,digest}))+ assert.equal(readFileSync(join(dir,name),'utf8'), 'candidate')+ rmSync(join(dir,name))+ writeFileSync(dep, 'library B')+ assert.equal(await restoreFiles({...args,digest}), false)+ writeFileSync(dep, 'library A')+ writeFileSync(join(dir,'.release-build-cache/files',name), 'changed')+ assert.equal(await restoreFiles({...args,digest}), false)+ assert.equal(existsSync(join(dir,name)), false)+})diff --git a/apps/infra/scripts/release-workflow.test.mjs b/apps/infra/scripts/release-workflow.test.mjsindex e6a481146..1fd06fb64 100644--- a/apps/infra/scripts/release-workflow.test.mjs+++ b/apps/infra/scripts/release-workflow.test.mjs@@ -28,6 +28,21 @@ test('release deployment is a native dependency in the publisher run', () => {assert.equal(rollout.jobs.report, undefined, 'successful acceptance must not allocate a report runner')})+test('each component can reach the draft before dev acceptance; the manifest waits for all uploads', () => {+ const components = { runtime: 'build-runtime', wheels: 'build-wheels', node: 'build-node', c: 'build-c', runner: 'build-runner-binary' }+ for (const [component, producer] of Object.entries(components)) {+ const id = 'draft-' + component+ const job = release.jobs[id]+ assert.ok(job, 'Missing early draft upload for ' + component)+ assert.deepEqual(job.needs, ['resolve', producer])+ assert.ok(release.jobs.distribution.needs.includes(id))+ assert.ok(!release.jobs.dev.needs.includes(id))+ }+ assert.ok(release.jobs.distribution.steps.some(step => step.run?.includes('release-candidate.mjs draft-manifest')))+ assert.ok(release.jobs.attach.needs.includes('dev'))+ assert.ok(release.jobs.finalize.needs.includes('attach'))+})+test('release dev approval uses only the release webhook', () => {const inputs = { stage: 'dev', apply: true, release_sha: 'a'.repeat(40) }const notices = rollout.jobs.resolve.steps.filter((s) => s.run?.endsWith('release-pipeline.mjs approval'))@@ -40,9 +55,29 @@ test('release dev approval uses only the release webhook', () => {const expression = (value) => value.replace(/^\$\{\{\s*|\s*\}\}$/g, '')+test('deploy-infra selectable-source builds receive read-only Actions cache access', () => {+ const manual = readWorkflow('deploy-infra')+ for (const id of ['build-c', 'build-runner']) {+ const job = manual.jobs[id]+ assert.equal(job['cache-mode'] ?? manual['cache-mode'] ?? 'write', 'read', 'deploy-infra / ' + id)+ }+})++test('mbuild selectable-source builds receive read-only Actions cache access', () => {+ const caller = release.jobs['standalone-build'] ?? release.jobs['build-c']+ assert.equal(caller['cache-mode'] ?? release['cache-mode'] ?? 'write', 'read', 'standalone source')+ assert.equal(release.jobs.resolve.outputs.sha, '${{ steps.ref.outputs.sha }}', 'release uses the tag verified on main')+ assert.equal(caller.with.ref, '${{ needs.resolve.outputs.source_sha }}')+ assert.equal(release.jobs.resolve.outputs.source_sha, '${{ steps.source.outputs.sha }}')+ for (const [id, job] of Object.entries(release.jobs)) {+ if (job.with?.build_plan !== '${{ needs.resolve.outputs.build_plan }}') continue+ assert.equal(job.with.ref, '${{ needs.resolve.outputs.sha }}', id)+ assert.equal(job['cache-mode'] ?? release['cache-mode'] ?? 'write', 'write', id)+ }+})+test('release caller routes the pinned C SDK build to its qualified runner', () => {const sha = 'a'.repeat(40)- const caller = release.jobs['build-c']const callee = readWorkflow('build-c').jobs.buildconst platforms = JSON.parse(readFileSync(new URL('../../../.github/ci-config.json', import.meta.url))).platformsfunction evaluate(value, context) {@@ -58,7 +93,11 @@ test('release caller routes the pinned C SDK build to its qualified runner', ()['publish-runner', false, '', 'ubuntu-latest'],]) {const { mode } = selectRelease(command, buildOnly, '', source)- const context = { inputs: { command, 'build-only': buildOnly }, needs: { resolve: { outputs: { sha, mode } } } }+ const standalone = mode === 'build'+ const caller = standalone ? readWorkflow('release-source-build').jobs['build-c'] : release.jobs['build-c']+ const context = standalone+ ? { inputs: { ref: sha, linux_x64_only: command === 'publish-runner' } }+ : { inputs: { command }, needs: { resolve: { outputs: { sha, mode } } } }const inputs = Object.fromEntries(Object.entries(caller.with).map(([key, value]) => [key, evaluate(value, context)]))assert.equal(inputs.ref, sha, 'runner selection must preserve the resolved source commit')for (const { os, target } of platforms) {@@ -68,6 +107,34 @@ test('release caller routes the pinned C SDK build to its qualified runner', ()}})+test('only a full retry can restore, while fresh and selected jobs build and upload', () => {+ const action = load(readFileSync(new URL('../../../.github/actions/release-build-cache/action.yml', import.meta.url)))+ const guard = action.runs.steps.find(step => step.id === 'restore').if+ const unit = 'wheels-macos-15'+ const plan = JSON.stringify({ attempt: 2, sources: { [unit]: 'verified-key' } })+ for (const [attempt, buildPlan, expected] of [[2, plan, true], [3, plan, false], [1, '{"attempt":1,"sources":{}}', false]]) {+ const context = { github: { run_attempt: String(attempt) }, inputs: { mode: 'restore', plan: buildPlan, unit } }+ const ast = new Parser(new Lexer(guard).lex().tokens, Object.keys(context), []).parse()+ assert.equal(new Evaluator(ast, JSON.parse(JSON.stringify(context), data.reviver)).evaluate().value, expected)+ }+ const producers = [+ ...[['runtime','build'],['node','build'],['c','build'],['wheels','build_wheels'],['runner-binary','build']].map(+ ([file, id]) => readWorkflow('build-' + file).jobs[id]),+ release.jobs.publish, release.jobs['publish-runner'],+ ]+ for (const producer of producers) {+ const cache = producer.steps.find(step => step.id === 'cache')+ const save = producer.steps.find(step => step.id === 'saved')+ assert.equal(cache.with.unit, save.with.unit)+ assert.equal(cache.with.dependency, save.with.dependency)+ assert.match(cache.if, /build_plan != ''/)+ assert.match(save.if, /steps.cache.outputs.hit != 'true'/)+ for (const step of producer.steps.filter(step => step.uses?.startsWith('actions/upload-artifact@')))+ assert.equal(step.if, undefined, 'publish current-attempt artifacts on either build or restore')+ assert.ok(producer.steps.some(step => step.name?.startsWith('Build cache receipt ') && step.if))+ }+})+test('standalone and release applies choose exactly one channel, including an unset release webhook', () => {const job = rollout.jobs.resultconst steps = job.steps.filter((step) => step.run?.endsWith('release-pipeline.mjs result'))@@ -187,7 +254,7 @@ test('prod may retry a previous attempt only with the exact dev acceptance recei)const sha = 'a'.repeat(40),digest = 'sha256:' + 'b'.repeat(64)- const accepted = { run: 44, attempt: 1, candidate: 77, digest, sha, tag: 'v1.2.3' }+ const accepted = { status: 'passed', run: 44, attempt: 1, candidate: 77, digest, sha, tag: 'v1.2.3' }const env = {...process.env,PATH: dir + ':' + process.env.PATH,@@ -196,6 +263,8 @@ test('prod may retry a previous attempt only with the exact dev acceptance receiGITHUB_RUN_ATTEMPT: '2',GITHUB_RUN_ID: '44',GITHUB_REPOSITORY: 'boxlite-ai/boxlite',+ E2E_WAIVED: 'false',+ PINS: JSON.stringify({ images: { api: digest }, runner: { manifest: digest, archive: digest } }),ACCEPTED_ATTEMPT: '1',CANDIDATE: '77',DIGEST: digest,@@ -217,6 +286,12 @@ test('prod may retry a previous attempt only with the exact dev acceptance receiconst result = spawnSync('bash', ['-c', guard.run], { env, encoding: 'utf8' })assert.equal(result.status === 0, expected === 0, 'receipt ' + JSON.stringify(changed) + ' ' + result.stderr)}+ const waived = { ...accepted, ...JSON.parse(env.PINS), status: 'waived', approval: { reviewer: 'operator', reason: 'known failure', evidence_id: '34' } }+ for (const [changes, allowed] of [[{}, true], [{ status: 'passed' }, false], [{ approval: {} }, false], [{ images: {} }, false], [{ runner: {} }, false]]) {+ writeFileSync(env.RECEIPT, JSON.stringify({ ...waived, ...changes }))+ const result = spawnSync('bash', ['-c', guard.run], { env: { ...env, E2E_WAIVED: 'true' } })+ assert.equal(result.status === 0, allowed, 'waived receipt ' + JSON.stringify(changes))+ }}})@@ -343,7 +418,7 @@ test('build-only never enters deployment, checks, or reporting; failed E2E cannoconst summary = cloud.jobs.e2e.steps.at(-1)assert.equal(summary.id, 'acceptance')assert.equal(summary.if, 'always() && inputs.deployment_attempt')- assert.equal(summary.env.E2E_RESULT, '${{ job.status }}')+ assert.equal(summary.env.E2E_RESULT, "${{ job.status == 'success' && steps.verdict.outputs.result || job.status }}")assert.match(release.jobs.report.if, /contains\(needs\.\*\.result, 'failure'\)/)assert.match(release.jobs.report.if, /contains\(needs\.\*\.result, 'cancelled'\)/)for (const job of ['dev','attach','finalize','pypi','npm','publish_crates']) assert.ok(release.jobs.report.needs.includes(job))@@ -448,9 +523,9 @@ test('component repairs use the accepted candidate and package publishers stay iassert.ok(release.jobs.finalize.if.includes("inputs.command == 'publish'"))})-test('GHCR pins unlock dev and dev acceptance independently unlocks prod and publication', () => {+test('completed builds unlock dev and dev acceptance independently unlocks prod and publication', () => {const jobs = release.jobs- assert.deepEqual(jobs.dev.needs, ['resolve', 'publish', 'publish-runner'], 'dev must prepare as soon as GHCR producers finish')+ assert.deepEqual(jobs.dev.needs, ['resolve', 'publish', 'publish-runner', 'build-runtime', 'build-c', 'build-wheels', 'build-node'], 'dev requires all client and registry producers')assert.equal(jobs.check, undefined)const prepare = rollout.jobs.resolveconst validate = prepare.steps.findIndex((step) => step.run?.includes('release-candidate.mjs deployment'))@@ -473,7 +548,7 @@ test('GHCR pins unlock dev and dev acceptance independently unlocks prod and pub}assert.equal(jobs.dev.with.release_images, '$' + '{{ needs.resolve.outputs.artifacts }}')assert.equal(prepare.steps[validate].env.IMAGES, '$' + '{{ inputs.release_images }}')- assert.deepEqual(jobs.prod.needs, ['resolve', 'dev'], 'prod waits for release finalization')+ assert.deepEqual(jobs.prod.needs, ['resolve', 'dev', 'e2e-override'], 'prod can start as soon as dev passes or the failed candidate receives a waiver')assert.ok(jobs.attach.needs.includes('dev'))assert.ok(jobs.attach.needs.includes('distribution'))assert.ok(jobs.attach.needs.includes('build-go'))@@ -588,16 +663,30 @@ test('single components select their producers and bypass rollout, including witassert.equal(selection.group, group)const needs = Object.fromEntries(Object.keys(release.jobs).map(id => [id, { result: 'skipped', outputs: {} }]))needs.resolve = { result: 'success', outputs: { ...selection, builds: JSON.stringify(selection.builds) } }- const allows = id => {- const job = release.jobs[id]+ const allows = (id, jobs = release.jobs, inputs = { command, 'build-only': buildOnly }, state = needs) => {+ const job = jobs[id]const deps = [job.needs || []].flat()const condition = expression(job.if).replaceAll('needs.*.result', 'results').replace(/needs\.([\w]+-[\w-]+)/g, "needs['$1']")- const statuses = deps.map(dep => needs[dep].result)+ const statuses = deps.map(dep => state[dep].result)if (!condition.includes('cancelled()') && statuses.some(result => result !== 'success')) return falseconst evaluate = new Function('needs','results','inputs','github','contains','fromJSON','cancelled','return ' + condition)- return Boolean(evaluate(needs, statuses, { command, 'build-only': buildOnly }, { ref: 'refs/heads/main' }, (a,b) => a.includes(b), JSON.parse, () => false))+ return Boolean(evaluate(state, statuses, inputs, { ref: 'refs/heads/main' }, (a,b) => a.includes(b), JSON.parse, () => false))}const enabled = []+ assert.equal(allows('standalone-build'), buildOnly)+ if (buildOnly) {+ const caller = release.jobs['standalone-build']+ assert.equal(caller.with.builds, '${{ needs.resolve.outputs.builds }}')+ const nested = readWorkflow(caller.uses.split('/').pop().replace('.yml', ''))+ assert.deepEqual(Object.keys(nested.on), ['workflow_call'])+ const inner = Object.fromEntries(Object.keys(nested.jobs).map(id => [id, { result: 'skipped' }]))+ for (const [id, job] of Object.entries(nested.jobs)) {+ assert.equal(job.uses, release.jobs[id].uses)+ if (!allows(id, nested.jobs, needs.resolve.outputs, inner)) continue+ enabled.push(id)+ inner[id].result = 'success'+ }+ }for (const id of ['build-runtime','build-wheels','build-node','build-c','build-go','build-runner-binary','publish','publish-runner','distribution','accepted-candidate','dev','attach','npm','pypi','prod','finalize','tag-go-module','publish_crates']) {if (allows(id)) { enabled.push(id); needs[id].result = 'success' }}diff --git a/make/test.mk b/make/test.mkindex 3d97c9b32..cf053154c 100644--- a/make/test.mk+++ b/make/test.mk@@ -858,7 +858,10 @@ test\:rest\:cli:@bash scripts/test/rest/run_cli_matrix.sh "$${AUTH:-oidc}" "$${SCOPE:-smoke}"test\:rest\:e2e:- @cd apps/e2e && BOXLITE_E2E_AUTH=$${AUTH:-api-key} python3 -m pytest cases/ -v $(PYTEST_FILTER)+ @cd apps/e2e || exit 1; status=0; \+ BOXLITE_E2E_AUTH=$${AUTH:-api-key} python3 -m pytest cases/ -v $(PYTEST_FILTER) || status=$$?; \+ if [ -n "$${BOXLITE_E2E_EXIT_FILE:-}" ]; then printf '%s\n' "$$status" > "$$BOXLITE_E2E_EXIT_FILE" || exit 1; fi; \+ exit "$$status"test\:rest\:report:@python3 scripts/test/rest/report.pydiff --git a/scripts/ci/release-e2e-result.py b/scripts/ci/release-e2e-result.pynew file mode 100644index 000000000..6572e15bb--- /dev/null+++ b/scripts/ci/release-e2e-result.py@@ -0,0 +1,32 @@+"""Classify completed release pytest lanes using their exit outcomes and JUnit reports."""++import os+import xml.etree.ElementTree as ET+from pathlib import Path+++def release_result():+ failed = False+ for outcome, path in (+ ("IDENTITY_RESULT", "pytest-identities.xml"),+ ("CATALOG_RESULT", "pytest-catalog.xml"),+ ("SUITE_RESULT", "pytest-junit.xml"),+ ):+ cases = ET.parse(path).findall(".//testcase")+ if not any(case.find("skipped") is None for case in cases):+ raise ValueError(f"{path} contains no executed tests")+ if any(case.find("error") is not None for case in cases):+ raise ValueError(f"{path} contains a test setup, collection or teardown error")+ assertions_failed = any(case.find("failure") is not None for case in cases)+ expected = "failure" if assertions_failed else "success"+ # make returns 2 for every failed recipe. Only pytest exit 1 means completed, failing tests.+ exit_code = Path(path).with_suffix(".exitcode").read_text().strip()+ if exit_code != ("1" if assertions_failed else "0") or os.environ[outcome] != expected:+ raise ValueError(f"{path} does not explain the {os.environ[outcome]} step outcome")+ failed |= assertions_failed+ return "failure" if failed else "success"+++if __name__ == "__main__":+ with Path(os.environ["GITHUB_OUTPUT"]).open("a") as output:+ print(f"result={release_result()}", file=output)