From d22f5d301aed1d1435e1bc07f479aa139b0ba7ef Mon Sep 17 00:00:00 2001 From: SkyFi Geek <45924209+mobileskyfi@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:02:30 -0700 Subject: [PATCH] OCI release smoke: full MCP session on amd64 + arm64 before tag promotion (#246) --- .github/workflows/release.yml | 317 +++++++++++++++++++++++----------- CHANGELOG.md | 1 + MANUAL.md | 6 +- VALIDATION.md | 8 +- project-words.txt | 1 + scripts/smoke-oci.ts | 105 ++++++++++- src/app-integration.test.ts | 65 ++++++- src/release.test.ts | 112 ++++++++++-- 8 files changed, 491 insertions(+), 124 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95fb134..45657a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,8 @@ permissions: contents: write packages: write -# Phase B (#42) job graph: build → qa → publish → {verify-dist-tags, smoke}. +# Phase B (#42) job graph with the #246 OCI smoke legs: +# build → qa → publish → {smoke-oci → promote-oci, verify-dist-tags, smoke}. # # build extracts + stamps the DB once, runs the fast-fail + preflight gates, # and hands the DB (and the workspace-rewritten package.json) to the @@ -52,8 +53,15 @@ permissions: # DB-content floors, db-meta) now runs here, against the exact DB build # produced. No inline copy of those gates (or the floors) lives in this # file anymore, so there is nothing to drift. -# publish side effects only — OCI push, GitHub Release, npm publish — gated -# behind `needs: [build, qa]` so nothing ships unless qa is green. +# publish side effects only — sha-tagged OCI push, GitHub Release, npm +# publish — gated behind `needs: [build, qa]` so nothing ships +# unless qa is green. +# smoke-oci real MCP sessions (`scripts/smoke-oci.ts`) against the pushed +# sha tag on native amd64 + arm64 Docker, one leg per arch. Both +# legs must pass before any version/floating OCI tag moves. +# promote-oci copies the smoke-tested multi-arch manifest onto $VERSION +# (+ `:next`/`:latest` per the npm scheme) via imagetools — needs +# both smoke-oci legs, so a red leg leaves floating tags untouched. # verify-dist-tags reads the npm dist-tags back after publish (slow registry # propagation fails here without blocking the smoke). # smoke `uses: ./.github/workflows/release-smoke.yml` — end-to-end install + @@ -639,6 +647,7 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ needs.build.outputs.version }} + move_next: ${{ steps.next_tag.outputs.move }} steps: - uses: actions/checkout@v7 @@ -735,12 +744,12 @@ jobs: echo "✓ next ($CURRENT) is already ≥ $NEW — leaving it" fi - # Only the immutable sha-$SHORT_SHA tag pushes here. The smoke step below - # tests that tag, and "Promote smoke-tested OCI images" adds $VERSION and - # any floating tag afterwards, so an image that fails the smoke never - # moves :next or :latest (#142's v0.11.2 image did, before this order). + # Only the immutable sha-$SHORT_SHA tag pushes here. The smoke-oci job + # below tests that tag with a real MCP session on both architectures, + # and the promote-oci job adds $VERSION and any floating tag afterwards, + # so an image that fails the smoke never moves :next or :latest (#142's + # v0.11.2 image did, before this order). - name: Build and push OCI images (Docker Hub + GHCR) - id: oci run: | set -euo pipefail SHORT_SHA="${{ needs.build.outputs.short_sha }}" @@ -749,8 +758,6 @@ jobs: while [[ "$RUNTIME_VERSION" == v* ]]; do RUNTIME_VERSION="${RUNTIME_VERSION#v}" done - VERSION="v${RUNTIME_VERSION}" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" tags=() for registry in ammo74/rosetta ghcr.io/tikoci/rosetta; do @@ -767,96 +774,6 @@ jobs: -f Dockerfile.release \ . - - name: Smoke test published OCI images - run: | - set -euo pipefail - SHA_TAG="sha-${{ needs.build.outputs.short_sha }}" - - smoke_test_container() { - local image="$1" - local name="$2" - local port="$3" - - docker rm -f "$name" >/dev/null 2>&1 || true - echo "Starting: docker run -d --name $name -p ${port}:8080 $image" - docker run -d --name "$name" -p "${port}:8080" "$image" - - ok=0 - for i in $(seq 1 20); do - state=$(docker inspect "$name" --format '{{.State.Status}}' 2>/dev/null || echo gone) - if [ "$state" = exited ] || [ "$state" = gone ]; then - echo "Container exited early (state=$state, attempt=$i)" - break - fi - code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/mcp" || true) - if [ "$code" != 000 ] && [ "$code" != 404 ]; then - ok=1 - break - fi - sleep 1 - done - - if [ "$ok" -ne 1 ]; then - echo "::group::Diagnostic info for $image" - docker inspect "$name" --format 'Status={{.State.Status}} Exit={{.State.ExitCode}} Error={{.State.Error}} OOMKilled={{.State.OOMKilled}}' 2>&1 || true - docker logs "$name" 2>&1 || true - echo "::endgroup::" - docker rm -f "$name" >/dev/null 2>&1 || true - return 1 - fi - - docker rm -f "$name" >/dev/null 2>&1 || true - echo "✓ $image OK (HTTP $code)" - } - - port=18080 - for image in "ammo74/rosetta:${SHA_TAG}" "ghcr.io/tikoci/rosetta:${SHA_TAG}"; do - echo "── Smoke testing $image ──" - docker pull "$image" - name="rosetta-smoke-$(echo "$image" | tr '/:.' '-')" - smoke_test_container "$image" "$name" "$port" || { - echo "::error::Smoke test failed for $image" - exit 1 - } - done - - # OCI tags mirror the npm dist-tag scheme: $VERSION always. - # republish_assets: true adds ONLY that — no floating tag ever moves - # during a republish, so a re-run of an older version can't regress what - # a floating tag currently points testers at. Otherwise: prerelease runs - # get a floating :next; latest-channel runs get the bare :latest tag, - # plus :next when the decision step above moves npm's next. :latest never - # pushes on a prerelease run — this is the fix for the OCI-latest-clobber - # risk (an unguarded prerelease dispatch would otherwise silently - # overwrite the production /app container's :latest with an unfinished - # prerelease DB). imagetools copies the smoke-tested multi-arch manifest - # as-is; nothing is rebuilt. - - name: Promote smoke-tested OCI images - env: - REPUBLISH_ASSETS: ${{ inputs.republish_assets }} - MOVE_NEXT: ${{ steps.next_tag.outputs.move }} - VERSION: ${{ steps.oci.outputs.version }} - run: | - set -euo pipefail - SHORT_SHA="${{ needs.build.outputs.short_sha }}" - CHANNEL="${{ needs.build.outputs.channel }}" - - for registry in ammo74/rosetta ghcr.io/tikoci/rosetta; do - tags=(--tag "${registry}:${VERSION}") - if [ "$REPUBLISH_ASSETS" != "true" ]; then - if [ "$CHANNEL" = "prerelease" ]; then - tags+=(--tag "${registry}:next") - else - tags+=(--tag "${registry}:latest") - if [ "$MOVE_NEXT" = "true" ]; then - tags+=(--tag "${registry}:next") - fi - fi - fi - docker buildx imagetools create "${tags[@]}" "${registry}:sha-${SHORT_SHA}" - echo "✓ ${registry}:sha-${SHORT_SHA} → ${tags[*]}" - done - - name: Create or update GitHub Release env: GH_TOKEN: ${{ github.token }} @@ -1002,6 +919,206 @@ jobs: if: inputs.republish_assets == true run: echo "republish_assets=true → skipping npm publish (npm versions are immutable; bump package.json for a new npm package)" + # Real MCP sessions against the just-pushed sha tag (#246): one leg per + # architecture on native Docker (no QEMU/BINFMT emulation — ubuntu-24.04-arm runs + # arm64 containers natively). Each leg pulls both registries, asserts the + # pulled image is its own architecture (so a manifest/platform mix-up can't + # pass silently), and runs scripts/smoke-oci.ts — HTTP status alone no + # longer passes. Both legs must be green before promote-oci moves any tag. + smoke-oci: + needs: [build, publish] + strategy: + fail-fast: false + matrix: + include: + - arch: amd64 + runs-on: ubuntu-latest + - arch: arm64 + runs-on: ubuntu-24.04-arm + runs-on: ${{ matrix.runs-on }} + steps: + - uses: actions/checkout@v7 + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - run: bun install + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v4 + with: + username: ammo74 + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GHCR + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + # What was tested: the multi-arch manifest digest + each platform + # digest for both registries, recorded before the sessions run. + - name: Record tested manifest digests + env: + SHORT_SHA: ${{ needs.build.outputs.short_sha }} + run: | + set -euo pipefail + { + echo "## smoke-oci (${{ matrix.arch }})" + echo "" + for registry in ammo74/rosetta ghcr.io/tikoci/rosetta; do + echo "### ${registry}:sha-${SHORT_SHA}" + echo "" + echo '```' + docker buildx imagetools inspect "${registry}:sha-${SHORT_SHA}" + echo '```' + echo "" + done + } >> "$GITHUB_STEP_SUMMARY" + + - name: Smoke test published OCI images (real MCP session) + env: + EXPECTED_ARCH: ${{ matrix.arch }} + BUILD_VERSION: ${{ needs.build.outputs.version }} + SHORT_SHA: ${{ needs.build.outputs.short_sha }} + run: | + set -euo pipefail + SHA_TAG="sha-${SHORT_SHA}" + + smoke_test_container() { + local image="$1" + local name="$2" + local port="$3" + + docker rm -f "$name" >/dev/null 2>&1 || true + echo "Starting: docker run -d --name $name -p ${port}:8080 $image" + docker run -d --name "$name" -p "${port}:8080" "$image" + + # Readiness wait only — the pass/fail verdict comes from the MCP + # session below, never from HTTP status. + ready=0 + for i in $(seq 1 60); do + state=$(docker inspect "$name" --format '{{.State.Status}}' 2>/dev/null || echo gone) + if [ "$state" = exited ] || [ "$state" = gone ]; then + echo "Container exited early (state=$state, attempt=$i)" + break + fi + code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${port}/mcp" || true) + if [ "$code" != 000 ] && [ "$code" != 404 ]; then + ready=1 + break + fi + sleep 2 + done + + if [ "$ready" -ne 1 ]; then + echo "::group::Diagnostic info for $image" + echo "container never became ready" + docker inspect "$name" --format 'Status={{.State.Status}} Exit={{.State.ExitCode}} Error={{.State.Error}} OOMKilled={{.State.OOMKilled}}' 2>&1 || true + docker logs "$name" 2>&1 || true + echo "::endgroup::" + docker rm -f "$name" >/dev/null 2>&1 || true + return 1 + fi + + if ! bun scripts/smoke-oci.ts "http://127.0.0.1:${port}/mcp" "$BUILD_VERSION" 2>&1; then + echo "::group::Diagnostic info for $image" + docker inspect "$name" --format 'Status={{.State.Status}} Exit={{.State.ExitCode}} Error={{.State.Error}} OOMKilled={{.State.OOMKilled}}' 2>&1 || true + docker logs "$name" 2>&1 || true + echo "::endgroup::" + docker rm -f "$name" >/dev/null 2>&1 || true + return 1 + fi + + docker rm -f "$name" >/dev/null 2>&1 || true + echo "✓ $image OK" + } + + port=18080 + for image in "ammo74/rosetta:${SHA_TAG}" "ghcr.io/tikoci/rosetta:${SHA_TAG}"; do + echo "── Smoke testing $image (${EXPECTED_ARCH}) ──" + docker pull "$image" + pulled_arch=$(docker image inspect "$image" --format '{{.Architecture}}') + if [ "$pulled_arch" != "$EXPECTED_ARCH" ]; then + echo "::error::${image} pulled ${pulled_arch}, expected ${EXPECTED_ARCH}" + exit 1 + fi + echo "✓ ${image} is ${pulled_arch}" + name="rosetta-smoke-$(echo "$image" | tr '/:.' '-')" + smoke_test_container "$image" "$name" "$port" || { + echo "::error::Smoke test failed for $image" + exit 1 + } + done + + # OCI tags mirror the npm dist-tag scheme: $VERSION always. + # republish_assets: true adds ONLY that — no floating tag ever moves + # during a republish, so a re-run of an older version can't regress what + # a floating tag currently points testers at. Otherwise: prerelease runs + # get a floating :next; latest-channel runs get the bare :latest tag, + # plus :next when the decision step moves npm's next. :latest never + # pushes on a prerelease run — this is the fix for the OCI-latest-clobber + # risk (an unguarded prerelease dispatch would otherwise silently + # overwrite the production /app container's :latest with an unfinished + # prerelease DB). imagetools copies the smoke-tested multi-arch manifest + # as-is; nothing is rebuilt. This job needs both smoke-oci legs, so a + # failure in either leaves :latest / :next untouched. + promote-oci: + needs: [build, publish, smoke-oci] + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v4 + with: + username: ammo74 + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GHCR + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Promote smoke-tested OCI images + env: + REPUBLISH_ASSETS: ${{ inputs.republish_assets }} + MOVE_NEXT: ${{ needs.publish.outputs.move_next }} + BUILD_VERSION: ${{ needs.build.outputs.version }} + CHANNEL: ${{ needs.build.outputs.channel }} + SHORT_SHA: ${{ needs.build.outputs.short_sha }} + run: | + set -euo pipefail + RUNTIME_VERSION="$BUILD_VERSION" + while [[ "$RUNTIME_VERSION" == v* ]]; do + RUNTIME_VERSION="${RUNTIME_VERSION#v}" + done + VERSION="v${RUNTIME_VERSION}" + + for registry in ammo74/rosetta ghcr.io/tikoci/rosetta; do + tags=(--tag "${registry}:${VERSION}") + if [ "$REPUBLISH_ASSETS" != "true" ]; then + if [ "$CHANNEL" = "prerelease" ]; then + tags+=(--tag "${registry}:next") + else + tags+=(--tag "${registry}:latest") + if [ "$MOVE_NEXT" = "true" ]; then + tags+=(--tag "${registry}:next") + fi + fi + fi + docker buildx imagetools create "${tags[@]}" "${registry}:sha-${SHORT_SHA}" + echo "✓ ${registry}:sha-${SHORT_SHA} → ${tags[*]}" + done + # Read back what the registry actually serves: this run's dist-tag must resolve # to the version just published, and next must be ≥ latest. Its own job (#176): # dist-tag propagation keeps getting slower (next.112 ~135s, next.113 ~185s, diff --git a/CHANGELOG.md b/CHANGELOG.md index 27ccf6f..a89b7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ uses [Semantic Versioning](https://semver.org/). ### Fixed - The README `/app` install steps now cover the storage-disk prerequisite (`/app/setup` or `/app/settings`, with sizing guidance): without a selected disk `/app/add` succeeds but the app sits idle with no error. The steps also note that the inline YAML's inner quotes must stay backslash-escaped. Phase 1 of #245. +- Release OCI images are smoke-tested with a real MCP session on both architectures before any version or floating tag moves. Each release runs `scripts/smoke-oci.ts` (initialize → tools/list → provenance match → search → chained get_page → command_tree → device_lookup) against the pushed image on native amd64 and arm64 Docker, asserting each leg pulled its own architecture; `:latest` / `:next` promote only after both legs pass. Previously only the amd64 image ran, and any non-404 HTTP response passed (#246). ## [0.12.0] — 2026-10-30 diff --git a/MANUAL.md b/MANUAL.md index 2efd72c..ca6494c 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -309,10 +309,12 @@ Published artifacts come from the GitHub Actions `Release` workflow (`workflow_d - **Inputs:** `version` (optional override — see "npm channel" below for how this interacts with prerelease dispatches), `docs_date`, `full_versions`, and `republish_assets`. - **`republish_assets`:** reuploads GitHub Release assets and OCI tags for an existing version. It does **not** republish npm because npm versions are immutable, and it never moves a floating OCI tag (`:latest`/`:next`) on any channel. See "Prerelease republish semantics" below for prerelease-specific caveats. -- **Job graph (Phase B, #42; #176):** `build` → `qa` → `publish` → {`verify-dist-tags`, `smoke`}. +- **Job graph (Phase B, #42; #176; #246):** `build` → `qa` → `publish` → {`smoke-oci` → `promote-oci`, `verify-dist-tags`, `smoke`}. - **`build`:** npm channel detection (+ workspace-only prerelease version rewrite) → CHANGELOG gate (latest only) → npm publish-access preflight → fast-fail quality gate → live Docusaurus extraction (`extract-docusaurus.ts --check-counts --strict`, proving `V-docusaurus-docs-count` on every run) → extraction chain → transcript/Dude cache imports → skill extraction → command linking → `schema_node_presence` GC → DB-wipe guard → `db_meta` stamping → DB-stats collection. Uploads the built DB and the resolved `package.json` as artifacts. - **`qa`:** `uses: ./.github/workflows/qa.yml` with `db_source=artifact` — the single definition of the release-locked gates (contract, retrieval evals, DB-content floors, `db_meta` presence) runs here against the exact DB `build` produced. Nothing publishes if it's red. - - **`publish`:** downloads the gated DB + resolved `package.json`, then OCI build/push → GitHub Release → npm publish (side effects only, keyed off `build`'s job outputs). + - **`publish`:** downloads the gated DB + resolved `package.json`, then sha-tagged OCI build/push → GitHub Release → npm publish (side effects only, keyed off `build`'s job outputs). Only the immutable `sha-` OCI tag pushes here. + - **`smoke-oci`:** one native-Docker leg per architecture (amd64 on `ubuntu-latest`, arm64 on `ubuntu-24.04-arm`). Each leg pulls both registries' `sha-` tag, asserts the pulled image is its own architecture, and runs `scripts/smoke-oci.ts` — a real MCP session (initialize → tools/list → provenance match → search → chained get_page → command_tree → device_lookup). HTTP status alone no longer passes. The multi-arch manifest digest + per-platform digests land in the job summary; failures keep the container inspect state/exit/OOM line, the container logs, and the MCP error. Rehearse the script locally against any reachable server: `bun scripts/smoke-oci.ts http://127.0.0.1:/mcp `. + - **`promote-oci`:** needs both `smoke-oci` legs, then copies the smoke-tested multi-arch manifest onto `$VERSION` (+ `:next`/`:latest` per the npm scheme) via `imagetools` — nothing is rebuilt. A failure in either leg leaves `:latest` / `:next` untouched. - **`verify-dist-tags`:** reads the npm dist-tags back (up to 15 minutes; see "npm channel" below). It is a separate job so that slow registry propagation fails the run without skipping the install smoke. - **`smoke`:** `uses: ./.github/workflows/release-smoke.yml`, the three-OS `bunx-smoke` and `bunx-upgrade-smoke` jobs. Both wait through the abbreviated install manifest Bun resolves from (`scripts/wait-for-registry.ts`, same 900s budget) — the full packument `npm view` sees can lead it, and that gap failed two releases (#202). `bunx-smoke` waits for the exact version, and its `--version` probe asserts the exact executed version; `bunx-upgrade-smoke` waits for the channel tag (`latest`/`next`) to resolve to the just-published version, then invokes the explicit-tag form with no `--refresh` and requires the new-release DB banner. The bare form is deliberately not gated: a warm bare `bunx` serves its cache with zero registry requests (decision B, #226); bare-form staleness is accepted behavior — see "How Updates Work". - **Re-running a skipped smoke:** `release-smoke.yml` is also dispatchable on its own against an already-published version, e.g. `gh workflow run release-smoke.yml -f version=v0.11.3-next.116 -f previous_version=v0.11.3-next.115`. Leave `previous_version` empty to run `bunx-smoke` only. `bunx-upgrade-smoke` resolves the dist-tag, so it can only pass for the version that is currently the tag's head. diff --git a/VALIDATION.md b/VALIDATION.md index e1bab5e..d7ab400 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -46,15 +46,17 @@ Tasks in `tasks/` reference these IDs in their `validation:` frontmatter. When a | V-bunx-upgrade | An explicitly shared `DB_PATH` holds a real `bunx`-installed DB seeded from the previously-published version on the same dist-tag auto-refreshes to the just-published version on an explicit-tag invocation (`@latest`/`@next`, no `--refresh`); a warm bare `bunx` serves its cache and is deliberately not gated (decision B, #226). `ROSETTA_OFFLINE=1` against that same stale DB degrades gracefully instead of crashing (#76/#23) | `bunx-upgrade-smoke` matrix (macOS/Linux/Windows) in `release-smoke.yml`; skipped (not failed) when no prior publish exists yet on that channel | blocking (when a previous version exists) | #226 | | V-stdio-handshake | MCP stdio handshake completes against a real `@modelcontextprotocol/sdk` client; no stdout pollution | `bun test src/mcp-stdio-client.test.ts` in `.github/workflows/test.yml` | blocking | — | | V-http-handshake | MCP HTTP handshake + multi-session lifecycle works end-to-end | `src/mcp-http.test.ts` | blocking | — | -| V-app-mcp-x86 | The README `/app` install works end to end on x86: a fresh CHR runs the README's own `/app/add` (HTTP leg) and serves a real MCP session (initialize → tools/list → provenance match → nonempty search) through its ui-url | `app-integration.yml` x86 leg (`scripts/app-integration.ts --arch x86`); unit + workflow-structure pins in `src/app-integration.test.ts` | non-blocking (manual dispatch) | #245 | +| V-app-mcp-x86 | The README `/app` install works end to end on x86: a fresh CHR runs the README's own `/app/add` (HTTP leg) and serves a real MCP session (initialize → tools/list → provenance match → search → chained get_page → command_tree → device_lookup) through its ui-url | `app-integration.yml` x86 leg (`scripts/app-integration.ts --arch x86`, session via `scripts/smoke-oci.ts`); unit + workflow-structure pins in `src/app-integration.test.ts` | non-blocking (manual dispatch) | #245 | | V-app-mcp-arm64 | Same on arm64 CHR | `app-integration.yml` arm64 leg (`scripts/app-integration.ts --arch arm64`) | non-blocking (manual dispatch) | #245 | | V-tui-mcp-parity | Every MCP tool reachable via a `.routeros_*` dot-command in `browse` | `src/browse-parity.test.ts` via `bun test` in `.github/workflows/test.yml` | blocking | — | | V-cli-flag-uniformity | CLI flags documented in `MANUAL.md` match `bun src/mcp.ts --help` output | `src/cli-help.test.ts` via `bun test` in `.github/workflows/test.yml` | blocking | — | | V-cli-once-json | `browse --once .` prints exactly one JSON document to stdout (diagnostics on stderr) and exits non-zero when the dot-command fails | `src/browse-once.test.ts` via `bun test` in `.github/workflows/test.yml` | blocking | — | -| V-release-structure | Release artifacts, build constants, container entrypoint, the `release.yml` → `release-smoke.yml` job graph (smoke needs `publish` only, #176), the `bun` shebang on `bin/rosetta.js` (#175), and the CHANGELOG-first release body (#22) stay structurally consistent | `src/release.test.ts`; `src/release-notes.test.ts` (CHANGELOG block extraction) | blocking | — | +| V-release-structure | Release artifacts, build constants, container entrypoint, the `release.yml` → `release-smoke.yml` job graph (smoke needs `publish` only, #176), the `smoke-oci` → `promote-oci` OCI gate (#246), the `bun` shebang on `bin/rosetta.js` (#175), and the CHANGELOG-first release body (#22) stay structurally consistent | `src/release.test.ts`; `src/release-notes.test.ts` (CHANGELOG block extraction) | blocking | — | | V-command-version-coverage | Every RouterOS version restraml lists has `command_versions` rows in the shipped DB. A failed child extraction fails `extract-all-versions.ts` (naming the versions); restraml fetches retry 5xx/network errors and fail at once on a 404; the db-content gate compares the distinct version count with the `command_versions_expected` count the extraction stamped (#178: next.116 shipped without 7.15) | `extract-all-versions.ts` in `release.yml`'s build; `qa.yml` db-content gate; `src/extract-all-versions.test.ts`, `src/restraml.test.ts`, `src/release.test.ts` | blocking | #178 | | V-npm-channel-tags | Two channels only (#152): a `-next` package.json version publishes with `--tag next`, a bare version publishes with no `--tag` (`latest`), and any other prerelease identifier fails the run. `next` is never behind `latest`: a prerelease must be semver-newer than `latest` and `next` before build proceeds, a stable publish moves npm `next` and OCI `:next` when `next` is semver-lower, and a post-publish read-back fails the job unless the run's tag resolves to it and `next` ≥ `latest` | `src/release.test.ts` "npm prerelease channel" (structural, runs in test.yml on every push/PR); the `verify-dist-tags` job ("Read back npm dist-tags") on every `release.yml` publish | blocking | — | -| V-oci-latest-guard | The bare `:latest` OCI tag only pushes on a non-prerelease (latest-channel) release run — a prerelease dispatch can never clobber the production `/app` container's `:latest`. `:next` follows the same move decision as npm `next` | `src/release.test.ts` "OCI tags align with npm scheme..." (structural); functional behavior only exercised by an actual `release.yml` dispatch | blocking | — | +| V-oci-latest-guard | The bare `:latest` OCI tag only pushes on a non-prerelease (latest-channel) release run — a prerelease dispatch can never clobber the production `/app` container's `:latest`. `:next` follows the same move decision as npm `next`. Version and floating tags promote only after both `smoke-oci` legs pass, so a red leg leaves `:latest` / `:next` untouched | `src/release.test.ts` "OCI tags align with npm scheme..." + "promotion needs both smoke legs" (structural); functional behavior only exercised by an actual `release.yml` dispatch | blocking | #246 | +| V-oci-mcp-amd64 | The pushed linux/amd64 OCI image serves a full MCP session on native Docker: initialize → tools/list → provenance match → search → chained get_page → command_tree → device_lookup, all non-error with nonempty results (HTTP status alone no longer passes). The leg asserts the pulled image is amd64 | `smoke-oci` amd64 leg in `release.yml` (`scripts/smoke-oci.ts`); job-graph + leg pins in `src/release.test.ts`; assertion-helper units in `src/app-integration.test.ts` | blocking | #246 | +| V-oci-mcp-arm64 | Same for the linux/arm64 image on native arm64 Docker (`ubuntu-24.04-arm`); the leg asserts the pulled image is arm64 | `smoke-oci` arm64 leg in `release.yml` (`scripts/smoke-oci.ts`) | blocking | #246 | | V-changelog-gate | A bare (latest-channel) `package.json` version can't release without a matching `## []` `CHANGELOG.md` heading already promoted by hand — CI no longer auto-bumps versions or promotes `[Unreleased]` for any channel | `Verify CHANGELOG promotion for latest-channel release` step in `release.yml` + `src/release.test.ts` | blocking | — | | V-coverage-reported | `bun test --coverage` runs every release build; results are summarized in `$GITHUB_STEP_SUMMARY` and uploaded as a workflow artifact — informational only, not a gate | `Run tests (fast-fail)` + `Upload coverage artifact` steps in `release.yml` | non-blocking (informational, no threshold) | — | | V-canonicalize | RouterOS CLI canonicalizer handles every input form + torture cases (H1–H8) | `src/canonicalize.test.ts` + `src/canonicalize.fuzz.test.ts` | blocking | — | diff --git a/project-words.txt b/project-words.txt index 8aa0ade..b7b82a0 100644 --- a/project-words.txt +++ b/project-words.txt @@ -42,6 +42,7 @@ beamwidth behavioural behaviours bfd +binfmt blackhole boresight bridgingand diff --git a/scripts/smoke-oci.ts b/scripts/smoke-oci.ts index 0cab157..0307e92 100644 --- a/scripts/smoke-oci.ts +++ b/scripts/smoke-oci.ts @@ -8,7 +8,10 @@ * Expected release version, bare (0.12.0) or v-prefixed (v0.12.0) * * Runs initialize → tools/list → routeros_stats (provenance must equal - * v) → routeros_search with at least one page. Exits 0 on success, 1 + * v) → routeros_search → routeros_get_page (chained from the first + * search result's id, no hardcoded ids) → routeros_command_tree /ip/firewall + * → routeros_device_lookup RB5009. Each call exercises a different table and + * code path, so "it started" can't pass for "it works". Exits 0 on success, 1 * on any protocol, tool, or provenance failure. Shared by #245 (RouterOS /app * integration, any reachable URL) and #246 (release OCI smoke). */ @@ -30,6 +33,73 @@ export function searchPageCount(responseText: string): number { return Array.isArray(pages) ? pages.length : 0; } +/** First result id in a routeros_search response, for the chained get_page call. */ +export function firstSearchPageId(responseText: string): number { + let parsed: unknown; + try { + parsed = JSON.parse(responseText); + } catch { + throw new Error("routeros_search returned non-JSON content"); + } + const pages = (parsed as { pages?: unknown }).pages; + const id = Array.isArray(pages) ? (pages[0] as { id?: unknown } | undefined)?.id : undefined; + if (typeof id !== "number") throw new Error("routeros_search first result has no numeric id"); + return id; +} + +/** Text + code length in a routeros_get_page response (TOC shape counts zero here). */ +export function pageTextLength(responseText: string): number { + let parsed: unknown; + try { + parsed = JSON.parse(responseText); + } catch { + throw new Error("routeros_get_page returned non-JSON content"); + } + const page = parsed as { text?: unknown; code?: unknown }; + return (typeof page.text === "string" ? page.text.length : 0) + (typeof page.code === "string" ? page.code.length : 0); +} + +/** Section entries in a routeros_get_page response (large pages answer a TOC). */ +export function pageSectionCount(responseText: string): number { + let parsed: unknown; + try { + parsed = JSON.parse(responseText); + } catch { + throw new Error("routeros_get_page returned non-JSON content"); + } + const sections = (parsed as { sections?: unknown }).sections; + return Array.isArray(sections) ? sections.length : 0; +} + +/** + * Children in a routeros_command_tree response. The tool answers plain prose + * ("No commands found under: …") when empty — that counts zero, not an error. + */ +export function commandTreeChildCount(responseText: string): number { + let parsed: unknown; + try { + parsed = JSON.parse(responseText); + } catch { + return 0; + } + return Array.isArray(parsed) ? parsed.length : 0; +} + +/** + * Devices in a routeros_device_lookup response (matrix results + catalog rows). + * The tool answers plain prose ("No devices matched…") on a hard miss — zero. + */ +export function deviceLookupCount(responseText: string): number { + let parsed: unknown; + try { + parsed = JSON.parse(responseText); + } catch { + return 0; + } + const result = parsed as { results?: unknown; catalog?: unknown }; + return (Array.isArray(result.results) ? result.results.length : 0) + (Array.isArray(result.catalog) ? result.catalog.length : 0); +} + function usage(): never { console.error("Usage: bun scripts/smoke-oci.ts "); console.error(" MCP endpoint, e.g. http://127.0.0.1:9803/mcp"); @@ -76,7 +146,7 @@ async function main(): Promise { const tools = await withTimeout("tools/list", CALL_TIMEOUT_MS, () => client.listTools()); const names = (tools.tools ?? []).map((t) => t.name); console.log(`tools/list: ${names.length} tools (${names.join(", ")})`); - for (const need of ["routeros_stats", "routeros_search"]) { + for (const need of ["routeros_stats", "routeros_search", "routeros_get_page", "routeros_command_tree", "routeros_device_lookup"]) { if (!names.includes(need)) throw new Error(`tools/list is missing required tool: ${need}`); } @@ -93,13 +163,42 @@ async function main(): Promise { } const search = await withTimeout("routeros_search", CALL_TIMEOUT_MS, () => - client.callTool({ name: "routeros_search", arguments: { query: "firewall" } }), + client.callTool({ name: "routeros_search", arguments: { query: "firewall filter" } }), ); if (search.isError) throw new Error(`routeros_search returned an error: ${JSON.stringify(search).slice(0, 500)}`); const text = (search.content as { text: string }[])[0].text; const pageCount = searchPageCount(text); console.log(`routeros_search: ${pageCount} pages (${text.length} chars)`); if (pageCount === 0) throw new Error("routeros_search returned zero pages"); + const firstId = firstSearchPageId(text); + + const page = await withTimeout("routeros_get_page", CALL_TIMEOUT_MS, () => + client.callTool({ name: "routeros_get_page", arguments: { page: String(firstId) } }), + ); + if (page.isError) throw new Error(`routeros_get_page returned an error: ${JSON.stringify(page).slice(0, 500)}`); + const pageText = (page.content as { text: string }[])[0].text; + const textLength = pageTextLength(pageText); + const sectionCount = pageSectionCount(pageText); + console.log(`routeros_get_page: id=${firstId} text=${textLength} chars sections=${sectionCount}`); + if (textLength === 0 && sectionCount === 0) throw new Error(`routeros_get_page id=${firstId} returned empty content`); + + const tree = await withTimeout("routeros_command_tree", CALL_TIMEOUT_MS, () => + client.callTool({ name: "routeros_command_tree", arguments: { path: "/ip/firewall" } }), + ); + if (tree.isError) throw new Error(`routeros_command_tree returned an error: ${JSON.stringify(tree).slice(0, 500)}`); + const treeText = (tree.content as { text: string }[])[0].text; + const childCount = commandTreeChildCount(treeText); + console.log(`routeros_command_tree: /ip/firewall has ${childCount} children`); + if (childCount === 0) throw new Error("routeros_command_tree /ip/firewall returned zero children"); + + const device = await withTimeout("routeros_device_lookup", CALL_TIMEOUT_MS, () => + client.callTool({ name: "routeros_device_lookup", arguments: { query: "RB5009" } }), + ); + if (device.isError) throw new Error(`routeros_device_lookup returned an error: ${JSON.stringify(device).slice(0, 500)}`); + const deviceText = (device.content as { text: string }[])[0].text; + const deviceCount = deviceLookupCount(deviceText); + console.log(`routeros_device_lookup: RB5009 matched ${deviceCount} devices`); + if (deviceCount === 0) throw new Error("routeros_device_lookup RB5009 matched zero devices"); console.log(`SMOKE OK: ${urlArg} serves ${expectedTag} (${Date.now() - started}ms)`); } catch (error) { diff --git a/src/app-integration.test.ts b/src/app-integration.test.ts index 2e9fa9f..ac759c7 100644 --- a/src/app-integration.test.ts +++ b/src/app-integration.test.ts @@ -26,7 +26,14 @@ import { rewriteUiUrl, writeDiagnosticsBundle, } from "../scripts/app-integration.ts"; -import { searchPageCount } from "../scripts/smoke-oci.ts"; +import { + commandTreeChildCount, + deviceLookupCount, + firstSearchPageId, + pageSectionCount, + pageTextLength, + searchPageCount, +} from "../scripts/smoke-oci.ts"; const ROOT = path.resolve(import.meta.dirname, ".."); @@ -213,6 +220,62 @@ describe("searchPageCount", () => { }); }); +describe("smoke-oci chained checks (#246)", () => { + test("firstSearchPageId returns the first result id", () => { + expect(firstSearchPageId(JSON.stringify({ pages: [{ id: 42 }, { id: 7 }] }))).toBe(42); + }); + + test("firstSearchPageId throws on empty pages, a missing id, or non-JSON", () => { + expect(() => firstSearchPageId(JSON.stringify({ pages: [] }))).toThrow(/no numeric id/); + expect(() => firstSearchPageId(JSON.stringify({ pages: [{}] }))).toThrow(/no numeric id/); + expect(() => firstSearchPageId(JSON.stringify({}))).toThrow(/no numeric id/); + expect(() => firstSearchPageId("not json")).toThrow(/non-JSON/); + }); + + test("pageTextLength sums text + code, missing fields count zero", () => { + expect(pageTextLength(JSON.stringify({ text: "abc", code: "de" }))).toBe(5); + expect(pageTextLength(JSON.stringify({ text: "abc" }))).toBe(3); + expect(pageTextLength(JSON.stringify({ sections: [{ heading: "TOC only" }] }))).toBe(0); + expect(() => pageTextLength("not json")).toThrow(/non-JSON/); + }); + + test("pageSectionCount counts TOC entries, missing counts zero", () => { + expect(pageSectionCount(JSON.stringify({ text: "", sections: [{ heading: "a" }, { heading: "b" }] }))).toBe(2); + expect(pageSectionCount(JSON.stringify({ text: "full text, no TOC" }))).toBe(0); + expect(() => pageSectionCount("not json")).toThrow(/non-JSON/); + }); + + test("commandTreeChildCount counts array children; the empty prose answer counts zero", () => { + expect(commandTreeChildCount(JSON.stringify([{ name: "filter" }, { name: "nat" }]))).toBe(2); + expect(commandTreeChildCount(JSON.stringify([]))).toBe(0); + expect(commandTreeChildCount("No commands found under: /ip/firewall")).toBe(0); + }); + + test("deviceLookupCount sums matrix results + catalog rows; a hard miss counts zero", () => { + expect(deviceLookupCount(JSON.stringify({ results: [{ product_name: "RB5009" }], mode: "exact" }))).toBe(1); + expect( + deviceLookupCount(JSON.stringify({ results: [{ product_name: "a" }], catalog: [{ name: "b" }] })), + ).toBe(2); + expect(deviceLookupCount(JSON.stringify({ results: [], mode: "like" }))).toBe(0); + expect(deviceLookupCount('No devices matched: "RB5009"')).toBe(0); + }); + + test("the smoke runs the full chain: search → get_page (chained id) → command_tree → device_lookup", () => { + const src = readText("scripts/smoke-oci.ts"); + // tools/list must carry every tool the session calls. + for (const tool of ["routeros_stats", "routeros_search", "routeros_get_page", "routeros_command_tree", "routeros_device_lookup"]) { + expect(src).toContain(`"${tool}"`); + } + // get_page chains off the search result — no hardcoded page ids. + expect(src).toContain("firstSearchPageId(text)"); + expect(src).toContain('{ page: String(firstId) }'); + expect(src).toContain('{ path: "/ip/firewall" }'); + expect(src).toContain('{ query: "RB5009" }'); + // Every call is isError-gated. + expect(src.match(/\.isError\) throw/g)?.length).toBe(5); + }); +}); + describe("writeDiagnosticsBundle", () => { test("writes JSON on success, returns false instead of throwing on failure", async () => { const { mkdtempSync, readFileSync, rmSync } = await import("node:fs"); diff --git a/src/release.test.ts b/src/release.test.ts index 5ba5006..e708a96 100644 --- a/src/release.test.ts +++ b/src/release.test.ts @@ -670,7 +670,6 @@ describe("release.yml", () => { test("a stable publish moves next only when next is semver-lower; one decision drives npm and OCI (#152)", () => { const decideIdx = mustIndex(src, "Decide whether this run moves next"); const ociIdx = mustIndex(src, "Build and push OCI images"); - const publishIdx = mustIndex(src, "Publish to npm"); expect(decideIdx).toBeLessThan(ociIdx); const decideBlock = src.slice(decideIdx, ociIdx); expect(decideBlock).toContain("id: next_tag"); @@ -678,9 +677,15 @@ describe("release.yml", () => { expect(decideBlock).toContain("Bun.semver.order('$NEW', '$CURRENT')"); expect(decideBlock).toContain("code E404"); expect(decideBlock).toContain('echo "move=false"'); - const moveEnv = `MOVE_NEXT: \${{ steps.next_tag.outputs.move }}`; - expect(src.slice(ociIdx, publishIdx)).toContain(moveEnv); - expect(src.slice(publishIdx)).toContain(moveEnv); + // npm reads the decision in-job; the promote-oci job reads it through + // the publish job's move_next output (#246 moved promotion out of publish). + const publishIdx = mustIndex(src, "\n publish:"); + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const publishBlock = src.slice(publishIdx, smokeOciIdx); + expect(publishBlock).toContain(`MOVE_NEXT: \${{ steps.next_tag.outputs.move }}`); + expect(publishBlock).toContain(`move_next: \${{ steps.next_tag.outputs.move }}`); + const promoteBlock = src.slice(mustIndex(src, "\n promote-oci:")); + expect(promoteBlock).toContain(`MOVE_NEXT: \${{ needs.publish.outputs.move_next }}`); }); test("after publishing, a read-back fails the run unless this run's tag resolves to it and next ≥ latest (#152)", () => { @@ -700,8 +705,8 @@ describe("release.yml", () => { test("OCI tags align with npm scheme: version always, floating next for prerelease, latest (+next when moved) for latest channel, republish never moves floating tags", () => { const promoteIdx = mustIndex(src, "- name: Promote smoke-tested OCI images"); - const releaseIdx = mustIndex(src, "Create or update GitHub Release"); - const promoteBlock = src.slice(promoteIdx, releaseIdx); + const verifyIdx = mustIndex(src, "\n verify-dist-tags:"); + const promoteBlock = src.slice(promoteIdx, verifyIdx); expect(promoteBlock).toContain(`tags=(--tag "\${registry}:\${VERSION}")`); expect(promoteBlock).toContain(`tags+=(--tag "\${registry}:next")`); expect(promoteBlock).toContain(`tags+=(--tag "\${registry}:latest")`); @@ -712,18 +717,95 @@ describe("release.yml", () => { expect(promoteBlock).toContain(`REPUBLISH_ASSETS: \${{ inputs.republish_assets }}`); expect(promoteBlock).toMatch(/if \[ "\$REPUBLISH_ASSETS" != "true" \]/); expect(promoteBlock).toContain(`docker buildx imagetools create "\${tags[@]}" "\${registry}:sha-\${SHORT_SHA}"`); + // The promote-oci job recomputes the v-prefixed VERSION from the build + // version it receives via env: (no template interpolation in run:). + expect(promoteBlock).toContain(`BUILD_VERSION: \${{ needs.build.outputs.version }}`); + expect(promoteBlock).toContain(`CHANNEL: \${{ needs.build.outputs.channel }}`); + expect(promoteBlock).toContain(`SHORT_SHA: \${{ needs.build.outputs.short_sha }}`); + expect(promoteBlock).toContain(`VERSION="v\${RUNTIME_VERSION}"`); + const runBlock = promoteBlock.slice(mustIndex(promoteBlock, "run: |")); + expect(runBlock).not.toContain("${{"); }); test("only the sha tag pushes before the OCI smoke; version and floating tags are promoted after it passes", () => { - const ociIdx = mustIndex(src, "Build and push OCI images"); - const smokeIdx = mustIndex(src, "Smoke test published OCI images"); - const promoteIdx = mustIndex(src, "- name: Promote smoke-tested OCI images"); - expect(ociIdx).toBeLessThan(smokeIdx); - expect(smokeIdx).toBeLessThan(promoteIdx); - const ociBlock = src.slice(ociIdx, smokeIdx); - expect(ociBlock).toContain(`tags+=(--tag "\${registry}:sha-\${SHORT_SHA}")`); - expect(ociBlock).not.toMatch(/--tag "\$\{registry\}:(\$\{VERSION\}|next|latest)"/); - expect(src.slice(smokeIdx, promoteIdx)).toContain(`for image in "ammo74/rosetta:\${SHA_TAG}" "ghcr.io/tikoci/rosetta:\${SHA_TAG}"`); + const publishIdx = mustIndex(src, "\n publish:"); + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const verifyIdx = mustIndex(src, "\n verify-dist-tags:"); + expect(publishIdx).toBeLessThan(smokeOciIdx); + expect(smokeOciIdx).toBeLessThan(promoteOciIdx); + const publishBlock = src.slice(publishIdx, smokeOciIdx); + expect(publishBlock).toContain(`tags+=(--tag "\${registry}:sha-\${SHORT_SHA}")`); + expect(publishBlock).not.toMatch(/--tag "\$\{registry\}:(\$\{VERSION\}|next|latest)"/); + expect(publishBlock).not.toContain("imagetools create"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + expect(smokeBlock).toContain(`for image in "ammo74/rosetta:\${SHA_TAG}" "ghcr.io/tikoci/rosetta:\${SHA_TAG}"`); + expect(src.slice(promoteOciIdx, verifyIdx)).toContain("imagetools create"); + }); + + test("promotion needs both smoke-oci legs: floating tags can't move on a red leg (#246)", () => { + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + expect(smokeBlock).toMatch(/needs:\s*\[build,\s*publish\]/); + const promoteBlock = src.slice(promoteOciIdx); + expect(promoteBlock).toMatch(/needs:\s*\[build,\s*publish,\s*smoke-oci\]/); + }); + + test("smoke-oci runs one native leg per arch: amd64 on ubuntu-latest, arm64 on ubuntu-24.04-arm (#246)", () => { + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + expect(smokeBlock).toContain("fail-fast: false"); + expect(smokeBlock).toContain("- arch: amd64"); + expect(smokeBlock).toContain("runs-on: ubuntu-latest"); + expect(smokeBlock).toContain("- arch: arm64"); + expect(smokeBlock).toContain("runs-on: ubuntu-24.04-arm"); + expect(smokeBlock).toContain(`runs-on: \${{ matrix.runs-on }}`); + // Native Docker on both legs — no QEMU/binfmt emulation. + expect(smokeBlock).not.toContain("qemu"); + expect(smokeBlock).not.toContain("binfmt"); + }); + + test("each smoke-oci leg asserts the pulled image is its own architecture (#246)", () => { + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + expect(smokeBlock).toContain(`EXPECTED_ARCH: \${{ matrix.arch }}`); + expect(smokeBlock).toContain(`docker image inspect "$image" --format '{{.Architecture}}'`); + expect(smokeBlock).toContain('if [ "$pulled_arch" != "$EXPECTED_ARCH" ]; then'); + expect(smokeBlock).toMatch(/::error::.*pulled .*expected/); + }); + + test("the smoke-oci verdict comes from a real MCP session, never from HTTP status (#246)", () => { + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + expect(smokeBlock).toContain(`BUILD_VERSION: \${{ needs.build.outputs.version }}`); + expect(smokeBlock).toContain(`bun scripts/smoke-oci.ts "http://127.0.0.1:\${port}/mcp" "$BUILD_VERSION"`); + // curl remains only as a readiness gate ahead of the session; the old + // HTTP-code pass ("✓ … (HTTP $code)") is gone. + expect(smokeBlock).toContain("Readiness wait only"); + expect(smokeBlock).not.toContain("(HTTP $code)"); + }); + + test("smoke-oci records the tested manifest + platform digests in the job summary (#246)", () => { + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + expect(smokeBlock).toContain("Record tested manifest digests"); + expect(smokeBlock).toContain(`docker buildx imagetools inspect "\${registry}:sha-\${SHORT_SHA}"`); + expect(smokeBlock).toContain('>> "$GITHUB_STEP_SUMMARY"'); + }); + + test("smoke-oci keeps container diagnostics on failure: inspect state/exit/OOM plus logs (#246)", () => { + const smokeOciIdx = mustIndex(src, "\n smoke-oci:"); + const promoteOciIdx = mustIndex(src, "\n promote-oci:"); + const smokeBlock = src.slice(smokeOciIdx, promoteOciIdx); + const inspectLine = `docker inspect "$name" --format 'Status={{.State.Status}} Exit={{.State.ExitCode}} Error={{.State.Error}} OOMKilled={{.State.OOMKilled}}'`; + // Both failure paths (never-ready and MCP-session failure) dump them. + expect(smokeBlock.split(inspectLine).length - 1).toBe(2); + expect(smokeBlock.split('docker logs "$name"').length - 1).toBe(2); }); test("GitHub Release is created with --prerelease for prerelease channel runs", () => {