From 79e4998b68d6c2b712ac6ccd80d6cad8c8d3086d Mon Sep 17 00:00:00 2001 From: Oll4 Open Source Date: Tue, 28 Jul 2026 08:13:24 +0300 Subject: [PATCH 1/2] fix(release): publish x64 host-root candidate --- .github/workflows/release.yml | 265 +++++++++++++++++- CHANGELOG.md | 7 + README.md | 25 +- docs/clean-room-testing.md | 7 +- docs/getting-started.md | 20 +- docs/operations.md | 16 +- docs/public-release.md | 30 +- docs/security-model.md | 6 +- package-lock.json | 5 +- packages/run-spaceapp/README.md | 13 +- packages/run-spaceapp/package.json | 9 +- packages/run-spaceapp/tests/cli.test.mjs | 82 +++--- .../tests/command-contracts.test.mjs | 14 +- .../run-spaceapp/tests/package-info.test.mjs | 9 +- scripts/public-release-readiness.mjs | 49 +++- scripts/release-artifact-preflight.mjs | 10 +- .../tests/public-package-metadata.test.mjs | 32 ++- .../tests/public-release-readiness.test.mjs | 39 +++ scripts/tests/public-workflows.test.mjs | 18 +- .../published-container-verification.test.mjs | 19 ++ .../tests/release-artifact-preflight.test.mjs | 15 + scripts/verify-published-containers.mjs | 71 ++++- 22 files changed, 608 insertions(+), 153 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0db5432f..2deb38235 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,14 +11,19 @@ on: description: Exact existing or newly built SpaceApp runtime image version required: true type: string + browser_source_version: + description: Existing browser image version reused by an amd64 core and CLI release + required: false + type: string release_mode: - description: Build full runtime images or publish only the launcher + description: Select full, launcher-only, or x64 core and CLI publication required: true default: full type: choice options: - full - launcher-only + - amd64-core-cli npm_tag: description: npm prerelease channel required: true @@ -62,6 +67,7 @@ jobs: env: RELEASE_VERSION: ${{ inputs.version }} RELEASE_RUNTIME_VERSION: ${{ inputs.runtime_version }} + RELEASE_BROWSER_SOURCE_VERSION: ${{ inputs.browser_source_version }} RELEASE_MODE: ${{ inputs.release_mode }} RELEASE_DIST_TAG: ${{ inputs.npm_tag }} run: >- @@ -70,6 +76,7 @@ jobs: --npm-tag "$RELEASE_DIST_TAG" --release-mode "$RELEASE_MODE" --runtime-version "$RELEASE_RUNTIME_VERSION" + --browser-source-version "$RELEASE_BROWSER_SOURCE_VERSION" source-candidate: name: Verify sanitized source and npm candidate @@ -238,6 +245,85 @@ jobs: path: trivy-full-${{ matrix.target }}-${{ matrix.arch }}.json if-no-files-found: error + amd64-container-candidate: + name: Sanitized ${{ matrix.target }} / linux-amd64 + needs: release-policy + if: inputs.release_mode == 'amd64-core-cli' + strategy: + fail-fast: false + matrix: + target: + - core + - cli + runs-on: ubuntu-latest + timeout-minutes: 65 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Create sanitized container context + run: >- + node scripts/public-export.mjs + --output "$RUNNER_TEMP/spaceapp-public-export" + + - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 + with: + context: ${{ runner.temp }}/spaceapp-public-export + target: ${{ matrix.target }} + platforms: linux/amd64 + push: false + load: true + tags: spaceapp-ci:${{ matrix.target }}-amd64 + provenance: false + cache-from: type=gha,scope=candidate-${{ matrix.target }}-amd64 + cache-to: type=gha,mode=max,scope=candidate-${{ matrix.target }}-amd64 + + - name: Enforce container size budget + working-directory: ${{ runner.temp }}/spaceapp-public-export + run: >- + node scripts/container-image-size-budget.mjs + --target "${{ matrix.target }}" + --image "spaceapp-ci:${{ matrix.target }}-amd64" + + - name: Block fixable container vulnerabilities + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 + with: + image-ref: spaceapp-ci:${{ matrix.target }}-amd64 + format: table + severity: MEDIUM,HIGH,CRITICAL + ignore-unfixed: true + exit-code: "1" + + - name: Capture full candidate image report + if: always() + uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 + with: + image-ref: spaceapp-ci:${{ matrix.target }}-amd64 + format: json + output: trivy-full-${{ matrix.target }}-amd64.json + severity: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL + ignore-unfixed: false + exit-code: "0" + + - name: Summarize full candidate image report + if: always() && hashFiles(format('trivy-full-{0}-amd64.json', matrix.target)) != '' + run: >- + node scripts/trivy-report-summary.mjs + --input "trivy-full-${{ matrix.target }}-amd64.json" + --label "${{ matrix.target }} / linux-amd64" + >> "$GITHUB_STEP_SUMMARY" + + - name: Upload full candidate image report + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: trivy-full-${{ matrix.target }}-amd64 + path: trivy-full-${{ matrix.target }}-amd64.json + if-no-files-found: error + existing-runtime: name: Verify existing runtime manifests and attestations needs: release-policy @@ -259,12 +345,37 @@ jobs: node scripts/verify-published-containers.mjs --version "${{ inputs.runtime_version }}" + existing-browser: + name: Verify the reused browser manifest and attestations + needs: release-policy + if: inputs.release_mode == 'amd64-core-cli' + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + packages: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - name: Verify the reusable browser architectures, SBOMs, and provenance + run: >- + node scripts/verify-published-containers.mjs + --version "${{ inputs.browser_source_version }}" + --targets browser + --architectures amd64,arm64 + publish-preflight: name: Approve and prove release tags are new needs: - source-candidate - container-candidate + - amd64-container-candidate - existing-runtime + - existing-browser if: >- always() && needs.source-candidate.result == 'success' && @@ -272,12 +383,23 @@ jobs: ( inputs.release_mode == 'full' && needs.container-candidate.result == 'success' && - needs.existing-runtime.result == 'skipped' + needs.amd64-container-candidate.result == 'skipped' && + needs.existing-runtime.result == 'skipped' && + needs.existing-browser.result == 'skipped' ) || ( inputs.release_mode == 'launcher-only' && needs.container-candidate.result == 'skipped' && - needs.existing-runtime.result == 'success' + needs.amd64-container-candidate.result == 'skipped' && + needs.existing-runtime.result == 'success' && + needs.existing-browser.result == 'skipped' + ) || + ( + inputs.release_mode == 'amd64-core-cli' && + needs.container-candidate.result == 'skipped' && + needs.amd64-container-candidate.result == 'success' && + needs.existing-runtime.result == 'skipped' && + needs.existing-browser.result == 'success' ) ) runs-on: ubuntu-latest @@ -292,10 +414,10 @@ jobs: persist-credentials: false - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 - if: inputs.release_mode == 'full' + if: inputs.release_mode != 'launcher-only' - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 - if: inputs.release_mode == 'full' + if: inputs.release_mode != 'launcher-only' with: registry: ghcr.io username: ${{ github.actor }} @@ -359,6 +481,81 @@ jobs: cache-from: type=gha,scope=publish-${{ matrix.target }} cache-to: type=gha,mode=max,scope=publish-${{ matrix.target }} + publish-amd64-containers: + name: Publish ${{ matrix.target }} linux-amd64 image + needs: publish-preflight + if: inputs.release_mode == 'amd64-core-cli' + strategy: + fail-fast: false + matrix: + target: + - core + - cli + runs-on: ubuntu-latest + timeout-minutes: 75 + environment: npm + permissions: + contents: read + packages: write + id-token: write + steps: + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: public-release-source-candidate-${{ inputs.version }} + path: ${{ runner.temp }}/release-artifacts + + - name: Restore verified sanitized source + run: | + mkdir -p "$RUNNER_TEMP/publish-context" + tar -C "$RUNNER_TEMP/publish-context" \ + -xzf "$RUNNER_TEMP/release-artifacts/spaceapp-public-export-${{ inputs.version }}.tar.gz" + + - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish immutable exact-version amd64 image + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 + with: + context: ${{ runner.temp }}/publish-context/spaceapp-public-export + target: ${{ matrix.target }} + platforms: linux/amd64 + push: true + tags: ghcr.io/oll4com/spaceapp-${{ matrix.target }}:${{ inputs.version }} + sbom: true + provenance: mode=max,version=v1 + cache-from: type=gha,scope=candidate-${{ matrix.target }}-amd64 + cache-to: type=gha,mode=max,scope=publish-${{ matrix.target }}-amd64 + + reuse-browser-manifest: + name: Reuse the existing signed browser manifest + needs: publish-preflight + if: inputs.release_mode == 'amd64-core-cli' + runs-on: ubuntu-latest + timeout-minutes: 15 + environment: npm + permissions: + contents: read + packages: write + steps: + - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Copy the immutable browser manifest without rebuilding it + run: >- + docker buildx imagetools create + --tag "ghcr.io/oll4com/spaceapp-browser:${{ inputs.version }}" + "ghcr.io/oll4com/spaceapp-browser:${{ inputs.browser_source_version }}" + verify-containers: name: Verify published manifests and attestations needs: publish-containers @@ -387,13 +584,49 @@ jobs: node scripts/verify-published-containers.mjs --version "${{ inputs.version }}" + verify-amd64-containers: + name: Verify published amd64 manifests and attestations + needs: + - publish-amd64-containers + - reuse-browser-manifest + if: inputs.release_mode == 'amd64-core-cli' + runs-on: ubuntu-latest + timeout-minutes: 15 + environment: npm + permissions: + contents: read + packages: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Verify amd64 SBOMs and provenance for every runtime service + run: >- + node scripts/verify-published-containers.mjs + --version "${{ inputs.version }}" + --targets core,cli,browser + --architectures amd64 + publish-npm: name: Publish run-spaceapp with npm OIDC needs: - publish-preflight - publish-containers - verify-containers + - publish-amd64-containers + - reuse-browser-manifest + - verify-amd64-containers - existing-runtime + - existing-browser if: >- always() && needs.publish-preflight.result == 'success' && @@ -402,13 +635,31 @@ jobs: inputs.release_mode == 'full' && needs.publish-containers.result == 'success' && needs.verify-containers.result == 'success' && - needs.existing-runtime.result == 'skipped' + needs.publish-amd64-containers.result == 'skipped' && + needs.reuse-browser-manifest.result == 'skipped' && + needs.verify-amd64-containers.result == 'skipped' && + needs.existing-runtime.result == 'skipped' && + needs.existing-browser.result == 'skipped' ) || ( inputs.release_mode == 'launcher-only' && needs.publish-containers.result == 'skipped' && needs.verify-containers.result == 'skipped' && - needs.existing-runtime.result == 'success' + needs.publish-amd64-containers.result == 'skipped' && + needs.reuse-browser-manifest.result == 'skipped' && + needs.verify-amd64-containers.result == 'skipped' && + needs.existing-runtime.result == 'success' && + needs.existing-browser.result == 'skipped' + ) || + ( + inputs.release_mode == 'amd64-core-cli' && + needs.publish-containers.result == 'skipped' && + needs.verify-containers.result == 'skipped' && + needs.publish-amd64-containers.result == 'success' && + needs.reuse-browser-manifest.result == 'success' && + needs.verify-amd64-containers.result == 'success' && + needs.existing-runtime.result == 'skipped' && + needs.existing-browser.result == 'success' ) ) runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b604377..a5f860e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ Semantic Versioning. ## [Unreleased] +## [0.1.15-hostroot.2] - 2026-07-28 + +- publish matching `core` and `cli` images for `linux/amd64` so the personal + candidate can run host-root CLI sessions on x64 Linux; +- reuse the existing signed browser manifest without rebuilding the browser; +- reject the personal candidate on arm64 before Docker image pulls. + ## [0.1.15-hostroot.1] - 2026-07-27 - accept the `7.4 GiB` usable memory reported by an 8 GB-class CachyOS laptop diff --git a/README.md b/README.md index 23fbdb0a2..3252d8d68 100644 --- a/README.md +++ b/README.md @@ -91,31 +91,20 @@ omits managed Chromium. Use managed browser container is required and the host has the recommended resources. -### Personal launcher-only candidate +### Personal Linux x64 candidate -The `0.1.15-hostroot.1` personal candidate contains cross-platform installer -fixes and deliberately reuses the already published `0.1.15-hostroot.0` -runtime images: +The `0.1.15-hostroot.2` personal candidate contains the installer, owner setup, +and host-root CLI fixes for x64 Linux: ```bash -npx --yes run-spaceapp@personal install -``` - -This candidate supports isolated access only. It rejects `--access host-root` -until matching runtime images are rebuilt in a future full release. The -launcher prints its own `.1` version separately from the pinned `.0` runtime -image version. - -The earlier host-root experiment remains available only by pinning its exact -launcher version on a disposable, trusted single-owner Linux test machine: - -```bash -npx --yes run-spaceapp@0.1.15-hostroot.0 install --access host-root +npx --yes run-spaceapp@personal install --access host-root ``` Host-root mounts Linux `/` read/write into `spaceapp-cli` and can expose every credential or make the operating system unbootable. It is not part of the -current cross-platform acceptance. +stable cross-platform release. The candidate publishes new `core` and `cli` +images only for `linux/amd64`; it reuses the existing signed browser manifest +without rebuilding it. npm rejects this candidate on arm64 hosts. The installer does not create or reserve a separate fixed-size VM. Linux uses the native Docker Engine; Windows uses Docker Desktop's WSL2 Linux environment; diff --git a/docs/clean-room-testing.md b/docs/clean-room-testing.md index aff13280e..c91327cfb 100644 --- a/docs/clean-room-testing.md +++ b/docs/clean-room-testing.md @@ -92,11 +92,10 @@ permissions, and image architecture—not just the repository build. ## Pinned CachyOS host-root acceptance Use an isolated CachyOS VM snapshot, never a workstation with valuable data. -This is a historical `.0` runtime check, not part of the launcher-only `.1` -cross-platform acceptance. Pin the exact version: +Use the x64 `.2` personal candidate: ```bash -npx --yes run-spaceapp@0.1.15-hostroot.0 install --access host-root +npx --yes run-spaceapp@personal install --access host-root ``` Confirm the generated configuration records `accessMode=host-root`, core sees @@ -110,7 +109,7 @@ Run the same command a second time and confirm readiness and persistent state are unchanged. Then run: ```bash -npx --yes run-spaceapp@0.1.15-hostroot.0 install --access isolated +npx --yes run-spaceapp@personal install --access isolated ``` Recreate the stack and prove `/host` is no longer mounted while SpaceApp data, diff --git a/docs/getting-started.md b/docs/getting-started.md index 1fb8647b1..59f238759 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -112,21 +112,11 @@ Installation profiles do not control filesystem permissions. Both `light` and `standard` use isolated access by default, where only registered workspaces are mounted. -The launcher-only `0.1.15-hostroot.1` personal candidate supports isolated -access only and reuses the existing `0.1.15-hostroot.0` runtime images: +The `0.1.15-hostroot.2` personal candidate enables host-root on a disposable, +trusted single-owner x64 Linux test machine: ```bash -npx --yes run-spaceapp@personal install -``` - -It rejects `--access host-root` until matching runtime images are rebuilt in a -future full release. - -The earlier `0.1.15-hostroot.0` experiment can still be pinned explicitly on a -disposable, trusted single-owner Linux test machine: - -```bash -npx --yes run-spaceapp@0.1.15-hostroot.0 install --access host-root +npx --yes run-spaceapp@personal install --access host-root ``` That mode remains one Docker-based SpaceApp build across Linux distributions. @@ -136,7 +126,9 @@ in this mode. On a normal rootful Docker Engine, this is equivalent to host-root file access: an agent can read credentials, change boot or package files, or destroy the operating system. -The mode does not mount the Docker socket and does not enable `privileged`, +The candidate publishes new `core` and `cli` images only for `linux/amd64` and +reuses the existing signed browser manifest without rebuilding it. npm rejects +the package on arm64. The mode does not mount the Docker socket and does not enable `privileged`, host PID, host network, host IPC, or host device access. Those omissions reduce the attack surface but do not make a writable host root safe from a malicious or mistaken CLI command. diff --git a/docs/operations.md b/docs/operations.md index 5f2f1d7f7..53fa4c17b 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -106,26 +106,24 @@ first. ## Linux access mode -The current `0.1.15-hostroot.1` personal candidate is launcher-only and accepts -isolated access only. It reuses the `0.1.15-hostroot.0` images and rejects -`--access host-root` until the next full runtime build. - -The earlier host-root experiment must be pinned exactly on a disposable Linux -test machine: +The current `0.1.15-hostroot.2` personal candidate enables host-root on a +disposable x64 Linux test machine: ```bash -npx --yes run-spaceapp@0.1.15-hostroot.0 install --access host-root +npx --yes run-spaceapp@personal install --access host-root ``` To remove the `/host` mount without deleting SpaceApp state or volumes: ```bash -npx --yes run-spaceapp@0.1.15-hostroot.0 install --access isolated +npx --yes run-spaceapp@personal install --access isolated ``` Use the `@personal` prefix for `doctor`, `status`, `logs`, credentials, and recovery commands while this prerelease is installed. `light` and `standard` -do not change the access mode. +do not change the access mode. The candidate is x64-only: core and CLI are +rebuilt for `linux/amd64`, while the existing signed browser manifest is reused +without a browser build. ## Rollback diff --git a/docs/public-release.md b/docs/public-release.md index 30462d48d..396ce0632 100644 --- a/docs/public-release.md +++ b/docs/public-release.md @@ -70,7 +70,35 @@ immutable GHCR tag. The accepted `0.1.14` release remains on both `latest` and `next` during the personal candidate test. -## Personal launcher-only prerelease +## Personal x64 core and CLI prerelease + +For `0.1.15-hostroot.2`, dispatch `release.yml` from `main` with: + +- `version`: `0.1.15-hostroot.2`; +- `runtime_version`: `0.1.15-hostroot.2`; +- `browser_source_version`: `0.1.15-hostroot.0`; +- `release_mode`: `amd64-core-cli`; +- `npm_tag`: `personal`. + +The workflow builds and scans only `core` and `cli` for `linux/amd64`. It +copies the already verified `.0` browser manifest to the new runtime tag +without rebuilding the browser. It verifies amd64 SBOM and provenance evidence +for all three published tags before npm OIDC publication. The npm package is +x64-only and enables host-root because the launcher and runtime versions match. +Do not change `latest` or `next`. + +After publication, run: + +```bash +npx --yes run-spaceapp@personal install --access host-root +``` + +Verify launcher and runtime `.2`, `/readyz`, the owner setup at 100% zoom, and +a host-root CLI session with `id -u` equal to `0`. If acceptance fails, restore +`personal` to `0.1.15-hostroot.1`; the immutable `.2` image tags remain +unreferenced. Do not modify any existing live SpaceApp or website installation. + +## Historical launcher-only prerelease For `0.1.15-hostroot.1`, dispatch `release.yml` from `main` with: diff --git a/docs/security-model.md b/docs/security-model.md index b3a230247..39d395e2d 100644 --- a/docs/security-model.md +++ b/docs/security-model.md @@ -43,10 +43,8 @@ SaaS control plane. ## Explicit Linux host-root mode -The earlier Linux host-root experiment is available only through the exact -`npx --yes run-spaceapp@0.1.15-hostroot.0 install --access host-root` command. -The launcher-only `.1` personal candidate rejects this mode until matching -runtime images are rebuilt. The `.0` experiment mounts the +The x64-only `.2` personal candidate enables this mode through +`npx --yes run-spaceapp@personal install --access host-root`. It mounts the host `/` at `/host`, read-only in `spaceapp-core` and read/write in `spaceapp-cli`, and runs CLI sessions as container root. With a normal rootful Docker Engine, this is equivalent to host-root file access. diff --git a/package-lock.json b/package-lock.json index ee77e4652..298a4ed63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8312,13 +8312,16 @@ } }, "packages/run-spaceapp": { - "version": "0.1.15-hostroot.1", + "version": "0.1.15-hostroot.2", "license": "Apache-2.0", "os": [ "darwin", "linux", "win32" ], + "cpu": [ + "x64" + ], "bin": { "run-spaceapp": "bin/spaceapp.mjs", "spaceapp": "bin/spaceapp.mjs" diff --git a/packages/run-spaceapp/README.md b/packages/run-spaceapp/README.md index b2f45217f..46040fb1d 100644 --- a/packages/run-spaceapp/README.md +++ b/packages/run-spaceapp/README.md @@ -52,17 +52,16 @@ current user's platform config directory: Set `SPACEAPP_HOME` to an absolute path to use a dedicated installation root. -The `0.1.15-hostroot.1` personal candidate tests installer fixes while reusing -the existing `0.1.15-hostroot.0` runtime images: +The `0.1.15-hostroot.2` personal candidate tests the complete x64 Linux +host-root path: ```bash -npx --yes run-spaceapp@personal install +npx --yes run-spaceapp@personal install --access host-root ``` -This launcher-only candidate accepts isolated access on Linux, macOS, and -Windows. It rejects `--access host-root` because no matching runtime images -were rebuilt. The launcher reports version `.1` while `runtime.env` remains -pinned to `.0`. +This candidate publishes matching `core` and `cli` images for `linux/amd64` +and reuses the existing signed browser manifest without rebuilding it. npm +rejects the package on arm64. Host-root is supported only on Linux. Use the same `npx --yes run-spaceapp@personal` prefix for follow-up commands while this prerelease is installed. diff --git a/packages/run-spaceapp/package.json b/packages/run-spaceapp/package.json index a838486e8..1d1695590 100644 --- a/packages/run-spaceapp/package.json +++ b/packages/run-spaceapp/package.json @@ -1,8 +1,8 @@ { "name": "run-spaceapp", - "version": "0.1.15-hostroot.1", - "spaceappRuntimeVersion": "0.1.15-hostroot.0", - "spaceappHostRootRuntimeCompatible": false, + "version": "0.1.15-hostroot.2", + "spaceappRuntimeVersion": "0.1.15-hostroot.2", + "spaceappHostRootRuntimeCompatible": true, "description": "Cross-platform Docker launcher for the SpaceApp self-hosted agent workspace", "license": "Apache-2.0", "type": "module", @@ -30,6 +30,9 @@ "linux", "win32" ], + "cpu": [ + "x64" + ], "scripts": { "test": "node --test tests/*.test.mjs", "check": "node --check bin/spaceapp.mjs && node --check src/package-info.mjs && node --check src/index.mjs && node --check src/cli.mjs && node --check src/prerequisites.mjs", diff --git a/packages/run-spaceapp/tests/cli.test.mjs b/packages/run-spaceapp/tests/cli.test.mjs index c9ea5a1ae..4117821bb 100644 --- a/packages/run-spaceapp/tests/cli.test.mjs +++ b/packages/run-spaceapp/tests/cli.test.mjs @@ -619,8 +619,8 @@ test("an existing host-root installation is rejected on non-Linux hosts before D } }); -test("the launcher-only candidate rejects Linux host-root before Docker or installation state", async () => { - const root = await mkdtemp(join(tmpdir(), "spaceapp-cli-launcher-only-host-root-")); +test("the matching x64 candidate enables Linux host-root through the normal install path", async () => { + const root = await mkdtemp(join(tmpdir(), "spaceapp-cli-matching-host-root-")); const calls = { prepareDockerPath: 0, inspectResources: 0, @@ -628,39 +628,43 @@ test("the launcher-only candidate rejects Linux host-root before Docker or insta execute: 0 }; - await assert.rejects( - () => run(["install", "--access", "host-root", "--no-open"], { - env: { SPACEAPP_HOME: root }, - platform: "linux", - stdout: capture().stream, - stderr: capture().stream, - stdin: Readable.from([]), - prepareDockerPath: async () => { - calls.prepareDockerPath += 1; - }, - inspectResources: async () => { - calls.inspectResources += 1; - return eightGigabyteClassLinuxGuest; - }, - ensureDocker: async () => { - calls.ensureDocker += 1; - return { code: 0, reexecuted: false }; - }, - execute: async () => { - calls.execute += 1; - return 0; - } - }), - /host-root access is disabled for this launcher-only candidate/i - ); + assert.equal(await run(["install", "--access", "host-root", "--no-open"], { + env: { SPACEAPP_HOME: root }, + platform: "linux", + stdout: capture().stream, + stderr: capture().stream, + stdin: Readable.from([]), + prepareDockerPath: async () => { + calls.prepareDockerPath += 1; + }, + inspectResources: async () => { + calls.inspectResources += 1; + return eightGigabyteClassLinuxGuest; + }, + ensureDocker: async () => { + calls.ensureDocker += 1; + return { code: 0, reexecuted: false }; + }, + request: async (url) => url.endsWith("/readyz") + ? jsonResponse({ ok: true }) + : jsonResponse({ setupRequired: false, expiresAt: null }), + sleep: async () => {}, + execute: async () => { + calls.execute += 1; + return 0; + } + }), 0); assert.deepEqual(calls, { - prepareDockerPath: 0, - inspectResources: 0, - ensureDocker: 0, - execute: 0 + prepareDockerPath: 1, + inspectResources: 1, + ensureDocker: 1, + execute: 3 }); - await assert.rejects(() => readFile(join(root, "config.json"), "utf8")); + assert.equal( + JSON.parse(await readFile(join(root, "config.json"), "utf8")).accessMode, + "host-root" + ); }); test("install enables, preserves, and removes Linux host-root access without deleting secrets", async () => { @@ -737,7 +741,7 @@ test("install enables, preserves, and removes Linux host-root access without del assert.equal(await readFile(join(root, "secrets", "session-secret"), "utf8"), secretBefore); }); -test("Windows launcher .1 upgrades a 0.1.10 standard install to runtime .0 light without changing persistent state", async () => { +test("Windows launcher .2 upgrades a 0.1.10 standard install to runtime .2 light without changing persistent state", async () => { const root = await mkdtemp(join(tmpdir(), "spaceapp-cli-stale-upgrade-")); const workspace = await mkdtemp(join(tmpdir(), "spaceapp-cli-stale-workspace-")); const initialized = await initializeInstallation(root, { @@ -792,7 +796,7 @@ test("Windows launcher .1 upgrades a 0.1.10 standard install to runtime .0 light ); assert.match( await readFile(join(stagedStateRoot, "runtime.env"), "utf8"), - /^SPACEAPP_IMAGE_TAG=0\.1\.15-hostroot\.0$/m + /^SPACEAPP_IMAGE_TAG=0\.1\.15-hostroot\.2$/m ); } return 0; @@ -802,7 +806,7 @@ test("Windows launcher .1 upgrades a 0.1.10 standard install to runtime .0 light assert.equal(await run(["install", "--no-open"], options), 0); const upgradedConfig = JSON.parse(await readFile(join(root, "config.json"), "utf8")); - assert.equal(upgradedConfig.version, "0.1.15-hostroot.0"); + assert.equal(upgradedConfig.version, "0.1.15-hostroot.2"); assert.equal(upgradedConfig.previousVersion, "0.1.10"); assert.equal(upgradedConfig.profile, "light"); assert.deepEqual(upgradedConfig.workspaces, staleConfig.workspaces); @@ -825,8 +829,8 @@ test("Windows launcher .1 upgrades a 0.1.10 standard install to runtime .0 light for (const spec of calls) { assert.equal(spec.args[spec.args.indexOf("--project-name") + 1], projectBefore); } - assert.match(stdout.value(), /Launcher version: 0\.1\.15-hostroot\.1/); - assert.match(stdout.value(), /Runtime image version: 0\.1\.10 -> 0\.1\.15-hostroot\.0/); + assert.match(stdout.value(), /Launcher version: 0\.1\.15-hostroot\.2/); + assert.match(stdout.value(), /Runtime image version: 0\.1\.10 -> 0\.1\.15-hostroot\.2/); assert.match(stdout.value(), /Profile: standard -> light/); assert.match(stdout.value(), /data.*workspaces.*credentials.*secrets.*persistent Docker volumes/i); @@ -837,7 +841,7 @@ test("Windows launcher .1 upgrades a 0.1.10 standard install to runtime .0 light stdout: refreshOutput.stream }), 0); const refreshedConfig = JSON.parse(await readFile(join(root, "config.json"), "utf8")); - assert.equal(refreshedConfig.version, "0.1.15-hostroot.0"); + assert.equal(refreshedConfig.version, "0.1.15-hostroot.2"); assert.equal(refreshedConfig.previousVersion, "0.1.10"); assert.equal(refreshedConfig.profile, "light"); assert.deepEqual(refreshedConfig.workspaces, staleConfig.workspaces); @@ -862,7 +866,7 @@ test("Windows launcher .1 upgrades a 0.1.10 standard install to runtime .0 light } assert.match( refreshOutput.value(), - /Runtime image version: 0\.1\.15-hostroot\.0 -> 0\.1\.15-hostroot\.0/ + /Runtime image version: 0\.1\.15-hostroot\.2 -> 0\.1\.15-hostroot\.2/ ); assert.match(refreshOutput.value(), /Profile: light -> light/); }); diff --git a/packages/run-spaceapp/tests/command-contracts.test.mjs b/packages/run-spaceapp/tests/command-contracts.test.mjs index a3f2f692f..6b6748adc 100644 --- a/packages/run-spaceapp/tests/command-contracts.test.mjs +++ b/packages/run-spaceapp/tests/command-contracts.test.mjs @@ -55,19 +55,19 @@ test("init and the default update target the pinned runtime image version", asyn }); let config = JSON.parse(await readFile(join(root, "config.json"), "utf8")); - assert.equal(config.version, "0.1.15-hostroot.0"); + assert.equal(config.version, "0.1.15-hostroot.2"); assert.match( await readFile(join(root, "runtime.env"), "utf8"), - /^SPACEAPP_IMAGE_TAG=0\.1\.15-hostroot\.0$/m + /^SPACEAPP_IMAGE_TAG=0\.1\.15-hostroot\.2$/m ); assert.equal(await run(["update"], options), 0); config = JSON.parse(await readFile(join(root, "config.json"), "utf8")); - assert.equal(config.version, "0.1.15-hostroot.0"); + assert.equal(config.version, "0.1.15-hostroot.2"); assert.equal(config.previousVersion, null); assert.match( await readFile(join(root, "runtime.env"), "utf8"), - /^SPACEAPP_IMAGE_TAG=0\.1\.15-hostroot\.0$/m + /^SPACEAPP_IMAGE_TAG=0\.1\.15-hostroot\.2$/m ); assert.deepEqual(calls.map((spec) => spec.args.at(-1)), [ "pull", @@ -232,14 +232,14 @@ test("update and rollback persist version state only after both Docker operation (({ version, previousVersion }) => ({ version, previousVersion }))( JSON.parse(await readFile(join(root, "config.json"), "utf8")) ), - { version: "0.1.6", previousVersion: "0.1.15-hostroot.0" } + { version: "0.1.6", previousVersion: "0.1.15-hostroot.2" } ); assert.equal(await run(["rollback"], options), 0); assert.deepEqual( (({ version, previousVersion }) => ({ version, previousVersion }))( JSON.parse(await readFile(join(root, "config.json"), "utf8")) ), - { version: "0.1.15-hostroot.0", previousVersion: "0.1.6" } + { version: "0.1.15-hostroot.2", previousVersion: "0.1.6" } ); assert.deepEqual(calls.map((spec) => spec.args.at(-1)), [ "pull", @@ -248,7 +248,7 @@ test("update and rollback persist version state only after both Docker operation "--remove-orphans" ]); assert.match(stdout.value(), /Updated to SpaceApp 0\.1\.6/); - assert.match(stdout.value(), /Rolled back to SpaceApp 0\.1\.15-hostroot\.0/); + assert.match(stdout.value(), /Rolled back to SpaceApp 0\.1\.15-hostroot\.2/); }); test("doctor is read-only for installation configuration and generated runtime files", async () => { diff --git a/packages/run-spaceapp/tests/package-info.test.mjs b/packages/run-spaceapp/tests/package-info.test.mjs index f7b68dcfb..358eb59d9 100644 --- a/packages/run-spaceapp/tests/package-info.test.mjs +++ b/packages/run-spaceapp/tests/package-info.test.mjs @@ -3,14 +3,15 @@ import { readFile } from "node:fs/promises"; import test from "node:test"; import * as packageInfo from "../src/package-info.mjs"; -test("launcher metadata pins the existing runtime images independently", async () => { +test("amd64 host-root launcher metadata pins the matching runtime", async () => { const manifest = JSON.parse( await readFile(new URL("../package.json", import.meta.url), "utf8") ); - assert.equal(manifest.version, "0.1.15-hostroot.1"); - assert.equal(manifest.spaceappRuntimeVersion, "0.1.15-hostroot.0"); - assert.equal(manifest.spaceappHostRootRuntimeCompatible, false); + assert.equal(manifest.version, "0.1.15-hostroot.2"); + assert.equal(manifest.spaceappRuntimeVersion, "0.1.15-hostroot.2"); + assert.equal(manifest.spaceappHostRootRuntimeCompatible, true); + assert.deepEqual(manifest.cpu, ["x64"]); assert.equal(packageInfo.PACKAGE_VERSION, manifest.version); assert.equal(packageInfo.RUNTIME_VERSION, manifest.spaceappRuntimeVersion); assert.equal( diff --git a/scripts/public-release-readiness.mjs b/scripts/public-release-readiness.mjs index 2dfc7d561..b2eefbc5a 100644 --- a/scripts/public-release-readiness.mjs +++ b/scripts/public-release-readiness.mjs @@ -12,9 +12,11 @@ export function evaluatePublicRelease({ requestedNpmTag, requestedReleaseMode = "full", requestedRuntimeVersion = requestedVersion, + requestedBrowserSourceVersion = "", packageVersion, packageRuntimeVersion = packageVersion, packageHostRootRuntimeCompatible = true, + packageCpu, notices, dockerfile, distributionPolicy @@ -38,7 +40,7 @@ export function evaluatePublicRelease({ "Host-root prereleases must publish only to the npm personal tag." ); } - if (!["full", "launcher-only"].includes(requestedReleaseMode)) { + if (!["full", "launcher-only", "amd64-core-cli"].includes(requestedReleaseMode)) { blockers.push(`Unknown release mode ${requestedReleaseMode}.`); } if (!isRegistrySafeReleaseVersion(requestedRuntimeVersion)) { @@ -51,11 +53,11 @@ export function evaluatePublicRelease({ ); } if ( - requestedReleaseMode === "full" && + ["full", "amd64-core-cli"].includes(requestedReleaseMode) && requestedRuntimeVersion !== requestedVersion ) { blockers.push( - "Full releases must publish runtime images at the exact launcher version." + "Runtime image releases must publish at the exact launcher version." ); } if ( @@ -66,6 +68,30 @@ export function evaluatePublicRelease({ "Launcher-only releases must disable host-root until matching runtime images are rebuilt." ); } + if (requestedReleaseMode === "amd64-core-cli") { + if ( + !isRegistrySafeReleaseVersion(requestedBrowserSourceVersion) || + requestedBrowserSourceVersion === requestedVersion + ) { + blockers.push( + "The amd64 core and CLI release must reuse a different, valid browser source version." + ); + } + if ( + !Array.isArray(packageCpu) || + packageCpu.length !== 1 || + packageCpu[0] !== "x64" + ) { + blockers.push( + "The amd64 core and CLI release must publish an x64-only launcher." + ); + } + if (packageHostRootRuntimeCompatible !== true) { + blockers.push( + "The amd64 core and CLI release must enable the matching host-root runtime." + ); + } + } const claudePolicy = distributionPolicy?.packages?.["@anthropic-ai/claude-code"]; if ( distributionPolicy?.schemaVersion !== 1 || @@ -101,6 +127,7 @@ function parseArgs(argv) { let requestedNpmTag = ""; let requestedReleaseMode = ""; let requestedRuntimeVersion = ""; + let requestedBrowserSourceVersion = ""; for (let index = 0; index < argv.length; index += 1) { const argument = argv[index]; if (argument === "--version" && argv[index + 1]) { @@ -115,27 +142,34 @@ function parseArgs(argv) { } else if (argument === "--runtime-version" && argv[index + 1]) { requestedRuntimeVersion = argv[index + 1]; index += 1; + } else if ( + argument === "--browser-source-version" && + index + 1 < argv.length + ) { + requestedBrowserSourceVersion = argv[index + 1]; + index += 1; } else { throw new Error( - "Usage: public-release-readiness.mjs --version --npm-tag --release-mode --runtime-version " + "Usage: public-release-readiness.mjs --version --npm-tag --release-mode --runtime-version [--browser-source-version ]" ); } } if ( !requestedVersion || !["next", "personal"].includes(requestedNpmTag) || - !["full", "launcher-only"].includes(requestedReleaseMode) || + !["full", "launcher-only", "amd64-core-cli"].includes(requestedReleaseMode) || !requestedRuntimeVersion ) { throw new Error( - "Usage: public-release-readiness.mjs --version --npm-tag --release-mode --runtime-version " + "Usage: public-release-readiness.mjs --version --npm-tag --release-mode --runtime-version [--browser-source-version ]" ); } return { requestedVersion, requestedNpmTag, requestedReleaseMode, - requestedRuntimeVersion + requestedRuntimeVersion, + requestedBrowserSourceVersion }; } @@ -155,6 +189,7 @@ export async function runCli(argv) { packageRuntimeVersion: packageManifest.spaceappRuntimeVersion, packageHostRootRuntimeCompatible: packageManifest.spaceappHostRootRuntimeCompatible, + packageCpu: packageManifest.cpu, notices, dockerfile, distributionPolicy diff --git a/scripts/release-artifact-preflight.mjs b/scripts/release-artifact-preflight.mjs index ada81e316..30337c915 100644 --- a/scripts/release-artifact-preflight.mjs +++ b/scripts/release-artifact-preflight.mjs @@ -30,7 +30,7 @@ export function evaluateArtifactAvailability({ blockers.push(`Could not prove that npm package run-spaceapp@${version} is absent.`); } - if (releaseMode === "full") { + if (releaseMode !== "launcher-only") { for (const target of targets) { const image = `ghcr.io/oll4com/spaceapp-${target}:${version}`; const result = images[target]; @@ -69,16 +69,16 @@ function parseArgs(argv) { index += 1; } else { throw new Error( - "Usage: release-artifact-preflight.mjs --version --release-mode " + "Usage: release-artifact-preflight.mjs --version --release-mode " ); } } if ( !isRegistrySafeReleaseVersion(version) || - !["full", "launcher-only"].includes(releaseMode) + !["full", "launcher-only", "amd64-core-cli"].includes(releaseMode) ) { throw new Error( - "Usage: release-artifact-preflight.mjs --version --release-mode " + "Usage: release-artifact-preflight.mjs --version --release-mode " ); } return { version, releaseMode }; @@ -87,7 +87,7 @@ function parseArgs(argv) { export function runCli(argv) { const { version, releaseMode } = parseArgs(argv); const npm = run("npm", ["view", `run-spaceapp@${version}`, "version"]); - const images = releaseMode === "full" + const images = releaseMode !== "launcher-only" ? Object.fromEntries( targets.map((target) => [ target, diff --git a/scripts/tests/public-package-metadata.test.mjs b/scripts/tests/public-package-metadata.test.mjs index e1dd1fa15..fa21f283e 100644 --- a/scripts/tests/public-package-metadata.test.mjs +++ b/scripts/tests/public-package-metadata.test.mjs @@ -39,22 +39,25 @@ test("public command guards reject forbidden commands inside inline Markdown", ( assert.match("Use `spaceapp doctor` to diagnose it.", globalFollowUpCommand); }); -test("active documentation does not route host-root through the launcher-only personal tag", async () => { +test("active documentation routes host-root through the x64 personal candidate", async () => { for (const path of [ "README.md", "packages/run-spaceapp/README.md", - "docs/clean-room-testing.md", "docs/getting-started.md", "docs/operations.md", - "docs/public-release.md", "docs/security-model.md" ]) { const content = await readFile(join(root, path), "utf8"); - assert.doesNotMatch( + assert.match( content, /npx --yes run-spaceapp@personal install --access host-root/, path ); + assert.doesNotMatch( + content, + /npx --yes run-spaceapp@0\.1\.15-hostroot\.0 install --access host-root/, + path + ); } }); @@ -141,7 +144,7 @@ test("public repository metadata declares Apache-2.0 with only the launcher publ assert.deepEqual(publishable, [{ name: "run-spaceapp", - version: "0.1.15-hostroot.1", + version: "0.1.15-hostroot.2", bin: { spaceapp: "bin/spaceapp.mjs", "run-spaceapp": "bin/spaceapp.mjs" @@ -150,8 +153,9 @@ test("public repository metadata declares Apache-2.0 with only the launcher publ const launcherPackage = JSON.parse( await readFile(join(root, "packages", "run-spaceapp", "package.json"), "utf8") ); - assert.equal(launcherPackage.spaceappRuntimeVersion, "0.1.15-hostroot.0"); - assert.equal(launcherPackage.spaceappHostRootRuntimeCompatible, false); + assert.equal(launcherPackage.spaceappRuntimeVersion, "0.1.15-hostroot.2"); + assert.equal(launcherPackage.spaceappHostRootRuntimeCompatible, true); + assert.deepEqual(launcherPackage.cpu, ["x64"]); assert.equal(launcherPackage.publishConfig.tag, undefined); }); @@ -338,13 +342,19 @@ test("public docs provide one-command installation for Linux, macOS, and Windows assert.match(gettingStarted, /group grants root-level privileges/i); assert.match( gettingStarted, - /npx --yes run-spaceapp@0\.1\.15-hostroot\.0 install --access host-root/ + /npx --yes run-spaceapp@personal install --access host-root/ ); assert.match(gettingStarted, /--access isolated/); assert.match(gettingStarted, /equivalent to\s+host-root\s+file access/i); - assert.match(packageReadme, /run-spaceapp@personal install/); - assert.match(packageReadme, /rejects `--access host-root`/i); - assert.match(packageReadme, /existing `0\.1\.15-hostroot\.0` runtime images/i); + assert.match( + packageReadme, + /run-spaceapp@personal install --access host-root/ + ); + assert.match( + packageReadme, + /matching `core` and `cli` images for `linux\/amd64`/i + ); + assert.match(packageReadme, /rejects the package on arm64/i); for (const command of [ "provider install claude", "help", diff --git a/scripts/tests/public-release-readiness.test.mjs b/scripts/tests/public-release-readiness.test.mjs index 7992f7559..e8932ce6a 100644 --- a/scripts/tests/public-release-readiness.test.mjs +++ b/scripts/tests/public-release-readiness.test.mjs @@ -85,6 +85,45 @@ test("launcher-only readiness blocks runtime input drift", () => { assert.match(result.blockers.join("\n"), /runtime.*does not match/i); }); +test("amd64 core and CLI readiness accepts a matching host-root runtime for an x64 launcher", () => { + const result = evaluatePublicRelease({ + requestedVersion: "0.1.15-hostroot.2", + requestedNpmTag: "personal", + requestedReleaseMode: "amd64-core-cli", + requestedRuntimeVersion: "0.1.15-hostroot.2", + requestedBrowserSourceVersion: "0.1.15-hostroot.0", + packageVersion: "0.1.15-hostroot.2", + packageRuntimeVersion: "0.1.15-hostroot.2", + packageHostRootRuntimeCompatible: true, + packageCpu: ["x64"], + notices, + dockerfile: "FROM node:22\n", + distributionPolicy: policy + }); + + assert.equal(result.ok, true); + assert.deepEqual(result.blockers, []); +}); + +test("amd64 core and CLI readiness blocks a launcher that could install on arm64", () => { + const result = evaluatePublicRelease({ + requestedVersion: "0.1.15-hostroot.2", + requestedNpmTag: "personal", + requestedReleaseMode: "amd64-core-cli", + requestedRuntimeVersion: "0.1.15-hostroot.2", + requestedBrowserSourceVersion: "0.1.15-hostroot.0", + packageVersion: "0.1.15-hostroot.2", + packageRuntimeVersion: "0.1.15-hostroot.2", + packageHostRootRuntimeCompatible: true, + notices, + dockerfile: "FROM node:22\n", + distributionPolicy: policy + }); + + assert.equal(result.ok, false); + assert.match(result.blockers.join("\n"), /x64-only/i); +}); + test("public release readiness reserves host-root versions for the personal tag", () => { const result = evaluatePublicRelease({ requestedVersion: "0.1.15-hostroot.0", diff --git a/scripts/tests/public-workflows.test.mjs b/scripts/tests/public-workflows.test.mjs index 25d5df9d1..90b0d7a60 100644 --- a/scripts/tests/public-workflows.test.mjs +++ b/scripts/tests/public-workflows.test.mjs @@ -124,8 +124,12 @@ test("release is manual-only on main and publishes only approved sanitized artif assert.doesNotMatch(release, /--allow-review-required/); assert.match(trigger, /workflow_dispatch:/); assert.match(trigger, /npm_tag:[\s\S]*type: choice[\s\S]*- next[\s\S]*- personal/); - assert.match(trigger, /release_mode:[\s\S]*type: choice[\s\S]*- full[\s\S]*- launcher-only/); + assert.match( + trigger, + /release_mode:[\s\S]*type: choice[\s\S]*- full[\s\S]*- launcher-only[\s\S]*- amd64-core-cli/ + ); assert.match(trigger, /runtime_version:[\s\S]*required: true[\s\S]*type: string/); + assert.match(trigger, /browser_source_version:[\s\S]*required: false[\s\S]*type: string/); assert.doesNotMatch(trigger, /pull_request:|schedule:|\n push:/); assert.match(release, /permissions:\n contents: read/); assert.match(release, /github\.ref == 'refs\/heads\/main'/); @@ -147,6 +151,18 @@ test("release is manual-only on main and publishes only approved sanitized artif assert.match(release, /container-candidate:[\s\S]*if: inputs\.release_mode == 'full'/); assert.match(release, /publish-containers:[\s\S]*if: inputs\.release_mode == 'full'/); assert.match(release, /existing-runtime:[\s\S]*if: inputs\.release_mode == 'launcher-only'/); + assert.match( + release, + /amd64-container-candidate:[\s\S]*if: inputs\.release_mode == 'amd64-core-cli'[\s\S]*target:[\s\S]*- core[\s\S]*- cli[\s\S]*platforms: linux\/amd64/ + ); + assert.match( + release, + /publish-amd64-containers:[\s\S]*if: inputs\.release_mode == 'amd64-core-cli'[\s\S]*target:[\s\S]*- core[\s\S]*- cli[\s\S]*platforms: linux\/amd64/ + ); + assert.match( + release, + /reuse-browser-manifest:[\s\S]*if: inputs\.release_mode == 'amd64-core-cli'[\s\S]*docker buildx imagetools create[\s\S]*spaceapp-browser:\$\{\{ inputs\.version \}\}[\s\S]*spaceapp-browser:\$\{\{ inputs\.browser_source_version \}\}/ + ); assert.match( release, /publish-npm:[\s\S]*if: >-[\s\S]*always\(\)[\s\S]*needs\.existing-runtime\.result == 'success'/ diff --git a/scripts/tests/published-container-verification.test.mjs b/scripts/tests/published-container-verification.test.mjs index 9aecbdb1e..644fe0bb4 100644 --- a/scripts/tests/published-container-verification.test.mjs +++ b/scripts/tests/published-container-verification.test.mjs @@ -69,6 +69,25 @@ test("published container verification requires both platforms and attestations" ); }); +test("published container verification accepts an explicit amd64-only release", () => { + assert.deepEqual( + evaluatePublishedContainer({ + image: "ghcr.io/oll4com/spaceapp-core:0.1.15-hostroot.2", + manifest: { + manifests: [manifest.manifests[0], manifest.manifests[2]] + }, + attestations: [ + { + descriptor: manifest.manifests[2], + manifest: attestationManifest + } + ], + architectures: ["amd64"] + }), + { ok: true, blockers: [] } + ); +}); + test("published container verification aggregates split attestations for one platform", () => { assert.deepEqual( evaluatePublishedContainer({ diff --git a/scripts/tests/release-artifact-preflight.test.mjs b/scripts/tests/release-artifact-preflight.test.mjs index 33f49b9ae..fd455730d 100644 --- a/scripts/tests/release-artifact-preflight.test.mjs +++ b/scripts/tests/release-artifact-preflight.test.mjs @@ -76,3 +76,18 @@ test("launcher-only preflight requires a new npm version but reuses existing ima assert.deepEqual(result, { ok: true, blockers: [] }); }); + +test("amd64 core and CLI preflight reserves new tags for every runtime service", () => { + const result = evaluateArtifactAvailability({ + releaseMode: "amd64-core-cli", + version: "0.1.15-hostroot.2", + npm: { status: 1, output: "npm error code E404" }, + images: { + core: absent, + cli: absent, + browser: absent + } + }); + + assert.deepEqual(result, { ok: true, blockers: [] }); +}); diff --git a/scripts/verify-published-containers.mjs b/scripts/verify-published-containers.mjs index 3813c99bf..b968da929 100644 --- a/scripts/verify-published-containers.mjs +++ b/scripts/verify-published-containers.mjs @@ -5,14 +5,20 @@ import { pathToFileURL } from "node:url"; import { isRegistrySafeReleaseVersion } from "./release-version.mjs"; const targets = ["core", "cli", "browser"]; +const architectures = ["amd64", "arm64"]; const sbomPredicate = "https://spdx.dev/Document"; const provenancePredicate = "https://slsa.dev/provenance/v1"; -export function evaluatePublishedContainer({ image, manifest, attestations }) { +export function evaluatePublishedContainer({ + image, + manifest, + attestations, + architectures: requiredArchitectures = architectures +}) { const blockers = []; const manifests = Array.isArray(manifest?.manifests) ? manifest.manifests : []; - for (const architecture of ["amd64", "arm64"]) { + for (const architecture of requiredArchitectures) { const platformManifest = manifests.find( (entry) => entry?.platform?.os === "linux" && @@ -90,27 +96,70 @@ export function loadPublishedContainerEvidence(image, inspect = inspectRaw) { }; } -function parseArgs(argv) { +function commaSeparatedValues(value, allowed, label) { + const values = value.split(",").filter(Boolean); if ( - argv.length !== 2 || - argv[0] !== "--version" || - !isRegistrySafeReleaseVersion(argv[1]) + values.length === 0 || + new Set(values).size !== values.length || + values.some((entry) => !allowed.includes(entry)) ) { throw new Error( - "Usage: verify-published-containers.mjs --version " + `Invalid ${label}: ${value}.` ); } - return argv[1]; + return values; +} + +function parseArgs(argv) { + let version = ""; + let requestedTargets = targets; + let requestedArchitectures = architectures; + for (let index = 0; index < argv.length; index += 1) { + const argument = argv[index]; + if (argument === "--version" && argv[index + 1]) { + version = argv[index + 1]; + index += 1; + } else if (argument === "--targets" && argv[index + 1]) { + requestedTargets = commaSeparatedValues(argv[index + 1], targets, "targets"); + index += 1; + } else if (argument === "--architectures" && argv[index + 1]) { + requestedArchitectures = commaSeparatedValues( + argv[index + 1], + architectures, + "architectures" + ); + index += 1; + } else { + throw new Error( + "Usage: verify-published-containers.mjs --version [--targets core,cli,browser] [--architectures amd64,arm64]" + ); + } + } + if (!isRegistrySafeReleaseVersion(version)) { + throw new Error( + "Usage: verify-published-containers.mjs --version [--targets core,cli,browser] [--architectures amd64,arm64]" + ); + } + return { + version, + targets: requestedTargets, + architectures: requestedArchitectures + }; } export function runCli(argv) { - const version = parseArgs(argv); + const { + version, + targets: requestedTargets, + architectures: requestedArchitectures + } = parseArgs(argv); const blockers = []; - for (const target of targets) { + for (const target of requestedTargets) { const image = `ghcr.io/oll4com/spaceapp-${target}:${version}`; const result = evaluatePublishedContainer({ image, - ...loadPublishedContainerEvidence(image) + ...loadPublishedContainerEvidence(image), + architectures: requestedArchitectures }); blockers.push(...result.blockers); } From fc89e5cfd5a80fa9a42062a470606b1ad1d87d31 Mon Sep 17 00:00:00 2001 From: Oll4 Open Source Date: Tue, 28 Jul 2026 08:16:52 +0300 Subject: [PATCH 2/2] fix(ci): test x64 package source on ARM --- .github/workflows/platform-matrix.yml | 9 ++++++++- scripts/tests/public-workflows.test.mjs | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/platform-matrix.yml b/.github/workflows/platform-matrix.yml index 7213ef46c..e09ecb53c 100644 --- a/.github/workflows/platform-matrix.yml +++ b/.github/workflows/platform-matrix.yml @@ -45,7 +45,14 @@ jobs: node-version: ${{ matrix.node }} cache: npm - - run: npm ci + - name: Install workspace dependencies on supported hosts + if: runner.arch != 'ARM64' + run: npm ci + + - name: Install source workspace for the intentional x64 package rejection test + if: runner.arch == 'ARM64' + run: npm ci --force + - run: npm test -w run-spaceapp - run: npm run check -w run-spaceapp - run: npm run pack:dry-run -w run-spaceapp diff --git a/scripts/tests/public-workflows.test.mjs b/scripts/tests/public-workflows.test.mjs index 90b0d7a60..95eb1eeb5 100644 --- a/scripts/tests/public-workflows.test.mjs +++ b/scripts/tests/public-workflows.test.mjs @@ -36,6 +36,14 @@ test("launcher and container matrices cover the declared operating systems and a platform, /name: Launcher \/ \$\{\{ matrix\.os \}\} \/ Node \$\{\{ matrix\.node \}\}/ ); + assert.match( + platform, + /if: runner\.arch == 'ARM64'[\s\S]*run: npm ci --force/ + ); + assert.match( + platform, + /if: runner\.arch != 'ARM64'[\s\S]*run: npm ci/ + ); assert.match(platform, /- os: windows-latest\s+node: "24"/); assert.equal([...platform.matchAll(/- os: windows-latest/g)].length, 2); for (const target of ["core", "browser", "cli"]) {