Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

feat(ci): recover release components and split platform builds (#3266)

kekxyb92c77f22ae0
diff --git a/.github/actions/ci-config/action.yml b/.github/actions/ci-config/action.yml
index fc6cb39be..177cef6c8 100644
--- a/.github/actions/ci-config/action.yml
+++ b/.github/actions/ci-config/action.yml
@@ -2,6 +2,9 @@ name: Load CI configuration
description: Read shared versions and platform matrices without a separate runner job.
inputs:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ default: all
full-matrix:
description: Test every version on every platform; false keeps all versions on Linux x64 and the latest elsewhere.
default: 'true'
@@ -41,6 +44,7 @@ runs:
- id: config
shell: bash
env:
+ SPEC_PLATFORM: ${{ inputs.spec_platform }}
FULL_MATRIX: ${{ inputs.full-matrix }}
run: |
case "$FULL_MATRIX" in
@@ -48,7 +52,13 @@ runs:
*) echo "::error::full-matrix must be true or false"; exit 1 ;;
esac
config="$GITHUB_ACTION_PATH/../../ci-config.json"
- jq -r 'to_entries[] | "\(.key)=\(.value | if type == "string" then . else tojson end)"' "$config" >> "$GITHUB_OUTPUT"
+ case "${SPEC_PLATFORM:-all}" in
+ all|linux-x64|except-linux-x64) ;;
+ *) echo "::error::Unknown spec_platform: $SPEC_PLATFORM"; exit 1 ;;
+ esac
+ platforms=$(jq -ce --arg scope "${SPEC_PLATFORM:-all}" '[.platforms[] | select($scope == "all" or
+ (($scope == "linux-x64") == (.target == "linux-x64-gnu")))] | select(length > 0)' "$config")
+ jq -r --argjson platforms "$platforms" '.platforms = $platforms | to_entries[] | "\(.key)=\(.value | if type == "string" then . else tojson end)"' "$config" >> "$GITHUB_OUTPUT"
for sdk in python node; do
matrix=$(jq -c --arg sdk "$sdk" --arg full "$FULL_MATRIX" '
.[$sdk + "-versions"] as $versions
diff --git a/.github/workflows/README.md b/.github/workflows/README.md
index 8f79df0d5..3153b5733 100644
--- a/.github/workflows/README.md
+++ b/.github/workflows/README.md
@@ -69,14 +69,15 @@ PRODUCT RELEASE (dispatch from main) mbuild-release creates or selects the dr
└─ publish images to GHCR
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
+ GHCR pins + Linux x64 runtime, wheels, Node, C ──▶ approved dev apply → dev E2E pass or approved waiver
├─▶ prod approval + deployment
- complete distribution + Go tests ─┴─▶ certify accepted files
+ all platforms + complete distribution + Go tests ─┴─▶ certify accepted files
──▶ PyPI and npm ──▶ publish GitHub Release
├─▶ crates.io
└─▶ verify public C SDK downloads → Go tag
SINGLE COMPONENT (dispatch from main) mbuild-release ──▶ component build + tests ──▶ component publication
+ repair ──▶ Release files (recover missing files from manifest) ──▶ package registry or Go module tag
build-only ──▶ artifacts from the selected source
BOX IMAGES apps/box-images/v* tag ──▶ release-box-images
@@ -105,7 +106,8 @@ CONFIG ci-config action ◀── lint, test, c
| `codeql.yml` | push, PR, dispatch, weekly | — | CodeQL advanced setup, so fork PRs are scanned |
| `api-client-drift.yml` | PR | — | Regenerates the product API clients and checks their committed output. For hosted Apps it installs `rustfmt` to compare the generated Rust CLI bindings, then tests the public methods, paths, permissions and response schemas against the mounted API. |
| `author-review.yml` | PR (target), issue_comment, merge_group | — | Converts unacknowledged PRs to draft, posts author instructions, and publishes `Author reviewed the PR` on the current head. Merge queues carry forward the required PR admission check |
-| `build-runtime.yml` | weekly, `workflow_call` | yes | Builds runtime and CLI archives. The release build also stages the installer and checksums. |
+| `build-runtime.yml` | weekly, `workflow_call` | yes | Builds per-platform runtime and CLI archives. |
+| `package-runtime.yml` | `workflow_call` | yes | Renders the tagged installer, runs its tagged smoke test, verifies the generated checksums, and stages the runtime distribution. |
| `build-c.yml` | `workflow_call` | yes | Stages the platform C SDK archives, including the static library used by Go and Runner. |
| `build-go.yml` | `workflow_call` | yes | Tests the Go SDK against the matching C archive from this run. |
| `build-node.yml` | `workflow_call` | yes | Builds and tests the Node.js addon and stages packed npm distributions. |
diff --git a/.github/workflows/build-c.yml b/.github/workflows/build-c.yml
index 298092328..9df4e3e0b 100644
--- a/.github/workflows/build-c.yml
+++ b/.github/workflows/build-c.yml
@@ -4,6 +4,10 @@ name: Build C SDK
on:
workflow_call:
inputs:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ type: string
+ default: all
build_plan:
description: Verified build plan for a full release run.
type: string
@@ -45,6 +49,8 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/ci-config
id: config
+ with:
+ spec_platform: ${{ inputs.linux_x64_only && 'linux-x64' || inputs.spec_platform }}
- name: Validate build commit
id: ref
shell: bash
@@ -87,7 +93,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- 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(needs.resolve-ref.outputs.platforms) }}
steps:
- name: Install BoxLite worker build tools
diff --git a/.github/workflows/build-go.yml b/.github/workflows/build-go.yml
index 54eeb99c7..04d27c68f 100644
--- a/.github/workflows/build-go.yml
+++ b/.github/workflows/build-go.yml
@@ -3,6 +3,10 @@ name: Build Go SDK
on:
workflow_call:
inputs:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ type: string
+ default: all
ref:
required: true
type: string
@@ -24,6 +28,8 @@ jobs:
run: sudo apt-get -o Acquire::Retries=3 -o APT::Update::Error-Mode=any update && sudo apt-get install -y -o Acquire::Retries=3 --no-install-recommends jq
- uses: ./.github/actions/ci-config
id: config
+ with:
+ spec_platform: ${{ inputs.spec_platform }}
test:
name: Test (${{ matrix.target }})
diff --git a/.github/workflows/build-node.yml b/.github/workflows/build-node.yml
index 96f5a9265..15137a15e 100644
--- a/.github/workflows/build-node.yml
+++ b/.github/workflows/build-node.yml
@@ -3,6 +3,10 @@ name: Build Node.js
on:
workflow_call:
inputs:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ type: string
+ default: all
build_plan:
description: Verified build plan for a full release run.
type: string
@@ -22,6 +26,8 @@ permissions:
jobs:
config:
uses: ./.github/workflows/config.yml
+ with:
+ spec_platform: ${{ inputs.spec_platform || 'all' }}
# ============================================================================
# BUILD
@@ -272,55 +278,26 @@ jobs:
run: tar -xvf "sdks/node/artifacts-$TARGET.tar" -C sdks/node
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
+ if: inputs.spec_platform != 'except-linux-x64'
with:
name: node-sdk-dist
path: sdks/node/dist
- name: Test package
+ env:
+ BUILD_DIST: ${{ inputs.spec_platform == 'except-linux-x64' }}
run: |
cd sdks/node
npm install --ignore-scripts
+ if [[ "$BUILD_DIST" == true ]]; then npm run build; fi
node -e "import('./dist/index.js').then(m => console.log('BoxLite loaded:', Object.keys(m)))"
# ============================================================================
# PUBLISH TO NPM
package:
- name: Pack npm distributions
- needs: [ config, build, test ]
- runs-on: boxlite-4vcpu-16gbmem-30gbdisk
-
- steps:
- - uses: actions/checkout@v4
- with:
- ref: ${{ inputs.ref || github.sha }}
-
- - name: Install packaging tools
- run: sudo apt-get -o Acquire::Retries=3 -o APT::Update::Error-Mode=any update && sudo apt-get install -y -o Acquire::Retries=3 --no-install-recommends jq
-
- - name: Collect the packages built by each platform
- uses: actions/download-artifact@v4
- with:
- pattern: npm-*
- path: staged-npm
-
- - name: Assemble npm distributions without repacking
- run: |
- mkdir -p sdks/node/packages
- cp staged-npm/*/*.tgz sdks/node/packages/
-
- - name: Record build origin
- working-directory: sdks/node/packages
- 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
-
- - name: Stage npm distributions
- uses: actions/upload-artifact@v4
- with:
- overwrite: true
- if-no-files-found: error
- name: node-packages
- path: |
- sdks/node/packages/*.tgz
- sdks/node/packages/producer.json
+ needs: test
+ if: inputs.spec_platform == 'all'
+ uses: ./.github/workflows/package-node.yml
+ with:
+ ref: ${{ inputs.ref }}
diff --git a/.github/workflows/build-runtime.yml b/.github/workflows/build-runtime.yml
index 8381092ad..7429ed01c 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:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ type: string
+ default: all
build_plan:
description: Verified build plan for a full release run.
type: string
@@ -27,6 +31,8 @@ env:
jobs:
config:
uses: ./.github/workflows/config.yml
+ with:
+ spec_platform: ${{ inputs.spec_platform || 'all' }}
build:
name: Build Runtime (${{ matrix.target }})
@@ -179,114 +185,13 @@ jobs:
run: echo 'Recorded build output digests for whole-run retries.'
package:
- name: Stage runtime distribution
- needs: [config, build]
- runs-on: boxlite
- if: inputs.tag != ''
+ needs: build
+ if: inputs.tag != '' && inputs.spec_platform == 'all'
+ uses: ./.github/workflows/package-runtime.yml
permissions:
contents: read
id-token: write
attestations: write
-
- steps:
- - name: Install packaging tools
- run: sudo apt-get -o Acquire::Retries=3 -o APT::Update::Error-Mode=any update && sudo apt-get install -y -o Acquire::Retries=3 --no-install-recommends jq
-
- - name: Checkout (for scripts/release/install.sh.template)
- uses: actions/checkout@v4
- with:
- ref: ${{ inputs.ref || github.sha }}
-
- - name: Download all build artifacts
- uses: actions/download-artifact@v4
- with:
- pattern: ${{ format('@(runtime|cli)-@({0})', join(fromJSON(needs.config.outputs.platforms).*.target, '|')) }}
- path: dist
- merge-multiple: true
-
- # Per-tarball sidecars come first so the install.sh render step can read
- # them to embed checksums for the fast path.
- - name: Generate per-tarball .sha256 sidecars
- working-directory: dist
- run: |
- for f in boxlite-runtime-*.tar.gz boxlite-cli-*.tar.gz; do
- sha256sum "$f" > "$f.sha256"
- done
- ls -1 *.sha256
-
- - name: Render install.sh for this release
- working-directory: dist
- env:
- VERSION: ${{ inputs.tag }}
- run: |
- sha_for() {
- awk '{print $1}' < "boxlite-cli-${VERSION}-$1.tar.gz.sha256"
- }
- DARWIN_ARM64=$(sha_for aarch64-apple-darwin)
- LINUX_X64=$(sha_for x86_64-unknown-linux-gnu)
- LINUX_ARM64=$(sha_for aarch64-unknown-linux-gnu)
-
- sed \
- -e "s|__VERSION__|${VERSION}|g" \
- -e "s|__SHA_AARCH64_APPLE_DARWIN__|${DARWIN_ARM64}|g" \
- -e "s|__SHA_X86_64_UNKNOWN_LINUX_GNU__|${LINUX_X64}|g" \
- -e "s|__SHA_AARCH64_UNKNOWN_LINUX_GNU__|${LINUX_ARM64}|g" \
- ../scripts/release/install.sh.template > install.sh
- chmod +x install.sh
-
- # Sanity-check substitution succeeded.
- if grep -q '__VERSION__\|__SHA_' install.sh; then
- echo "ERROR: install.sh still contains placeholders" >&2
- exit 1
- fi
- # Gate the release on a rendered-script syntax check; a broken
- # installer would otherwise only surface on user machines.
- sh -n install.sh
- head -25 install.sh
-
- # install.sh sidecar lives in the same integrity envelope as the
- # tarballs: users who pipe `curl ... install.sh | sh` are running this
- # script as their own user, so the wrapper itself must be verifiable
- # (sha256 + sigstore attestation), not just its tarball payload.
- - name: Generate install.sh.sha256 sidecar
- working-directory: dist
- run: |
- sha256sum install.sh > install.sh.sha256
- cat install.sh.sha256
-
- - name: Generate SHA256SUMS
- working-directory: dist
- run: |
- sha256sum boxlite-runtime-*.tar.gz boxlite-cli-*.tar.gz install.sh > SHA256SUMS
- cat SHA256SUMS
-
- # Final gate against installer regressions before the release goes
- # public. The lint workflow also runs this on PRs touching the
- # template; this re-run validates the actually-rendered dist/install.sh
- # (placeholders substituted, real digests embedded).
- - name: Validate rendered installer
- env:
- BOXLITE_INSTALL_TEMPLATE: dist/install.sh
- run: bash scripts/release/test_install.sh
-
- - name: Attest build provenance
- uses: actions/attest-build-provenance@v2
- with:
- subject-path: |
- dist/boxlite-runtime-*.tar.gz
- dist/boxlite-cli-*.tar.gz
- dist/install.sh
-
- - name: Record build origin
- working-directory: dist
- 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
-
- - name: Stage release files
- uses: actions/upload-artifact@v4
- with:
- overwrite: true
- if-no-files-found: error
- name: runtime-distribution
- path: dist/
+ with:
+ ref: ${{ inputs.ref }}
+ tag: ${{ inputs.tag }}
diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml
index 9d6651269..801f58a17 100644
--- a/.github/workflows/build-wheels.yml
+++ b/.github/workflows/build-wheels.yml
@@ -3,6 +3,10 @@ name: Build Wheels
on:
workflow_call:
inputs:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ type: string
+ default: all
build_plan:
description: Verified build plan for a full release run.
type: string
@@ -21,6 +25,8 @@ jobs:
# Load shared configuration
config:
uses: ./.github/workflows/config.yml
+ with:
+ spec_platform: ${{ inputs.spec_platform || 'all' }}
build_wheels:
name: Build wheels on ${{ matrix.os }}
diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml
index 2c624a84b..50458c095 100644
--- a/.github/workflows/config.yml
+++ b/.github/workflows/config.yml
@@ -4,6 +4,11 @@ name: Config
on:
workflow_call:
+ inputs:
+ spec_platform:
+ description: Select all, linux-x64, or except-linux-x64.
+ type: string
+ default: all
outputs:
# === Platform/Matrix Configuration ===
platforms:
@@ -49,3 +54,5 @@ jobs:
- uses: actions/checkout@v5
- uses: ./.github/actions/ci-config
id: config
+ with:
+ spec_platform: ${{ inputs.spec_platform }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 36f4dd551..257dacead 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -99,6 +99,7 @@ jobs:
install_script:
- 'scripts/release/**'
- '.github/workflows/build-runtime.yml'
+ - '.github/workflows/package-runtime.yml'
- 'make/test.mk'
rustfmt:
diff --git a/.github/workflows/mbuild-release.yml b/.github/workflows/mbuild-release.yml
index 3e3e0d54c..e9b58891a 100644
--- a/.github/workflows/mbuild-release.yml
+++ b/.github/workflows/mbuild-release.yml
@@ -10,10 +10,7 @@ on:
required: true
default: publish
type: choice
- options: [publish, publish-runtime, publish-wheels, publish-node, publish-c, publish-go, publish-runner, repair-runtime, repair-wheels, repair-node, repair-c]
- candidate-id:
- description: 'For repair, the Actions artifact ID of the dev-accepted release candidate'
- type: string
+ options: [publish, publish-runtime, publish-wheels, publish-node, publish-c, publish-go, publish-runner, repair-runtime, repair-wheels, repair-node, repair-c, repair-go]
tag:
description: 'Stable tag on main, required for publication'
type: string
@@ -72,7 +69,6 @@ jobs:
env:
COMMAND: ${{ inputs.command }}
BUILD_ONLY: ${{ inputs['build-only'] }}
- CANDIDATE: ${{ inputs['candidate-id'] }}
SOURCE: ${{ inputs['source-ref'] }}
run: node apps/infra/scripts/release-selection.mjs
@@ -149,6 +145,9 @@ jobs:
[[ "$TAG" == "v$version" ]] || { echo 'Tag differs from workspace version' >&2; exit 1; }
if [[ "$COMMAND" != publish ]]; then
release=$(gh release view "$TAG" --json databaseId,isDraft)
+ if [[ "$COMMAND" == repair-* ]]; then
+ jq -e '(.isDraft | not)' <<< "$release" >/dev/null || { echo 'Repair requires a public Release' >&2; exit 1; }
+ fi
jq -r '"id=\(.databaseId)\npublic=\(.isDraft | not)"' <<< "$release" >> "$GITHUB_OUTPUT"
exit 0
fi
@@ -210,6 +209,7 @@ jobs:
id-token: write
attestations: write
with:
+ spec_platform: ${{ needs.resolve.outputs.mode == 'release' && 'linux-x64' || 'all' }}
build_plan: ${{ needs.resolve.outputs.build_plan }}
ref: ${{ needs.resolve.outputs.sha }}
tag: ${{ inputs.tag }}
@@ -219,6 +219,7 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'wheels') }}
uses: ./.github/workflows/build-wheels.yml
with:
+ spec_platform: ${{ needs.resolve.outputs.mode == 'release' && 'linux-x64' || 'all' }}
build_plan: ${{ needs.resolve.outputs.build_plan }}
ref: ${{ needs.resolve.outputs.sha }}
@@ -227,6 +228,7 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'node') }}
uses: ./.github/workflows/build-node.yml
with:
+ spec_platform: ${{ needs.resolve.outputs.mode == 'release' && 'linux-x64' || 'all' }}
build_plan: ${{ needs.resolve.outputs.build_plan }}
ref: ${{ needs.resolve.outputs.sha }}
@@ -235,6 +237,7 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode != 'build' && contains(fromJSON(needs.resolve.outputs.builds), 'c') }}
uses: ./.github/workflows/build-c.yml
with:
+ spec_platform: ${{ needs.resolve.outputs.mode == 'release' && 'linux-x64' || 'all' }}
build_plan: ${{ needs.resolve.outputs.build_plan }}
ref: ${{ needs.resolve.outputs.sha }}
full_release: ${{ needs.resolve.outputs.mode == 'release' }}
@@ -247,6 +250,79 @@ jobs:
contents: read
actions: read
uses: ./.github/workflows/build-go.yml
+ with:
+ spec_platform: ${{ needs.resolve.outputs.mode == 'release' && 'linux-x64' || 'all' }}
+ ref: ${{ needs.resolve.outputs.sha }}
+
+ build-runtime-other:
+ needs: resolve
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ uses: ./.github/workflows/build-runtime.yml
+ permissions:
+ contents: read
+ id-token: write
+ attestations: write
+ with:
+ spec_platform: except-linux-x64
+ build_plan: ${{ needs.resolve.outputs.build_plan }}
+ ref: ${{ needs.resolve.outputs.sha }}
+ tag: ${{ inputs.tag }}
+
+ build-wheels-other:
+ needs: resolve
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ uses: ./.github/workflows/build-wheels.yml
+ with:
+ spec_platform: except-linux-x64
+ build_plan: ${{ needs.resolve.outputs.build_plan }}
+ ref: ${{ needs.resolve.outputs.sha }}
+
+ build-node-other:
+ needs: resolve
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ uses: ./.github/workflows/build-node.yml
+ with:
+ spec_platform: except-linux-x64
+ build_plan: ${{ needs.resolve.outputs.build_plan }}
+ ref: ${{ needs.resolve.outputs.sha }}
+
+ build-c-other:
+ needs: resolve
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ uses: ./.github/workflows/build-c.yml
+ with:
+ spec_platform: except-linux-x64
+ build_plan: ${{ needs.resolve.outputs.build_plan }}
+ ref: ${{ needs.resolve.outputs.sha }}
+ full_release: ${{ needs.resolve.outputs.mode == 'release' }}
+
+ build-go-other:
+ needs: [resolve, build-c-other]
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ permissions:
+ contents: read
+ actions: read
+ uses: ./.github/workflows/build-go.yml
+ with:
+ spec_platform: except-linux-x64
+ ref: ${{ needs.resolve.outputs.sha }}
+
+ package-runtime:
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ needs: [resolve, build-runtime, build-runtime-other]
+ uses: ./.github/workflows/package-runtime.yml
+ permissions:
+ contents: read
+ id-token: write
+ attestations: write
+ with:
+ ref: ${{ needs.resolve.outputs.sha }}
+ tag: ${{ inputs.tag }}
+
+ package-node:
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'release' }}
+ needs: [resolve, build-node, build-node-other]
+ uses: ./.github/workflows/package-node.yml
with:
ref: ${{ needs.resolve.outputs.sha }}
@@ -491,7 +567,7 @@ jobs:
run: echo 'Recorded build output digests for whole-run retries.'
draft-runtime:
- needs: [resolve, build-runtime]
+ needs: [resolve, package-runtime]
if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/release-draft-component.yml
permissions: { contents: write, actions: read }
@@ -502,7 +578,7 @@ jobs:
group: runtime-distribution
draft-wheels:
- needs: [resolve, build-wheels]
+ needs: [resolve, build-wheels, build-wheels-other]
if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/release-draft-component.yml
permissions: { contents: write, actions: read }
@@ -513,7 +589,7 @@ jobs:
group: wheels-
draft-node:
- needs: [resolve, build-node]
+ needs: [resolve, package-node]
if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/release-draft-component.yml
permissions: { contents: write, actions: read }
@@ -524,7 +600,7 @@ jobs:
group: node-packages
draft-c:
- needs: [resolve, build-c]
+ needs: [resolve, build-c, build-c-other]
if: needs.resolve.outputs.mode == 'release' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/release-draft-component.yml
permissions: { contents: write, actions: read }
@@ -693,43 +769,63 @@ jobs:
run: echo "attempt=$DEPLOYMENT_ATTEMPT" >> "$GITHUB_OUTPUT"
accepted-candidate:
- name: Locate the previously accepted candidate
+ name: Recover component from the public Release
needs: resolve
- if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'repair' }}
+ if: ${{ github.ref == 'refs/heads/main' && needs.resolve.outputs.mode == 'repair' && needs.resolve.outputs.group != '' }}
+ concurrency:
+ group: mbuild-release-assets-${{ inputs.tag }}
+ queue: max
runs-on: ubuntu-latest
permissions:
+ contents: write
actions: read
- contents: read
outputs:
- id: ${{ steps.receipt.outputs.id }}
- run: ${{ steps.receipt.outputs.run }}
- digest: ${{ steps.receipt.outputs.digest }}
+ id: ${{ steps.upload.outputs.artifact-id }}
+ run: ${{ github.run_id }}
+ digest: ${{ steps.repair.outputs.digest }}
steps:
- - id: receipt
+ - uses: actions/checkout@v5
+ with:
+ persist-credentials: false
+ - name: Check out tagged package definitions
+ uses: actions/checkout@v5
+ with:
+ ref: ${{ needs.resolve.outputs.sha }}
+ path: release-source
+ sparse-checkout: |
+ .github
+ sdks/python
+ persist-credentials: false
+ - name: Read the tagged wheel build identifiers
+ if: inputs.command == 'repair-wheels'
+ run: bash scripts/release/wheel-identifiers.sh release-source > "$RUNNER_TEMP/release-wheel-identifiers"
+ - name: Recover release files and restore missing attachments
+ id: repair
env:
- ID: ${{ inputs['candidate-id'] }}
TAG: ${{ inputs.tag }}
SHA: ${{ needs.resolve.outputs.sha }}
+ RELEASE_ID: ${{ needs.resolve.outputs.release_id }}
+ COMPONENT_GROUP: ${{ needs.resolve.outputs.group }}
+ WHEEL_IDENTIFIERS: ${{ runner.temp }}/release-wheel-identifiers
run: |
set -euo pipefail
- [[ "$ID" =~ ^[1-9][0-9]*$ ]]
- api="repos/$GITHUB_REPOSITORY/actions"
- run=$(gh api "$api/artifacts/$ID" --jq 'select(.expired == false and (.name | test("^release-candidate-[0-9]+$"))) | .workflow_run.id')
- [[ "$run" =~ ^[1-9][0-9]*$ ]]
- gh api "$api/runs/$run" | jq -e '.path == ".github/workflows/mbuild-release.yml" and .head_branch == "main" and .event == "workflow_dispatch"' >/dev/null
- gh run download "$run" --repo "$GITHUB_REPOSITORY" --name "dev-accepted-$ID" --dir "$RUNNER_TEMP/accepted"
- digest=$(jq -er --arg tag "$TAG" --arg sha "$SHA" --argjson id "$ID" --argjson run "$run" '
- select(.tag == $tag and .sha == $sha and .candidate == $id and .run == $run)
- | .digest | select(test("^sha256:[0-9a-f]{64}$"))' "$RUNNER_TEMP/accepted/acceptance.json")
- printf 'id=%s\nrun=%s\ndigest=%s\n' "$ID" "$run" "$digest" >> "$GITHUB_OUTPUT"
+ digest=$(node apps/infra/scripts/release-candidate.mjs repair)
+ echo "digest=$digest" >> "$GITHUB_OUTPUT"
+ - uses: actions/upload-artifact@v4
+ id: upload
+ with:
+ name: ${{ inputs.command }}-${{ github.run_attempt }}
+ path: candidate/
+ compression-level: 0
+ if-no-files-found: error
attach:
concurrency:
group: mbuild-release-assets-${{ inputs.tag }}
queue: max
name: Attach verified release files
- 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')) }}
+ needs: [resolve, distribution, build-go, build-go-other, 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.build-go-other.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 }}
@@ -785,6 +881,7 @@ jobs:
overwrite: true
if-no-files-found: error
- name: Verify selected release attachments
+ if: needs.resolve.outputs.mode != 'repair'
env:
TAG: ${{ inputs.tag }}
SHA: ${{ needs.resolve.outputs.sha }}
@@ -834,7 +931,9 @@ jobs:
for file in boxlite-ai-boxlite-*-"${TAG#v}.tgz" "boxlite-ai-boxlite-${TAG#v}.tgz"; do
name=$(tar -xOzf "$file" package/package.json | jq -er .name)
version=$(tar -xOzf "$file" package/package.json | jq -er .version)
- [[ "$name" == @boxlite-ai/boxlite* && "$version" == "${TAG#v}" ]]
+ expected=${file#boxlite-ai-}
+ expected=${expected%-"${TAG#v}".tgz}
+ [[ "$name" == "@boxlite-ai/$expected" && "$version" == "${TAG#v}" ]]
integrity="sha512-$(openssl dgst -sha512 -binary "$file" | openssl base64 -A)"
package="$name@$version"
if existing=$(npm view "$package" dist.integrity --json 2> "$RUNNER_TEMP/npm-view.log"); then
@@ -910,7 +1009,8 @@ jobs:
if: >-
${{ github.ref == 'refs/heads/main' && !cancelled() &&
((inputs.command == 'publish' && needs.finalize.result == 'success') ||
- (inputs.command == 'publish-go' && !inputs['build-only'] && needs.build-go.result == 'success')) }}
+ (inputs.command == 'publish-go' && !inputs['build-only'] && needs.build-go.result == 'success') ||
+ (inputs.command == 'repair-go' && needs.resolve.outputs.public_release == 'true')) }}
name: Tag Go Module
needs: [resolve, finalize, build-go]
runs-on: ubuntu-latest
@@ -968,7 +1068,7 @@ jobs:
if: >-
${{ github.ref == 'refs/heads/main' && !cancelled() &&
((inputs.command == 'publish' && needs.finalize.result == 'success') ||
- (inputs.command == 'publish-runtime' && needs.resolve.outputs.public_release == 'true' && needs.attach.result == 'success')) }}
+ (contains(fromJSON('["publish-runtime","repair-runtime"]'), inputs.command) && needs.resolve.outputs.public_release == 'true' && needs.attach.result == 'success')) }}
name: Publish to crates.io
needs: [resolve, finalize, attach]
runs-on: ubuntu-latest
@@ -1131,7 +1231,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, 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]
+ needs: [resolve, build-runtime, build-runtime-other, build-wheels, build-wheels-other, build-node, build-node-other, build-c, build-c-other, build-go, build-go-other, build-runner-binary, package-runtime, package-node, 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: read
diff --git a/.github/workflows/package-node.yml b/.github/workflows/package-node.yml
new file mode 100644
index 000000000..4a99ef86b
--- /dev/null
+++ b/.github/workflows/package-node.yml
@@ -0,0 +1,51 @@
+name: Package node distribution
+
+on:
+ workflow_call:
+ inputs:
+ ref:
+ type: string
+ required: true
+
+permissions:
+ contents: read
+
+jobs:
+ package:
+ name: Pack npm distributions
+ runs-on: boxlite-4vcpu-16gbmem-30gbdisk
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.ref || github.sha }}
+
+ - name: Install packaging tools
+ run: sudo apt-get -o Acquire::Retries=3 -o APT::Update::Error-Mode=any update && sudo apt-get install -y -o Acquire::Retries=3 --no-install-recommends jq
+
+ - name: Collect the packages built by each platform
+ uses: actions/download-artifact@v4
+ with:
+ pattern: npm-*
+ path: staged-npm
+
+ - name: Assemble npm distributions without repacking
+ run: |
+ mkdir -p sdks/node/packages
+ cp staged-npm/*/*.tgz sdks/node/packages/
+
+ - name: Record build origin
+ working-directory: sdks/node/packages
+ 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
+
+ - name: Stage npm distributions
+ uses: actions/upload-artifact@v4
+ with:
+ overwrite: true
+ if-no-files-found: error
+ name: node-packages
+ path: |
+ sdks/node/packages/*.tgz
+ sdks/node/packages/producer.json
diff --git a/.github/workflows/package-runtime.yml b/.github/workflows/package-runtime.yml
new file mode 100644
index 000000000..3177d2d26
--- /dev/null
+++ b/.github/workflows/package-runtime.yml
@@ -0,0 +1,134 @@
+name: Package runtime distribution
+
+on:
+ workflow_call:
+ inputs:
+ ref:
+ type: string
+ required: true
+ tag:
+ type: string
+ required: true
+
+permissions:
+ contents: read
+
+jobs:
+ config:
+ uses: ./.github/workflows/config.yml
+
+ package:
+ name: Stage runtime distribution
+ needs: config
+ runs-on: boxlite
+ permissions:
+ contents: read
+ id-token: write
+ attestations: write
+
+ steps:
+ - name: Install packaging tools
+ run: sudo apt-get -o Acquire::Retries=3 -o APT::Update::Error-Mode=any update && sudo apt-get install -y -o Acquire::Retries=3 --no-install-recommends jq
+
+ - name: Checkout (for scripts/release/install.sh.template)
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.ref || github.sha }}
+
+ - name: Download all build artifacts
+ uses: actions/download-artifact@v4
+ with:
+ pattern: ${{ format('@(runtime|cli)-@({0})', join(fromJSON(needs.config.outputs.platforms).*.target, '|')) }}
+ path: dist
+ merge-multiple: true
+
+ # Per-tarball sidecars come first so the install.sh render step can read
+ # them to embed checksums for the fast path.
+ - name: Generate per-tarball .sha256 sidecars
+ working-directory: dist
+ run: |
+ for f in boxlite-runtime-*.tar.gz boxlite-cli-*.tar.gz; do
+ sha256sum "$f" > "$f.sha256"
+ done
+ ls -1 *.sha256
+
+ - name: Render install.sh for this release
+ working-directory: dist
+ env:
+ VERSION: ${{ inputs.tag }}
+ run: |
+ sha_for() {
+ awk '{print $1}' < "boxlite-cli-${VERSION}-$1.tar.gz.sha256"
+ }
+ DARWIN_ARM64=$(sha_for aarch64-apple-darwin)
+ LINUX_X64=$(sha_for x86_64-unknown-linux-gnu)
+ LINUX_ARM64=$(sha_for aarch64-unknown-linux-gnu)
+
+ sed \
+ -e "s|__VERSION__|${VERSION}|g" \
+ -e "s|__SHA_AARCH64_APPLE_DARWIN__|${DARWIN_ARM64}|g" \
+ -e "s|__SHA_X86_64_UNKNOWN_LINUX_GNU__|${LINUX_X64}|g" \
+ -e "s|__SHA_AARCH64_UNKNOWN_LINUX_GNU__|${LINUX_ARM64}|g" \
+ ../scripts/release/install.sh.template > install.sh
+ chmod +x install.sh
+
+ # Sanity-check substitution succeeded.
+ if grep -q '__VERSION__\|__SHA_' install.sh; then
+ echo "ERROR: install.sh still contains placeholders" >&2
+ exit 1
+ fi
+ # Gate the release on a rendered-script syntax check; a broken
+ # installer would otherwise only surface on user machines.
+ sh -n install.sh
+ head -25 install.sh
+
+ # install.sh sidecar lives in the same integrity envelope as the
+ # tarballs: users who pipe `curl ... install.sh | sh` are running this
+ # script as their own user, so the wrapper itself must be verifiable
+ # (sha256 + sigstore attestation), not just its tarball payload.
+ - name: Generate install.sh.sha256 sidecar
+ working-directory: dist
+ run: |
+ sha256sum install.sh > install.sh.sha256
+ cat install.sh.sha256
+
+ - name: Generate SHA256SUMS
+ working-directory: dist
+ run: |
+ sha256sum boxlite-runtime-*.tar.gz boxlite-cli-*.tar.gz install.sh > SHA256SUMS
+ cat SHA256SUMS
+
+ # Final gate against installer regressions before the release goes
+ # public. The lint workflow also runs this on PRs touching the
+ # template; this re-run validates the actually-rendered dist/install.sh
+ # (placeholders substituted, real digests embedded).
+ - name: Validate rendered installer
+ env:
+ BOXLITE_INSTALL_TEMPLATE: dist/install.sh
+ run: |
+ bash scripts/release/test_install.sh
+ cd dist
+ sha256sum --check install.sh.sha256
+ sha256sum --check SHA256SUMS
+
+ - name: Attest build provenance
+ uses: actions/attest-build-provenance@v2
+ with:
+ subject-path: |
+ dist/boxlite-runtime-*.tar.gz
+ dist/boxlite-cli-*.tar.gz
+ dist/install.sh
+
+ - name: Record build origin
+ working-directory: dist
+ 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
+
+ - name: Stage release files
+ uses: actions/upload-artifact@v4
+ with:
+ overwrite: true
+ if-no-files-found: error
+ name: runtime-distribution
+ path: dist/
diff --git a/apps/infra/deployment/release-safety.test.ts b/apps/infra/deployment/release-safety.test.ts
index 9f561c905..a3d0d4805 100644
--- a/apps/infra/deployment/release-safety.test.ts
+++ b/apps/infra/deployment/release-safety.test.ts
@@ -1717,7 +1717,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, 28, `expected every local reusable call to be swept, saw ${checked}`)
+ assert.equal(checked, 38, `expected every local reusable call to be swept, saw ${checked}`)
})
test('every reusable workflow is called with the inputs it declares', () => {
@@ -1758,7 +1758,7 @@ test('every reusable workflow is called with the inputs it declares', () => {
}
}
// 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}`)
+ assert.equal(checked, 38, `expected every reusable-workflow call swept, saw ${checked}`)
})
/**
diff --git a/apps/infra/docs/release.md b/apps/infra/docs/release.md
index c52dde167..12bba91ec 100644
--- a/apps/infra/docs/release.md
+++ b/apps/infra/docs/release.md
@@ -19,7 +19,7 @@ The run creates the draft or selects the existing draft for that tag. Configure
| --- | --- |
| 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. |
| 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. |
+| 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 Linux x64 Runtime, C, wheel and Node jobs 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 | 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. |
@@ -62,7 +62,7 @@ If finalization loses the GitHub response after publishing, retry the failed job
A same-version Runner rebuild changes the pinned manifest. Hosts record the installed manifest and archive digests and reapply when either changes.
-Each Runtime or CLI tarball sidecar and the installer sidecar `install.sh.sha256` occupies one entry in the release inventory. The Release attachment job checks all existing selected files before uploading missing files. If a digest conflicts, the job stops before its first upload so the operator can inspect the originating run.
+Each Runtime or CLI tarball sidecar and the installer sidecar `install.sh.sha256` occupies one entry in the release inventory. During a full release, the attachment job checks all existing selected files before uploading missing files. If a digest conflicts, the job stops before its first upload so the operator can inspect the originating run.
The npm publisher checks all existing platform packages and the main package before its first upload. It publishes missing platform packages before the main package and verifies each new registry digest. A retry reuses matching packages.
@@ -75,7 +75,9 @@ A version-only installation requires a published `release-candidate.json`. For a
3. Record the original `tag`, resolved commit in `sha`, OCI digest in `runner.manifest` and archive digest in `runner.archive`. For an `mdeploy-all` rollout, also populate `images` with the original verified manifest digest of each application image. Abort if a digest cannot be tied to the historical release.
4. Attach the verified metadata as `release-candidate.json` to that version and check its downloaded SHA-256. Preserve any existing manifest and investigate conflicting bytes. A rollback can then select the version and use the usual downgrade approval.
-The host fetches its Runner bytes from GHCR by digest. Backfilling metadata does not confer a dev E2E acceptance receipt or make the historical build eligible for component repairs.
+The host fetches its Runner bytes from GHCR by digest. This backfill records installation pins only.
+
+Component repair can use files already on the Release. Restoring a missing file requires its digest and producer Artifact ID. A later component publication records these for the files it replaces.
### Build and publish one component
@@ -90,10 +92,9 @@ Run `mbuild-release.yml` from `main` and select an existing product Release tag.
| `publish-go` | Builds the C SDK matrix, tests Go, then tags `sdks/go/vX.Y.Z` only after downloading every versioned C SDK archive anonymously from the public Release and verifying its GitHub asset digest. |
| `publish-runner` | Builds the Linux x64 C SDK and Runner, pushes the Runner to GHCR and attaches its archive and checksum to GitHub Release. |
-If Go tagging fails on a draft, finish the full release first. On a public Release, `publish-c` rebuilds every C archive. Fresh tar timestamps can change an existing archive's digest and block all uploads, including the missing archive.
+Single-component publication replaces the selected component's same-name Release attachments, including on a public Release. PyPI and npm still require an existing registry file at that version to match the package being published.
-- If the original distribution artifact and its dev acceptance receipt are available, run `repair-c` for the same tag. Set `candidate-id` to that distribution artifact's ID. After the repair restores the missing archives, retry `publish-go`.
-- If either artifact has expired, follow the [full release procedure](#release-runbook) with a new patch version and tag. The new version goes through dev acceptance and publishes its own C archives and Go module tag.
+The reusable Runtime, wheel, Node, C and Go workflows accept `spec_platform` values `linux-x64`, `except-linux-x64` and `all` (default). In a full release, both groups run concurrently. Dev needs the Linux x64 clients and GHCR pins. The Runtime installer and the npm distribution wait for both groups. Package publication and the Go module tag wait for all required platform tests.
For 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.
@@ -118,7 +119,19 @@ Dispatch `mdeploy-all` on `main` with the public tag and `stage=prod` to deploy
### Manually republish a component
-Open **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.
+On **Actions → mbuild-release → Run workflow**, select `main`, enter the public Release tag and leave **build-only** off. Run one command for each destination.
+
+| Command | Result |
+| --- | --- |
+| `repair-wheels` | Publish the Release wheels to PyPI. |
+| `repair-node` | Publish the Release's native npm packages, followed by its main npm package. |
+| `repair-runtime` | Restore missing Runtime attachments and publish crates.io packages from the tagged source. |
+| `repair-c` | Restore missing public C SDK archives. |
+| `repair-go` | Verify public C SDK downloads and create the Go module tag at the product commit. An existing tag at that commit is accepted. |
+
+For example, `gh workflow run mbuild-release.yml --ref main -f command=repair-node -f tag=v0.16.1` takes the npm packages already present on the Release. A complete set works without a candidate manifest or a dev receipt.
+
+For a missing file, repair reads the producer Artifact ID from the tag's `release-candidate.json`, verifies the recovered file against its recorded digest and uploads it back to the Release before registry publication. When the manifest or source artifact is unavailable, the job identifies the missing file. Existing Release attachments take precedence over the historical manifest. If an interrupted upload leaves an empty attachment, repair verifies all replacement files, rechecks the empty attachment by ID and then replaces it.
### Approvals and notifications
diff --git a/apps/infra/mbuild/test/mbuild-release-workflow.test.ts b/apps/infra/mbuild/test/mbuild-release-workflow.test.ts
index 8abf733c4..b7ec30a57 100644
--- a/apps/infra/mbuild/test/mbuild-release-workflow.test.ts
+++ b/apps/infra/mbuild/test/mbuild-release-workflow.test.ts
@@ -18,7 +18,7 @@ test('release publication runs from main with package write access and no cloud
assert.equal(workflow.jobs.publish.permissions.packages, 'write')
assert.equal(workflow.permissions['id-token'], undefined)
assert.doesNotMatch(commands, /configure-aws-credentials|google-github-actions|mstage login|--stage dev|--to prod/)
- assert.deepEqual(workflow.on.workflow_dispatch.inputs.command.options, ['publish', 'publish-runtime', 'publish-wheels', 'publish-node', 'publish-c', 'publish-go', 'publish-runner', 'repair-runtime', 'repair-wheels', 'repair-node', 'repair-c'])
+ assert.deepEqual(workflow.on.workflow_dispatch.inputs.command.options, ['publish', 'publish-runtime', 'publish-wheels', 'publish-node', 'publish-c', 'publish-go', 'publish-runner', 'repair-runtime', 'repair-wheels', 'repair-node', 'repair-c', 'repair-go'])
assert.equal(workflow.on.workflow_call, undefined)
})
diff --git a/apps/infra/scripts/release-candidate-stage.test.mjs b/apps/infra/scripts/release-candidate-stage.test.mjs
index d41943c7b..d38c0535b 100644
--- a/apps/infra/scripts/release-candidate-stage.test.mjs
+++ b/apps/infra/scripts/release-candidate-stage.test.mjs
@@ -54,7 +54,7 @@ test('stage binds candidate files and GHCR pins to the tagged commit and produce
`#!/bin/sh
case "$*" in
*commits/refs%2Ftags%2F*) printf '{"sha":"%s"}\\n' "$SHA" ;;
- *actions/runs/10/artifacts*) cat index.json ;;
+ *actions/runs/*/artifacts*) cat index.json ;;
*releases/7/assets*) jq -s '[.]' 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 ;;
@@ -63,8 +63,10 @@ case "$*" in
jq -sc --argjson id "$id" '.[]|select(.id != $id)' uploads.jsonl > next
mv next uploads.jsonl
echo "delete $id" >>changes ;;
+ 'release download '*) cp published-manifest.json "$9/$7" ;;
'release upload '*)
name=$(basename "$4")
+ if test "$name" = release-candidate.json; then cp "$4" published-manifest.json || exit 1; fi
digest=$(shasum -a 256 "$4" | cut -d' ' -f1)
if test "$7" = '--clobber'; then
jq -sc --arg name "$name" '.[]|select(.name != $name)' uploads.jsonl > next
@@ -112,10 +114,11 @@ esac
const conflict = { name: runtimeNames.at(-1), digest: hash('different release bytes'), state: 'uploaded' }
const existing = JSON.stringify(conflict) + '\n'
writeFileSync(join(dir, 'uploads.jsonl'), existing)
- const rejected = stage('candidate', 'attach', { CANDIDATE_DIGEST: fingerprint, RELEASE_ID: '7', REPAIR_GROUP: 'runtime-distribution' })
- assert.match(rejected.stderr, /Release already holds different bytes/)
- assert.equal(readFileSync(join(dir, 'uploads.jsonl'), 'utf8'), existing, 'a conflicting attachment must block earlier missing uploads')
- writeFileSync(join(dir, 'uploads.jsonl'), '')
+ const fullAttach = stage('candidate', 'attach', { CANDIDATE_DIGEST: fingerprint, RELEASE_ID: '7' })
+ assert.notEqual(fullAttach.status, 0)
+ assert.match(fullAttach.stderr, /Release already holds different bytes/)
+ assert.equal(readFileSync(join(dir, 'uploads.jsonl'), 'utf8'), existing)
+ assert.equal(existsSync(join(dir, 'changes')), false)
for (let attempt = 0; attempt < 2; attempt++) {
const attached = stage('candidate', 'attach', { CANDIDATE_DIGEST: fingerprint, RELEASE_ID: '7', REPAIR_GROUP: 'runtime-distribution' })
assert.equal(attached.status, 0, attached.stderr)
@@ -247,4 +250,44 @@ esac
writeFileSync(join(runtimeDir, 'producer.json'), JSON.stringify({ run: 10, attempt: 1, sha }))
rmSync(join(runtimeDir, 'install.sh.sha256'))
assert.match(stage('missing-sidecar').stderr, /Missing install.sh.sha256/)
+
+ await t.test('republishing the Runner records its current archive, GHCR pin and fallback producers', () => {
+ // Publish over the original sealed manifest from run 10, then inspect what a repair would read.
+ setAssets([old])
+ cpSync(join(dir, 'candidate/release-candidate.json'), join(dir, 'published-manifest.json'))
+ writeFileSync(join(dir, 'public'), '')
+ const runnerGroup = 'runner-linux-amd64'
+ const runnerPins = { manifest: hash('replacement manifest'), archive: hash('replacement runner') }
+ writeFileSync(join(dir, 'staged', runnerGroup, archive), 'replacement runner')
+ writeFileSync(join(dir, 'staged', runnerGroup, archive + '.sha256'), runnerPins.archive)
+ writeFileSync(join(dir, 'staged/ghcr-runner/runner.json'), JSON.stringify(runnerPins))
+ const producers = { [runnerGroup]: 701, 'ghcr-runner': 702 }
+ for (const [name, id] of Object.entries(producers)) {
+ writeFileSync(join(dir, 'staged', name, 'producer.json'), JSON.stringify({ sha, run: 11, attempt: 1 }))
+ index.find(item => item.name === name).id = id
+ }
+ writeFileSync(join(dir, 'index.json'), JSON.stringify([{ artifacts: index }]))
+ const built = stage('replacement', 'component', { COMPONENT_GROUP: runnerGroup, IMAGES: '[]', GITHUB_RUN_ID: '11' })
+ assert.equal(built.status, 0, built.stderr)
+ const attached = stage('replacement', 'attach', { REPAIR_GROUP: runnerGroup, RELEASE_ID: '7', CANDIDATE_DIGEST: built.stdout.trim() })
+ assert.equal(attached.status, 0, attached.stderr)
+ const published = JSON.parse(readFileSync(join(dir, 'published-manifest.json')))
+ assert.deepEqual(published.runner, runnerPins)
+ assert.equal(published.assets[archive].digest, runnerPins.archive)
+ for (const [name, id] of Object.entries(producers))
+ assert.deepEqual(published.producers[name], { id, attempt: 1, run: 11 })
+ assert.equal(published.run, receipt.run)
+ assert.deepEqual(published.images, receipt.images)
+ assert.deepEqual(published.assets['install.sh'], receipt.assets['install.sh'])
+
+ const minimal = { tag, sha, runner: receipt.runner, images: receipt.images }
+ writeFileSync(join(dir, 'published-manifest.json'), JSON.stringify(minimal))
+ const backfilled = stage('replacement', 'attach', { REPAIR_GROUP: runnerGroup, RELEASE_ID: '7', CANDIDATE_DIGEST: built.stdout.trim() })
+ assert.equal(backfilled.status, 0, backfilled.stderr)
+ const updated = JSON.parse(readFileSync(join(dir, 'published-manifest.json')))
+ assert.deepEqual(updated.images, minimal.images)
+ assert.deepEqual(updated.runner, runnerPins)
+ assert.equal(updated.assets[archive].digest, runnerPins.archive)
+ assert.deepEqual(updated.producers[runnerGroup], published.producers[runnerGroup])
+ })
})
diff --git a/apps/infra/scripts/release-candidate.mjs b/apps/infra/scripts/release-candidate.mjs
index b8b98afcc..5348a16cc 100644
--- a/apps/infra/scripts/release-candidate.mjs
+++ b/apps/infra/scripts/release-candidate.mjs
@@ -5,7 +5,8 @@ import assert from 'node:assert/strict'
import { execFileSync } from 'node:child_process'
import { createHash } from 'node:crypto'
import { createReadStream } from 'node:fs'
-import { copyFile, mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises'
+import { copyFile, mkdir, mkdtemp, open, readFile, readdir, rm, stat, writeFile } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { pathToFileURL } from 'node:url'
@@ -291,6 +292,147 @@ async function syncDraft(candidate, releaseId, manifestOnly) {
verify(inventory(), expected)
}
+async function repairComponent(tag, sha, releaseId, scope) {
+ await tagIdentity(tag, sha)
+ const release = api('releases/' + numberId(releaseId))
+ assert.ok(release.tag_name === tag && !release.draft, 'Repair requires the public Release for ' + tag)
+ const platforms = (await readJson('release-source/.github/ci-config.json')).platforms
+ const groups = await archiveSources(tag, platforms)
+ const selected = [...groups].filter(([group]) => group.startsWith(scope))
+ assert.ok(scope && selected.length, 'Unknown repair component: ' + scope)
+ const inventory = new Map(releaseAssets(releaseId).map(asset => [asset.name, asset]))
+ const scratch = await mkdtemp(join(tmpdir(), 'release-repair-'))
+ const repo = process.env.GITHUB_REPOSITORY
+ function download(name, directory) {
+ gh('release', 'download', tag, '--repo', repo, '--pattern', name, '--dir', directory)
+ }
+ let manifest
+ async function sourceManifest(missing) {
+ if (manifest) return manifest
+ assert.ok(inventory.has(metadata), 'Missing ' + missing + ' and no fallback manifest')
+ download(metadata, scratch)
+ manifest = await readJson(join(scratch, metadata))
+ assert.ok(manifest.tag === tag && manifest.sha === sha, 'Fallback manifest belongs to a different release')
+ return manifest
+ }
+ try {
+ const expected = new Map()
+ for (const [group, contract] of selected)
+ for (const name of contract.required) expected.set(name, group)
+ if (scope === 'wheels-') {
+ const accepts = selected[0][1].accepts
+ const liveWheels = [...inventory.values()].filter(asset =>
+ assetName.test(asset.name) && accepts(asset.name) && asset.state === 'uploaded' && asset.size > 0)
+ const rows = (await readFile(process.env.WHEEL_IDENTIFIERS, 'utf8')).trim().split(/\r?\n/)
+ for (const row of rows) {
+ const [group, id] = row.split('\t')
+ assert.ok(group.startsWith(scope) && groups.has(group), 'Unknown wheel producer: ' + group)
+ const match = /^(cp\d+)(t?)-(manylinux|macosx)_(x86_64|aarch64|arm64)$/.exec(id)
+ assert.ok(match, 'Unsupported wheel identifier: ' + id)
+ const [, python, threading, platform, arch] = match
+ const prefix = 'boxlite-' + tag.slice(1) + '-' + python + '-' + python + threading + '-'
+ const onPlatform = name => name.slice(0, -4).split('-').at(-1).split('.').some(part =>
+ part.startsWith(platform + '_') && part.endsWith('_' + arch))
+ for (const { name } of liveWheels)
+ if (onPlatform(name)) expected.set(name, group)
+ const matches = name => name.startsWith(prefix) && onPlatform(name)
+ if ([...expected.keys()].some(matches)) continue
+ const fallback = await sourceManifest(id)
+ const found = Object.entries(fallback.assets ?? {}).filter(([name, entry]) =>
+ entry.group === group && assetName.test(name) && accepts(name) && matches(name))
+ assert.ok(found.length, 'Missing Release wheel for ' + id)
+ for (const [name] of found) expected.set(name, group)
+ }
+ for (const { name } of liveWheels) assert.ok(expected.has(name), 'Unknown wheel platform: ' + name)
+ }
+ await mkdir(bundle)
+ const restored = []
+ const archives = new Map()
+ const assets = {}
+ for (const [name, group] of expected) {
+ assert.ok(assetName.test(name), 'Invalid release filename')
+ const path = join(bundle, name)
+ const live = inventory.get(name)
+ if (live?.state === 'uploaded' && live.size > 0) {
+ download(name, bundle)
+ } else {
+ const fallback = await sourceManifest(name)
+ const entry = fallback.assets?.[name]
+ const source = fallback.producers?.[entry?.group]
+ assert.ok(source && digestPattern.test(entry.digest),
+ 'Missing Release attachment and matching fallback: ' + name)
+ assert.equal(entry.group, group)
+ const id = numberId(source.id)
+ if (!archives.has(id)) {
+ const artifact = api('actions/artifacts/' + id)
+ assert.ok(!artifact.expired && artifact.name === group && artifact.workflow_run.id === numberId(source.run ?? manifest.run),
+ 'Unavailable source artifact for ' + name)
+ const archive = join(scratch, id + '.zip')
+ await toFile(archive, 'gh', ['api', 'repos/' + repo + '/actions/artifacts/' + id + '/zip'])
+ archives.set(id, archive)
+ }
+ await toFile(path, 'unzip', ['-p', archives.get(id), name])
+ assert.equal(await fileDigest(path), entry.digest, 'Recovered file differs from manifest: ' + name)
+ restored.push(name)
+ }
+ assert.ok((await stat(path)).size > 0, 'Empty release attachment: ' + name)
+ assets[name] = { group, digest: await fileDigest(path) }
+ }
+ // Validate the complete selection before writing anything. Never clobber a primary asset during repair.
+ for (const name of restored) {
+ const existing = inventory.get(name)
+ if (existing) {
+ const current = releaseAssets(releaseId).find(asset => asset.name === name)
+ if (current) {
+ assert.ok(current.id === existing.id && current.size === 0 && ['starter', 'uploaded'].includes(current.state),
+ 'Release attachment changed or is not an empty upload placeholder: ' + name)
+ gh('api', '--method', 'DELETE', 'repos/' + repo + '/releases/assets/' + numberId(current.id))
+ }
+ }
+ gh('release', 'upload', tag, join(bundle, name), '--repo', repo)
+ }
+ await writeFile(join(bundle, metadata), JSON.stringify({ tag, sha, assets }) + '\n')
+ return fileDigest(join(bundle, metadata))
+ } finally {
+ await rm(scratch, { recursive: true, force: true })
+ }
+}
+
+async function toFile(path, command, args) {
+ const file = await open(path, 'wx')
+ try {
+ execFileSync(command, args, { stdio: ['ignore', file.fd, 'inherit'] })
+ } finally {
+ await file.close()
+ }
+}
+
+// Keep fallback sources and the host's Runner pin aligned with standalone replacements.
+async function updatePublishedSources(candidate, files, releaseId) {
+ if (!releaseAssets(releaseId).some(asset => asset.name === metadata)) return
+ const directory = await mkdtemp(join(tmpdir(), 'release-sources-'))
+ try {
+ gh('release', 'download', candidate.tag, '--repo', process.env.GITHUB_REPOSITORY, '--pattern', metadata, '--dir', directory)
+ const path = join(directory, metadata)
+ const published = await readJson(path)
+ assert.ok(published.tag === candidate.tag && published.sha === candidate.sha, 'Unexpected release manifest identity')
+ published.assets ??= {}
+ published.producers ??= {}
+ for (const [name, entry] of Object.entries(files)) {
+ published.assets[name] = entry
+ published.producers[entry.group] = { ...candidate.producers[entry.group], run: candidate.run }
+ }
+ if (Object.values(files).some(entry => entry.group === 'runner-linux-amd64')) {
+ published.runner = candidate.runner
+ published.producers['ghcr-runner'] = { ...candidate.producers['ghcr-runner'], run: candidate.run }
+ }
+ await writeFile(path, JSON.stringify(published, null, 2) + '\n')
+ gh('release', 'upload', candidate.tag, path, '--repo', process.env.GITHUB_REPOSITORY, '--clobber')
+ } finally {
+ await rm(directory, { recursive: true, force: true })
+ }
+}
+
async function publishFiles(candidate, id, scope, finalize = false) {
const release = api('releases/' + numberId(id))
assert.equal(release.tag_name, candidate.tag)
@@ -301,6 +443,12 @@ async function publishFiles(candidate, id, scope, finalize = false) {
assert.ok(Object.keys(files).length, 'No files for requested component')
if (!scope) files[metadata] = { digest: await fileDigest(join(bundle, metadata)) }
const uploadedAssets = () => new Map(releaseAssets(id).map((entry) => [entry.name, entry]))
+ if (scope && !finalize) {
+ for (const name of Object.keys(files))
+ gh('release', 'upload', candidate.tag, join(bundle, name), '--repo', process.env.GITHUB_REPOSITORY, '--clobber')
+ await updatePublishedSources(candidate, files, id)
+ return
+ }
if (!finalize) {
const existing = uploadedAssets()
if (!scope) assertNoExtraManagedAssets(existing, files)
@@ -333,6 +481,10 @@ async function publishFiles(candidate, id, scope, finalize = false) {
}
async function main(command) {
const { TAG: tag, SHA: sha, CANDIDATE_DIGEST: fingerprint, RELEASE_ID } = process.env
+ if (command === 'repair') {
+ console.log(await repairComponent(tag, sha, RELEASE_ID, process.env.COMPONENT_GROUP))
+ return
+ }
if (command === 'verify-public-c') return verifyPublicCArchives(tag, RELEASE_ID)
if (command === 'client-ids') {
await tagIdentity(tag, sha)
diff --git a/apps/infra/scripts/release-e2e-override.test.mjs b/apps/infra/scripts/release-e2e-override.test.mjs
index 71aae207b..ae0fe0c06 100644
--- a/apps/infra/scripts/release-e2e-override.test.mjs
+++ b/apps/infra/scripts/release-e2e-override.test.mjs
@@ -106,7 +106,7 @@ test('only release test steps tolerate failure and the protected review gates bo
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' },
+ distribution: { result: 'success' }, 'build-go': { result: 'success' }, 'build-go-other': { 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']")
diff --git a/apps/infra/scripts/release-pipeline.mjs b/apps/infra/scripts/release-pipeline.mjs
index 327cb42a6..307f48609 100644
--- a/apps/infra/scripts/release-pipeline.mjs
+++ b/apps/infra/scripts/release-pipeline.mjs
@@ -155,7 +155,9 @@ export const releaseReport = ({ repo, tag, runId, results }) => {
const release = VERSION.test(tag) ? tag : '(invalid release tag)'
const rows = [
['Release ref', results.resolve?.result],
- ...Object.entries(results).filter(([job]) => job.startsWith('build-')).map(([job, outcome]) => [job, outcome.result]),
+ ...Object.entries(results)
+ .filter(([job]) => job.startsWith('build-') || job.startsWith('package-'))
+ .map(([job, outcome]) => [job, outcome.result]),
['Image publication', results.publish?.result],
...(results['publish-runner'] ? [['Runner publication', results['publish-runner'].result]] : []),
['Release assets', results.distribution?.result],
diff --git a/apps/infra/scripts/release-pipeline.test.mjs b/apps/infra/scripts/release-pipeline.test.mjs
index fbc37e544..78b523ba5 100644
--- a/apps/infra/scripts/release-pipeline.test.mjs
+++ b/apps/infra/scripts/release-pipeline.test.mjs
@@ -214,6 +214,15 @@ test('null release responses are classified as malformed API data', async () =>
await assert.rejects(h.client.waitForAssets(), /Malformed GitHub JSON/)
})
+test('the failure notification identifies the failed packaging job', () => {
+ for (const name of ['package-runtime', 'package-node']) {
+ const results = { resolve: { result: 'success' }, [name]: { result: 'failure' }, distribution: { result: 'skipped' } }
+ const { phase, payload } = releaseReport({ repo, tag, runId: '10', results })
+ assert.equal(phase, name)
+ assert.match(payload.text, /failure/)
+ }
+})
+
test('Slack payloads are JSON, while HTTP and transport failures do not expose webhook secrets', async () => {
const payload = releaseReport({ repo, tag, runId: '10', results: {} }).payload
await sendSlack(webhook, payload, async (url, init) => {
diff --git a/apps/infra/scripts/release-platforms.test.mjs b/apps/infra/scripts/release-platforms.test.mjs
new file mode 100644
index 000000000..b6cfecc71
--- /dev/null
+++ b/apps/infra/scripts/release-platforms.test.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, spawnSync } from 'node:child_process'
+import { mkdtempSync, readFileSync, rmSync } 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'
+
+const workflow = name => load(readFileSync(new URL('../../../.github/workflows/' + name + '.yml', import.meta.url), 'utf8'))
+test('dev build calls select only Linux x64 and publication waits for their complements', () => {
+ const { jobs } = workflow('mbuild-release')
+ for (const component of ['runtime', 'wheels', 'node', 'c']) {
+ const id = 'build-' + component
+ assert.match(jobs[id].with.spec_platform ?? '', /linux-x64/, id + ' blocks dev on every platform')
+ assert.ok(jobs.dev.needs.includes(id))
+ assert.equal(jobs[id + '-other'].with.spec_platform, 'except-linux-x64')
+ assert.ok(!jobs.dev.needs.includes(id + '-other'))
+ }
+})
+
+test('the shared platform filter partitions the repository matrix and rejects unknown values', t => {
+ const directory = mkdtempSync(join(tmpdir(), 'release-platforms-'))
+ t.after(() => rmSync(directory, { recursive: true, force: true }))
+ const action = new URL('../../../.github/actions/ci-config/', import.meta.url)
+ const config = load(readFileSync(new URL('action.yml', action))).runs.steps[0]
+ function select(scope) {
+ const output = join(directory, scope || 'default')
+ const env = { ...process.env, GITHUB_ACTION_PATH: fileURLToPath(action), GITHUB_OUTPUT: output, FULL_MATRIX: 'true', SPEC_PLATFORM: scope }
+ execFileSync('bash', ['-ec', config.run], { env })
+ const row = readFileSync(output, 'utf8').split('\n').find(line => line.startsWith('platforms='))
+ return JSON.parse(row.slice('platforms='.length)).map(platform => platform.target)
+ }
+ const all = select('all')
+ assert.deepEqual(select(''), all)
+ assert.deepEqual(select('linux-x64'), ['linux-x64-gnu'])
+ assert.deepEqual(select('except-linux-x64'), all.filter(target => target !== 'linux-x64-gnu'))
+ const unknown = spawnSync('bash', ['-ec', config.run], { env: { ...process.env, FULL_MATRIX: 'true', SPEC_PLATFORM: 'macish' } })
+ assert.notEqual(unknown.status, 0)
+})
diff --git a/apps/infra/scripts/release-repair.test.mjs b/apps/infra/scripts/release-repair.test.mjs
new file mode 100644
index 000000000..f75a41f1f
--- /dev/null
+++ b/apps/infra/scripts/release-repair.test.mjs
@@ -0,0 +1,149 @@
+// 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 { createHash } from 'node:crypto'
+import { cpSync, existsSync, 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'
+
+const root = new URL('../../../', import.meta.url)
+const script = fileURLToPath(new URL('apps/infra/scripts/release-candidate.mjs', root))
+const tag = 'v1.2.3'
+const sha = 'a'.repeat(40)
+const group = 'wheels-ubuntu-latest'
+const primary = 'boxlite-1.2.3-cp314-cp314-manylinux_2_28_x86_64.whl'
+const missing = 'boxlite-1.2.3-cp314-cp314t-manylinux_2_28_x86_64.whl'
+const hash = text => 'sha256:' + createHash('sha256').update(text).digest('hex')
+
+function fixture(t) {
+ const dir = mkdtempSync(join(tmpdir(), 'release-repair-'))
+ t.after(() => rmSync(dir, { recursive: true, force: true }))
+ for (const name of ['release-source', 'release-source/.github', 'release', 'source']) mkdirSync(join(dir, name))
+ cpSync(new URL('.github/ci-config.json', root), join(dir, 'release-source/.github/ci-config.json'))
+ const releaseFile = name => join(dir, 'release', name)
+ writeFileSync(releaseFile(primary), 'updated release wheel')
+ writeFileSync(join(dir, 'ids'), group + '\tcp314-manylinux_x86_64\n' + group + '\tcp314t-manylinux_x86_64\n')
+ writeFileSync(join(dir, 'source', missing), 'original producer wheel')
+ execFileSync('zip', ['-q', join(dir, 'artifact.zip'), missing], { cwd: join(dir, 'source') })
+ writeFileSync(join(dir, 'gh'), `#!/bin/sh
+set -eu
+case "$*" in
+ *commits/refs%2Ftags%2F*) jq -n --arg sha "$SHA" '{sha:$sha}' ;;
+ *releases/7) echo '{"tag_name":"v1.2.3","draft":false}' ;;
+ *releases/7/assets*)
+ starter=$(cat starter 2>/dev/null || true)
+ ls release | jq -Rn --arg starter "$starter" '[[inputs | if .==$starter then {name:.,id:71,size:0,state:"starter"} else {name:.,size:8,state:"uploaded"} end]]' ;;
+ 'api --method DELETE repos/boxlite-ai/boxlite/releases/assets/71')
+ rm "release/$(cat starter)" starter ;;
+ 'release download '*) cp "release/$7" "$9/$7" ;;
+ *actions/artifacts/55/zip)
+ if test -f finish-upload; then
+ cp finish-upload "release/$(cat starter)"; rm starter
+ fi
+ cat artifact.zip ;;
+ *actions/artifacts/55) jq -n --argjson expired "$(test -e expired && echo true || echo false)" '{id:55,name:"wheels-ubuntu-latest",expired:$expired,workflow_run:{id:10}}' ;;
+ 'release upload '*)
+ name=$(basename "$4")
+ test ! -f "release/$name" || { echo "Asset already exists: $name" >&2; exit 1; }
+ if test -f interrupt-once; then
+ rm interrupt-once; echo "$name" > starter; touch "release/$name"; echo 'Interrupted upload' >&2; exit 1
+ fi
+ cp "$4" release/ ;;
+ *) echo "Unexpected gh command: $*" >&2; exit 2 ;;
+esac
+`, { mode: 0o755 })
+ function manifest(digest) {
+ writeFileSync(releaseFile('release-candidate.json'), JSON.stringify({
+ tag, sha, run: 10, producers: { [group]: { id: 55 } },
+ assets: { [primary]: { group, digest: hash('old wheel') }, [missing]: { group, digest } },
+ }))
+ }
+ function run() {
+ return spawnSync(process.execPath, [script, 'repair'], { cwd: dir, encoding: 'utf8', env: {
+ ...process.env, PATH: dir + ':' + process.env.PATH, TAG: tag, SHA: sha, GITHUB_REPOSITORY: 'boxlite-ai/boxlite',
+ RELEASE_ID: '7', COMPONENT_GROUP: 'wheels-', RELEASE_ASSET_DIR: join(dir, 'snapshot'), WHEEL_IDENTIFIERS: join(dir, 'ids'),
+ } })
+ }
+ return { dir, run, releaseFile, manifest }
+}
+
+test('repair publishes the live wheel and restores a missing free-threaded wheel from its producer', t => {
+ const { dir, run, releaseFile, manifest } = fixture(t)
+ manifest(hash('original producer wheel'))
+ const result = run()
+ assert.equal(result.status, 0, result.stderr)
+ assert.equal(readFileSync(releaseFile(primary), 'utf8'), 'updated release wheel')
+ assert.equal(readFileSync(releaseFile(missing), 'utf8'), 'original producer wheel')
+ const snapshot = JSON.parse(readFileSync(join(dir, 'snapshot/release-candidate.json')))
+ assert.equal(snapshot.assets[primary].group, group)
+ assert.equal(snapshot.assets[missing].group, group)
+ assert.equal(snapshot.assets[primary].digest, hash('updated release wheel'))
+ assert.equal(snapshot.assets[missing].digest, hash('original producer wheel'))
+})
+
+test('a complete Release works without a manifest or Actions artifacts', t => {
+ const { dir, run, releaseFile } = fixture(t)
+ writeFileSync(releaseFile(missing), 'released wheel')
+ const mac = 'boxlite-1.2.3-cp314-cp314-macosx_14_0_arm64.whl'
+ writeFileSync(releaseFile(mac), 'released Mac wheel')
+ const ids = join(dir, 'ids')
+ writeFileSync(ids, readFileSync(ids, 'utf8') + 'wheels-macos-15\tcp314-macosx_arm64\n')
+ rmSync(join(dir, 'artifact.zip'))
+ const result = run()
+ assert.equal(result.status, 0, result.stderr)
+ const snapshot = JSON.parse(readFileSync(join(dir, 'snapshot/release-candidate.json')))
+ assert.equal(snapshot.assets[mac].group, 'wheels-macos-15')
+ assert.equal(snapshot.assets[primary].group, group)
+})
+
+test('a partial release reports the missing wheel when no fallback exists', t => {
+ const { run, releaseFile } = fixture(t)
+ assert.match(run().stderr, /cp314t-manylinux_x86_64 and no fallback manifest/)
+ assert.equal(existsSync(releaseFile(missing)), false)
+})
+
+test('repair rejects damaged fallback bytes before restoring attachments', t => {
+ const { run, releaseFile, manifest } = fixture(t)
+ manifest(hash('different bytes'))
+ assert.match(run().stderr, /Recovered file differs from manifest/)
+ assert.equal(existsSync(releaseFile(missing)), false)
+})
+
+test('expired source artifacts cannot backfill a missing attachment', t => {
+ const { dir, run, releaseFile, manifest } = fixture(t)
+ manifest(hash('original producer wheel'))
+ writeFileSync(join(dir, 'expired'), '')
+ assert.match(run().stderr, /Unavailable source artifact/)
+ assert.equal(existsSync(releaseFile(missing)), false)
+})
+
+test('a retried repair replaces the empty placeholder left by an interrupted upload', t => {
+ const { dir, run, releaseFile, manifest } = fixture(t)
+ manifest(hash('original producer wheel'))
+ writeFileSync(join(dir, 'interrupt-once'), '')
+ assert.match(run().stderr, /Interrupted upload/)
+ assert.equal(readFileSync(releaseFile(missing), 'utf8'), '')
+ rmSync(join(dir, 'snapshot'), { recursive: true })
+ const retry = run()
+ assert.equal(retry.status, 0, retry.stderr)
+ assert.equal(readFileSync(releaseFile(missing), 'utf8'), 'original producer wheel')
+ assert.equal(readFileSync(releaseFile(primary), 'utf8'), 'updated release wheel')
+})
+
+test('a completed attachment appearing during recovery is preserved for the next attempt', t => {
+ const { dir, run, releaseFile, manifest } = fixture(t)
+ manifest(hash('original producer wheel'))
+ writeFileSync(releaseFile(missing), '')
+ writeFileSync(join(dir, 'starter'), missing)
+ writeFileSync(join(dir, 'finish-upload'), 'new public wheel')
+ assert.match(run().stderr, /Release attachment changed/)
+ assert.equal(readFileSync(releaseFile(missing), 'utf8'), 'new public wheel')
+ rmSync(join(dir, 'snapshot'), { recursive: true })
+ const retry = run()
+ assert.equal(retry.status, 0, retry.stderr)
+ const snapshot = JSON.parse(readFileSync(join(dir, 'snapshot/release-candidate.json')))
+ assert.equal(snapshot.assets[missing].digest, hash('new public wheel'))
+})
diff --git a/apps/infra/scripts/release-retry-contract.test.mjs b/apps/infra/scripts/release-retry-contract.test.mjs
index 21ff23237..17c105d2b 100644
--- a/apps/infra/scripts/release-retry-contract.test.mjs
+++ b/apps/infra/scripts/release-retry-contract.test.mjs
@@ -21,7 +21,7 @@ test('the exact Runner ID extracts alongside the checksum consumer', () => {
})
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 step = workflow('package-runtime').jobs.package.steps.find(step => step.with?.pattern)
const input = step.with.pattern
let pattern = input
if (input.startsWith('${{')) {
diff --git a/apps/infra/scripts/release-selection.mjs b/apps/infra/scripts/release-selection.mjs
index 3d7ba1bf2..2868269e3 100644
--- a/apps/infra/scripts/release-selection.mjs
+++ b/apps/infra/scripts/release-selection.mjs
@@ -14,9 +14,9 @@ const groups = {
runner: 'runner-linux-amd64',
}
-export function selectRelease(command, buildOnly, candidate, source) {
+export function selectRelease(command, buildOnly, source) {
if (command === 'publish') {
- assert.ok(!candidate && !source, 'A full release requires its product tag')
+ assert.ok(!source, 'A full release requires its product tag')
return { mode: buildOnly ? 'ghcr' : 'release', builds: buildOnly ? ['c', 'runner'] : Object.keys(groups), group: '', producer: '' }
}
const match = /^(publish|repair)-(runtime|wheels|node|c|go|runner)$/.exec(command)
@@ -24,19 +24,19 @@ export function selectRelease(command, buildOnly, candidate, source) {
const [, operation, component] = match
const group = groups[component]
if (operation === 'repair') {
- assert.ok(['runtime', 'wheels', 'node', 'c'].includes(component) && !buildOnly && !source && /^[1-9]\d*$/.test(candidate),
- 'Repair requires a candidate ID, a supported component and build-only=false')
+ assert.ok(['runtime', 'wheels', 'node', 'c', 'go'].includes(component) && !buildOnly && !source,
+ 'Repair requires a supported component, its release tag and build-only=false')
return { mode: 'repair', builds: [], group, producer: '' }
}
- assert.ok(!candidate && (buildOnly || !source), 'Only standalone builds accept a source ref')
+ assert.ok(buildOnly || !source, 'Only standalone builds accept a source ref')
const builds = ['go', 'runner'].includes(component) ? ['c', component] : [component]
const producer = component === 'runner' ? 'publish-runner' : 'build-' + component
return { mode: buildOnly ? 'build' : 'component', builds, group, producer }
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
- const { COMMAND, BUILD_ONLY, CANDIDATE, SOURCE, GITHUB_OUTPUT } = process.env
- const selection = selectRelease(COMMAND, BUILD_ONLY === 'true', CANDIDATE, SOURCE)
+ const { COMMAND, BUILD_ONLY, SOURCE, GITHUB_OUTPUT } = process.env
+ const selection = selectRelease(COMMAND, BUILD_ONLY === 'true', SOURCE)
for (const [key, value] of Object.entries(selection))
appendFileSync(GITHUB_OUTPUT, key + '=' + (Array.isArray(value) ? JSON.stringify(value) : value) + '\n')
}
diff --git a/apps/infra/scripts/release-workflow.test.mjs b/apps/infra/scripts/release-workflow.test.mjs
index 9705b89bf..022c5b093 100644
--- a/apps/infra/scripts/release-workflow.test.mjs
+++ b/apps/infra/scripts/release-workflow.test.mjs
@@ -29,12 +29,12 @@ test('release deployment is a native dependency in the publisher run', () => {
})
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' }
+ const components = { runtime: ['package-runtime'], wheels: ['build-wheels', 'build-wheels-other'], node: ['package-node'], c: ['build-c', 'build-c-other'], 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.deepEqual(job.needs, ['resolve', ...producer])
assert.ok(release.jobs.distribution.needs.includes(id))
assert.ok(!release.jobs.dev.needs.includes(id))
}
@@ -92,7 +92,7 @@ test('release caller routes the pinned C SDK build to its qualified runner', ()
['publish-c', false, '', 'ubuntu-latest'],
['publish-runner', false, '', 'ubuntu-latest'],
]) {
- const { mode } = selectRelease(command, buildOnly, '', source)
+ const { mode } = selectRelease(command, buildOnly, source)
const standalone = mode === 'build'
const caller = standalone ? readWorkflow('release-source-build').jobs['build-c'] : release.jobs['build-c']
const context = standalone
@@ -417,7 +417,7 @@ test('build-only never enters deployment, checks, or reporting; failed E2E canno
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))
+ for (const job of ['dev','package-runtime','package-node','attach','finalize','pypi','npm','publish_crates']) assert.ok(release.jobs.report.needs.includes(job), 'Missing failure reporting for ' + job)
assert.match(release.jobs.prod.if, /needs\.dev\.outputs\.accepted_attempt != ''/)
})
@@ -495,14 +495,13 @@ test('release SDK worktree uses the verified commit even when the remote has adv
assert.equal(common('suite/target/e2e-release'), common('suite'))
})
-test('component repairs use the accepted candidate and package publishers stay in the entry workflow', () => {
+test('component repairs snapshot the public Release and package publishers stay in the entry workflow', () => {
const commands = release.on.workflow_dispatch.inputs.command.options
- assert.deepEqual(commands.filter((name) => name.startsWith('repair-')), ['repair-runtime', 'repair-wheels', 'repair-node', 'repair-c'])
- const locate = release.jobs['accepted-candidate']
- const receipt = locate.steps.find((step) => step.id === 'receipt').run
- assert.match(receipt, /head_branch == "main"/)
- assert.match(receipt, /dev-accepted-\$ID/)
- assert.match(receipt, /\.candidate == \$id and \.run == \$run/)
+ assert.deepEqual(commands.filter(name => name.startsWith('repair-')), ['repair-runtime', 'repair-wheels', 'repair-node', 'repair-c', 'repair-go'])
+ assert.equal(release.on.workflow_dispatch.inputs['candidate-id'], undefined)
+ const recovery = release.jobs['accepted-candidate']
+ assert.equal(recovery.concurrency.group, release.jobs.attach.concurrency.group)
+ assert.match(recovery.steps.find(step => step.id === 'repair').run, /release-candidate.mjs repair/)
const attach = release.jobs.attach
assert.ok(attach.needs.includes('accepted-candidate'))
for (const [job, command] of [['npm','repair-node'],['pypi','repair-wheels']]) {
@@ -621,9 +620,9 @@ test('publication gates accept a skipped optional ancestor and require successfu
for (const [id, prerequisites, commands] of [
['npm', ['attach'], ['publish', 'publish-node', 'repair-node']],
['pypi', ['attach'], ['publish', 'publish-wheels', 'repair-wheels']],
- ['tag-go-module', ['finalize'], ['publish', 'publish-go']],
+ ['tag-go-module', ['finalize'], ['publish', 'publish-go', 'repair-go']],
['finalize', ['npm', 'pypi', 'attach'], ['publish']],
- ['publish_crates', ['finalize'], ['publish', 'publish-runtime']],
+ ['publish_crates', ['finalize'], ['publish', 'publish-runtime', 'repair-runtime']],
]) {
const condition = expression(release.jobs[id].if)
const evaluate = new Function('github', 'inputs', 'needs', 'cancelled', 'contains', 'fromJSON',
@@ -655,7 +654,7 @@ test('single components select their producers and bypass rollout, including wit
for (const [component, group] of Object.entries({ runtime: 'runtime-distribution', wheels: 'wheels-', node: 'node-packages', c: 'c-sdk-', go: '', runner: 'runner-linux-amd64' })) {
const command = 'publish-' + component
for (const buildOnly of [true, false]) {
- const selection = selectRelease(command, buildOnly, '', '')
+ const selection = selectRelease(command, buildOnly, '')
assert.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) } }
@@ -706,7 +705,16 @@ test('single components select their producers and bypass rollout, including wit
}
}
}
- assert.throws(() => selectRelease('publish-c', false, '', 'feature'))
- assert.throws(() => selectRelease('repair-node', false, '', ''))
- assert.throws(() => selectRelease('publish-runner', false, '3', ''))
+ assert.throws(() => selectRelease('publish-c', false, 'feature'))
+ assert.equal(selectRelease('repair-node', false, '').mode, 'repair')
+ assert.throws(() => selectRelease('repair-node', true, ''))
+})
+
+test('the installer and its smoke test use the release source checkout', () => {
+ const steps = readWorkflow('package-runtime').jobs.package.steps
+ const smoke = steps.find(step => step.env?.BOXLITE_INSTALL_TEMPLATE)
+ const script = smoke.run.match(/bash ([^ ]*scripts\/release\/test_install\.sh)/)[1]
+ const checkout = steps.filter(step => step.uses?.startsWith('actions/checkout@'))
+ .find(step => script.startsWith((step.with.path ? step.with.path + '/' : '') + 'scripts/'))
+ assert.equal(checkout.with.ref, steps.find(step => step.uses?.startsWith('actions/checkout@')).with.ref)
})
diff --git a/apps/infra/scripts/runtime-attachment.test.mjs b/apps/infra/scripts/runtime-attachment.test.mjs
index 1f404380e..83bc76a52 100644
--- a/apps/infra/scripts/runtime-attachment.test.mjs
+++ b/apps/infra/scripts/runtime-attachment.test.mjs
@@ -52,7 +52,7 @@ else process.exit(9);
LEDGER: join(dir, 'uploads'),
}
const code = new URL('./release-candidate.mjs', import.meta.url)
- for (const scope of ['', '', 'runtime-distribution']) {
+ for (const scope of ['', '']) {
const r = spawnSync(process.execPath, [resolve(code.pathname), 'attach'], {
cwd: dir,
env: { ...env, REPAIR_GROUP: scope },
diff --git a/scripts/release/test_install.sh b/scripts/release/test_install.sh
index 991b53b09..c2469fcb8 100755
--- a/scripts/release/test_install.sh
+++ b/scripts/release/test_install.sh
@@ -35,7 +35,7 @@ if [ -n "${BOXLITE_INSTALL_TEMPLATE-}" ]; then
# Validate a pre-rendered install.sh (the release job's dist/install.sh).
cp "$BOXLITE_INSTALL_TEMPLATE" "$tmp/install.sh"
else
- # Render the template the way build-runtime.yml does, with fake values.
+ # Render the template the way package-runtime.yml does, with fake values.
sed \
-e 's|__VERSION__|v0.0.0-test|g' \
-e 's|__SHA_AARCH64_APPLE_DARWIN__|0000000000000000000000000000000000000000000000000000000000000000|g' \
@@ -89,7 +89,7 @@ fi
# (b) and (c) are structural YAML tests, not behavioral runs, because we
# cannot invoke actions/attest-build-provenance locally.
#-----------------------------------------------------------------------------
-workflow="${repo_root}/.github/workflows/build-runtime.yml"
+workflow="${repo_root}/.github/workflows/package-runtime.yml"
# (a) Sidecar generation is reachable: produce install.sh.sha256 from our
# rendered install.sh the same way the workflow would, and verify it.
@@ -106,10 +106,13 @@ fi
exit 1
}
-# Structural test: the workflow must produce install.sh.sha256 as part of
-# the per-file sidecar step (either via glob or explicit invocation).
-if ! grep -E 'install\.sh\.sha256|install\.sh"' "$workflow" >/dev/null; then
- echo "FAIL: build-runtime.yml does not generate install.sh.sha256" >&2
+# Match the command that writes the installer sidecar.
+if ! awk '
+ /^ - name: Generate install\.sh\.sha256 sidecar$/ { in_block = 1; next }
+ in_block && /^ - / { exit }
+ in_block { print }
+' "$workflow" | grep -Eq '^[[:space:]]+sha256sum install\.sh > install\.sh\.sha256[[:space:]]*$'; then
+ echo "FAIL: package-runtime.yml does not generate install.sh.sha256" >&2
exit 1
fi
diff --git a/scripts/release/wheel-identifiers.sh b/scripts/release/wheel-identifiers.sh
new file mode 100644
index 000000000..3a884b861
--- /dev/null
+++ b/scripts/release/wheel-identifiers.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# Emit the producer group and cibuildwheel identifier for each tagged platform and ABI.
+set -euo pipefail
+cd "${1:?expected the release checkout}"
+version=$(sed -nE 's/^[[:space:]]*uses: pypa\/cibuildwheel@v([0-9]+\.[0-9]+\.[0-9]+)[[:space:]]*$/\1/p' .github/workflows/build-wheels.yml)
+[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo 'Missing tagged cibuildwheel version' >&2; exit 1; }
+venv="$RUNNER_TEMP/wheel-identifiers-venv"
+python3 -m venv "$venv"
+"$venv/bin/pip" --disable-pip-version-check install "cibuildwheel==$version" >&2
+platforms=$(jq -er '.platforms[] | [.os, .rust_target] | @tsv' .github/ci-config.json)
+while IFS=$'\t' read -r os target; do
+ case "$target" in
+ *-unknown-linux-gnu) platform=linux; arch=${target%%-*} ;;
+ aarch64-apple-darwin) platform=macos; arch=arm64 ;;
+ *) echo "Unsupported wheel target: $target" >&2; exit 1 ;;
+ esac
+ "$venv/bin/cibuildwheel" --print-build-identifiers --platform "$platform" --archs "$arch" sdks/python </dev/null |
+ awk -v group="wheels-$os" '{print group "\t" $0}'
+done <<< "$platforms"