From 7a17b51b034dc15432a5a2abe959b857e0eee5a9 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 06:32:38 -0700 Subject: [PATCH 1/9] test(e2e): migrate model router routed inference to Vitest --- .github/workflows/regression-e2e.yaml | 48 +++- ...l-router-provider-routed-inference.test.ts | 237 ++++++++++++++++++ ...-model-router-provider-routed-inference.sh | 196 --------------- test/regression-e2e-workflow.test.ts | 52 ++++ 4 files changed, 328 insertions(+), 205 deletions(-) create mode 100644 test/e2e-scenario/live/model-router-provider-routed-inference.test.ts delete mode 100755 test/e2e/test-model-router-provider-routed-inference.sh diff --git a/.github/workflows/regression-e2e.yaml b/.github/workflows/regression-e2e.yaml index 400ded2bae2..ec424d2135d 100644 --- a/.github/workflows/regression-e2e.yaml +++ b/.github/workflows/regression-e2e.yaml @@ -336,28 +336,58 @@ jobs: github.repository == 'NVIDIA/NemoClaw' && needs.select_regression_jobs.outputs.model_router_provider_routed_inference == 'true' runs-on: ubuntu-latest + permissions: + contents: read timeout-minutes: 45 steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + with: + node-version: "22" + cache: npm + + - name: Install root dependencies + run: npm ci --ignore-scripts + + - name: Build CLI + run: npm run build:cli - - name: Run Model Router provider-routed inference E2E test + - name: Install OpenShell + env: + NEMOCLAW_NON_INTERACTIVE: "1" + run: | + set -euo pipefail + bash scripts/install-openshell.sh + echo "${HOME}/.local/bin" >> "$GITHUB_PATH" + + - name: Run Model Router provider-routed inference Vitest E2E test env: NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }} NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - run: bash test/e2e/test-model-router-provider-routed-inference.sh + NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js + NEMOCLAW_RUN_E2E_SCENARIOS: "1" + E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/model-router-provider-routed-inference + run: | + set -euo pipefail + npx vitest run --project e2e-scenarios-live \ + test/e2e-scenario/live/model-router-provider-routed-inference.test.ts \ + --silent=false --reporter=default - - name: Upload Model Router provider-routed inference logs on failure - if: failure() + - name: Upload Model Router provider-routed inference artifacts + if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: model-router-provider-routed-inference-logs - path: | - /tmp/nemoclaw-e2e-model-router-onboard.log - /tmp/nemoclaw-e2e-model-router-health.log - /tmp/nemoclaw-e2e-model-router-response.log + name: model-router-provider-routed-inference-artifacts + path: e2e-artifacts/vitest/model-router-provider-routed-inference/ + include-hidden-files: false if-no-files-found: ignore + retention-days: 14 # ── OpenClaw plugin runtime-deps EXDEV E2E ───────────────────── # Coverage guard for #3513 / #3127. On Ubuntu/OpenShell sandbox layouts diff --git a/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts b/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts new file mode 100644 index 00000000000..674ebdd394b --- /dev/null +++ b/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts @@ -0,0 +1,237 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import fs from "node:fs"; +import path from "node:path"; + +import { expect, test } from "../framework/e2e-test.ts"; +import { shouldRunLiveE2EScenarios } from "../framework/live-project-gate.ts"; +import type { ShellProbeResult } from "../framework/shell-probe.ts"; + +// Migrated from test/e2e/test-model-router-provider-routed-inference.sh. This +// regression guard for #3255 provisions a real cloud-backed sandbox through the +// Model Router provider and proves inference.local returns a routed completion +// instead of HTTP 503 / "inference service unavailable" after onboard. + +const REPO_ROOT = path.resolve(import.meta.dirname, "../../.."); +const REPO_CLI = path.join(REPO_ROOT, "bin", "nemoclaw.js"); +const CLI_DIST_ENTRYPOINT = path.join(REPO_ROOT, "dist", "nemoclaw.js"); +const ONBOARD_TIMEOUT_MS = 1_500_000; +const HEALTH_TIMEOUT_MS = 15_000; +const COMPLETION_TIMEOUT_MS = 120_000; +const CLEANUP_TIMEOUT_MS = 180_000; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-model-router"; +const runModelRouterProviderRoutedTest = shouldRunLiveE2EScenarios() ? test : test.skip; + +process.env.NEMOCLAW_CLI_BIN ??= REPO_CLI; + +function resultText(result: ShellProbeResult): string { + return [result.stdout, result.stderr].filter(Boolean).join("\n"); +} + +function baseCommandEnv(extra: NodeJS.ProcessEnv = {}): NodeJS.ProcessEnv { + return { + PATH: process.env.PATH ?? "", + HOME: process.env.HOME ?? "", + TMPDIR: process.env.TMPDIR ?? "", + TEMP: process.env.TEMP ?? "", + TMP: process.env.TMP ?? "", + CI: process.env.CI ?? "", + GITHUB_ACTIONS: process.env.GITHUB_ACTIONS ?? "", + RUNNER_TEMP: process.env.RUNNER_TEMP ?? "", + RUNNER_TOOL_CACHE: process.env.RUNNER_TOOL_CACHE ?? "", + NEMOCLAW_CLI_BIN: REPO_CLI, + NEMOCLAW_NON_INTERACTIVE: "1", + NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1", + ...extra, + }; +} + +function wait(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function isHealthyModelRouter(raw: string): boolean { + return /"healthy_count"\s*:\s*[1-9]/.test(raw); +} + +function isServiceUnavailable(raw: string): boolean { + return /inference service unavailable|HTTP 503|healthy_count.*0/i.test(raw); +} + +function isMissingSandboxDelete(result: ShellProbeResult): boolean { + return /not found|no such sandbox|does not exist/i.test(resultText(result)); +} + +function isRoutedPongResponse(raw: string): boolean { + try { + const data = JSON.parse(raw) as { + model?: unknown; + choices?: Array<{ message?: { content?: unknown } }>; + }; + const model = String(data.model ?? ""); + const content = String(data.choices?.[0]?.message?.content ?? ""); + return ( + (model === "nvidia-routed" || model.startsWith("nvidia-routed")) && /\bPONG\b/i.test(content) + ); + } catch { + return false; + } +} + +runModelRouterProviderRoutedTest( + "model router provider-routed inference answers through inference.local", + { + timeout: ONBOARD_TIMEOUT_MS + 6 * 60_000, + }, + async ({ artifacts, cleanup, host, sandbox, secrets }) => { + const apiKey = secrets.optional("NVIDIA_API_KEY") ?? ""; + expect(apiKey, "NVIDIA_API_KEY must be set to a real NVIDIA API key").toMatch(/^nvapi-/); + + expect( + fs.existsSync(CLI_DIST_ENTRYPOINT), + "run `npm run build:cli` before live repo CLI scenarios", + ).toBe(true); + + await artifacts.writeJson("scenario.json", { + id: "model-router-provider-routed-inference", + runner: "vitest", + boundary: "live-model-router-provider", + migratedFrom: "test/e2e/test-model-router-provider-routed-inference.sh", + issue: 3255, + phases: [ + "docker-prerequisite", + "checkout-install", + "model-router-onboard", + "host-router-health", + "sandbox-inference-local-completion", + ], + }); + + const nonSecretEnv = baseCommandEnv({ + NVIDIA_API_KEY: "", + NEMOCLAW_PROVIDER_KEY: "", + }); + const routedEnv = baseCommandEnv({ + NEMOCLAW_PROVIDER_KEY: apiKey, + NEMOCLAW_SANDBOX_NAME: SANDBOX_NAME, + NEMOCLAW_POLICY_TIER: "open", + NEMOCLAW_PROVIDER: "routed", + NVIDIA_API_KEY: apiKey, + }); + + const docker = await host.command("docker", ["info"], { + artifactName: "model-router-provider-routed-docker-info", + env: nonSecretEnv, + timeoutMs: HEALTH_TIMEOUT_MS, + }); + expect(docker.exitCode, `Docker is required for this E2E\n${resultText(docker)}`).toBe(0); + + cleanup.add(`destroy NemoClaw sandbox ${SANDBOX_NAME}`, async () => { + if (process.env.NEMOCLAW_E2E_KEEP_SANDBOX === "1") return; + const result = await host.nemoclaw([SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "model-router-provider-routed-cleanup-destroy", + cwd: REPO_ROOT, + env: nonSecretEnv, + timeoutMs: CLEANUP_TIMEOUT_MS, + }); + if (result.exitCode !== 0 && !isMissingSandboxDelete(result)) { + throw new Error(`cleanup destroy failed\n${resultText(result)}`); + } + }); + + await host.nemoclaw([SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "model-router-provider-routed-preclean-destroy", + cwd: REPO_ROOT, + env: nonSecretEnv, + timeoutMs: CLEANUP_TIMEOUT_MS, + }); + + const onboard = await host.nemoclaw( + ["onboard", "--fresh", "--non-interactive", "--yes-i-accept-third-party-software"], + { + artifactName: "model-router-provider-routed-onboard", + cwd: REPO_ROOT, + env: routedEnv, + redactionValues: [apiKey], + timeoutMs: ONBOARD_TIMEOUT_MS, + }, + ); + expect(onboard.exitCode, `Model Router onboard failed\n${resultText(onboard)}`).toBe(0); + + let health: ShellProbeResult | undefined; + for (let attempt = 1; attempt <= 20; attempt += 1) { + health = await host.command( + "curl", + ["-s", "--max-time", "10", "http://127.0.0.1:4000/health"], + { + artifactName: `model-router-provider-routed-health-${attempt}`, + env: nonSecretEnv, + timeoutMs: HEALTH_TIMEOUT_MS, + }, + ); + if (isHealthyModelRouter(health.stdout)) { + break; + } + await wait(3_000); + } + expect( + health && isHealthyModelRouter(health.stdout), + `model-router has no healthy endpoints\n${health ? resultText(health) : ""}`, + ).toBe(true); + + const payload = JSON.stringify({ + model: "nvidia-routed", + messages: [{ role: "user", content: "Reply with exactly one word: PONG" }], + max_tokens: 50, + }); + let completion: ShellProbeResult | undefined; + for (let attempt = 1; attempt <= 3; attempt += 1) { + completion = await sandbox.exec( + SANDBOX_NAME, + [ + "curl", + "-sk", + "--max-time", + "90", + "https://inference.local/v1/chat/completions", + "-H", + "Content-Type: application/json", + "-d", + payload, + ], + { + artifactName: `model-router-provider-routed-completion-${attempt}`, + env: nonSecretEnv, + timeoutMs: COMPLETION_TIMEOUT_MS, + }, + ); + if (isRoutedPongResponse(completion.stdout)) { + break; + } + if (isServiceUnavailable(completion.stdout) || isServiceUnavailable(completion.stderr)) { + break; + } + await wait(5_000); + } + + expect( + completion && isRoutedPongResponse(completion.stdout), + `Model Router inference.local did not return a routed completion\n${ + completion ? resultText(completion) : "" + }`, + ).toBe(true); + + await artifacts.writeJson("scenario-result.json", { + sandboxName: SANDBOX_NAME, + modelRouterHealthy: health ? isHealthyModelRouter(health.stdout) : false, + inferenceLocalRoutedCompletion: completion ? isRoutedPongResponse(completion.stdout) : false, + }); + if (health) { + await artifacts.writeText("logs/model-router-health.log", resultText(health)); + } + if (completion) { + await artifacts.writeText("logs/model-router-response.log", resultText(completion)); + } + }, +); diff --git a/test/e2e/test-model-router-provider-routed-inference.sh b/test/e2e/test-model-router-provider-routed-inference.sh deleted file mode 100755 index 4daf611cbce..00000000000 --- a/test/e2e/test-model-router-provider-routed-inference.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env bash -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Coverage guard for #3255 — Model Router (Provider Routed) onboard must -# produce a working inference.local route instead of HTTP 503. - -set -uo pipefail - -PASS=0 -FAIL=0 -TOTAL=0 - -pass() { - ((PASS++)) - ((TOTAL++)) - echo " OK: $1" -} -fail() { - ((FAIL++)) - ((TOTAL++)) - echo " ERROR: $1" -} -section() { - echo "" - printf '\033[1;36m=== %s ===\033[0m\n' "$1" -} -info() { printf '\033[1;34m [info]\033[0m %s\n' "$1"; } - -is_routed_pong_response() { - local raw="$1" - python3 - "$raw" <<'PY' -import json, re, sys -raw = sys.argv[1] -try: - data = json.loads(raw) -except Exception: - raise SystemExit(1) -model = str(data.get("model", "")) -choices = data.get("choices") or [] -content = "" -if choices and isinstance(choices[0], dict): - message = choices[0].get("message") or {} - content = str(message.get("content", "")) -ok_model = model == "nvidia-routed" or model.startswith("nvidia-routed") -ok_content = re.search(r"\bPONG\b", content, re.IGNORECASE) is not None -raise SystemExit(0 if ok_model and ok_content else 1) -PY -} - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -REPO="$(cd "${SCRIPT_DIR}/../.." && pwd)" -SANDBOX_NAME="${NEMOCLAW_SANDBOX_NAME:-e2e-model-router}" -ONBOARD_LOG="${E2E_MODEL_ROUTER_ONBOARD_LOG:-/tmp/nemoclaw-e2e-model-router-onboard.log}" -RESPONSE_LOG="${E2E_MODEL_ROUTER_RESPONSE_LOG:-/tmp/nemoclaw-e2e-model-router-response.log}" -HEALTH_LOG="${E2E_MODEL_ROUTER_HEALTH_LOG:-/tmp/nemoclaw-e2e-model-router-health.log}" -TIMEOUT_CMD="${TIMEOUT_CMD:-timeout}" - -# shellcheck source=test/e2e/lib/install-path-refresh.sh -. "${SCRIPT_DIR}/lib/install-path-refresh.sh" -# shellcheck source=test/e2e/lib/sandbox-teardown.sh -. "${SCRIPT_DIR}/lib/sandbox-teardown.sh" -register_sandbox_for_teardown "$SANDBOX_NAME" - -redact_file() { - local file="$1" - [ -f "$file" ] || return 0 - python3 - "$file" <<'PY' -import os, sys -path = sys.argv[1] -secrets = [os.environ.get("NVIDIA_API_KEY", ""), os.environ.get("NEMOCLAW_PROVIDER_KEY", "")] -text = open(path, "r", errors="replace").read() -for secret in filter(None, secrets): - text = text.replace(secret, "") -open(path, "w").write(text) -PY -} - -# shellcheck disable=SC2317,SC2329 # Invoked indirectly by the EXIT trap. -cleanup() { - local rc=$? - redact_file "$ONBOARD_LOG" - redact_file "$RESPONSE_LOG" - redact_file "$HEALTH_LOG" - if [ "${NEMOCLAW_E2E_KEEP_SANDBOX:-0}" != "1" ]; then - nemoclaw "$SANDBOX_NAME" destroy --yes >/dev/null 2>&1 || true - fi - exit "$rc" -} -trap cleanup EXIT # invoked by EXIT trap - -section "Prerequisites" -if docker info >/dev/null 2>&1; then - pass "Docker is running" -else - fail "Docker is not running" - exit 1 -fi - -if [ -n "${NVIDIA_API_KEY:-}" ] && [[ "${NVIDIA_API_KEY}" == nvapi-* ]]; then - pass "NVIDIA_API_KEY is set" -else - fail "NVIDIA_API_KEY is required and must start with nvapi-" - exit 1 -fi - -section "Install NemoClaw from checkout" -if ! command -v nemoclaw >/dev/null 2>&1; then - NEMOCLAW_NON_INTERACTIVE=1 \ - NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \ - bash "${REPO}/install.sh" --non-interactive --yes-i-accept-third-party-software >"$ONBOARD_LOG" 2>&1 || true - nemoclaw_refresh_install_env -fi - -if command -v nemoclaw >/dev/null 2>&1; then - pass "nemoclaw is available: $(nemoclaw --version 2>/dev/null || echo unknown)" -else - fail "nemoclaw not found after install" - exit 1 -fi - -section "Onboard with Model Router provider" -rm -f "$HOME/.nemoclaw/onboard.lock" 2>/dev/null || true -nemoclaw "$SANDBOX_NAME" destroy --yes >/dev/null 2>&1 || true - -env \ - NEMOCLAW_PROVIDER_KEY="$NVIDIA_API_KEY" \ - NEMOCLAW_SANDBOX_NAME="$SANDBOX_NAME" \ - NEMOCLAW_NON_INTERACTIVE=1 \ - NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \ - NEMOCLAW_POLICY_TIER="open" \ - NEMOCLAW_PROVIDER="routed" \ - NVIDIA_API_KEY="$NVIDIA_API_KEY" \ - "$TIMEOUT_CMD" 1500 nemoclaw onboard --fresh --non-interactive --yes-i-accept-third-party-software \ - >"$ONBOARD_LOG" 2>&1 -onboard_rc=$? -redact_file "$ONBOARD_LOG" -if [ "$onboard_rc" -eq 0 ]; then - pass "Model Router onboard completed" -else - fail "Model Router onboard failed (exit ${onboard_rc}); see ${ONBOARD_LOG}" - exit 1 -fi - -section "Host model-router health" -health="" -for _ in $(seq 1 20); do - health="$(curl -s --max-time 10 http://127.0.0.1:4000/health 2>&1 || true)" - printf '%s\n' "$health" >"$HEALTH_LOG" - redact_file "$HEALTH_LOG" - if echo "$health" | grep -Eq '"healthy_count"[[:space:]]*:[[:space:]]*[1-9]'; then - pass "model-router reports at least one healthy endpoint" - break - fi - sleep 3 -done -if ! echo "$health" | grep -Eq '"healthy_count"[[:space:]]*:[[:space:]]*[1-9]'; then - fail "model-router has no healthy endpoints; expected #3255 main-equivalent failure" - info "Health excerpt: $(head -c 500 "$HEALTH_LOG")" - exit 1 -fi - -section "Sandbox inference.local routed completion" -response="" -for _ in $(seq 1 3); do - response="$(openshell sandbox exec --name "$SANDBOX_NAME" -- \ - curl -sk --max-time 90 https://inference.local/v1/chat/completions \ - -H 'Content-Type: application/json' \ - -d '{"model":"nvidia-routed","messages":[{"role":"user","content":"Reply with exactly one word: PONG"}],"max_tokens":50}' \ - 2>&1 || true)" - printf '%s\n' "$response" >"$RESPONSE_LOG" - redact_file "$RESPONSE_LOG" - if is_routed_pong_response "$response"; then - pass "inference.local returned a routed Model Router completion" - break - fi - if echo "$response" | grep -qi 'inference service unavailable\|HTTP 503\|healthy_count.*0'; then - break - fi - sleep 5 -done - -if is_routed_pong_response "$response"; then - : -else - fail "Model Router inference.local did not return a routed completion; expected #3255 main-equivalent failure" - info "Response excerpt: $(head -c 500 "$RESPONSE_LOG")" - exit 1 -fi - -section "Summary" -if [ "$FAIL" -eq 0 ]; then - pass "Model Router provider-routed inference guard passed" - exit 0 -fi -exit 1 diff --git a/test/regression-e2e-workflow.test.ts b/test/regression-e2e-workflow.test.ts index 8a932973d2c..03ee97fd11a 100644 --- a/test/regression-e2e-workflow.test.ts +++ b/test/regression-e2e-workflow.test.ts @@ -36,4 +36,56 @@ describe("Regression E2E workflow contract", () => { expect(selectorScript).not.toContain("docker-unreachable-gateway-start-e2e"); expect(selectorScript).not.toContain("docker_unreachable_gateway_start"); }); + + it("runs model router provider-routed inference directly through Vitest artifacts", () => { + const jobsDescription = workflow.on?.workflow_dispatch?.inputs?.jobs?.description ?? ""; + const selectorScript = + workflow.jobs?.select_regression_jobs?.steps?.find((step) => step.id === "select")?.run ?? ""; + const job = workflow.jobs?.["model-router-provider-routed-inference-e2e"]; + const checkoutStep = job?.steps?.find((step) => + String(step.uses ?? "").startsWith("actions/checkout@"), + ); + const setupNodeStep = job?.steps?.find((step) => + String(step.uses ?? "").startsWith("actions/setup-node@"), + ); + const installStep = job?.steps?.find((step) => step.name === "Install root dependencies"); + const buildStep = job?.steps?.find((step) => step.name === "Build CLI"); + const installOpenShellStep = job?.steps?.find((step) => step.name === "Install OpenShell"); + const runStep = job?.steps?.find( + (step) => step.name === "Run Model Router provider-routed inference Vitest E2E test", + ); + const uploadStep = job?.steps?.find( + (step) => step.name === "Upload Model Router provider-routed inference artifacts", + ); + + expect(jobsDescription).toContain("model-router-provider-routed-inference-e2e"); + expect(selectorScript).toContain("model-router-provider-routed-inference-e2e"); + expect(selectorScript).toContain("model_router_provider_routed_inference=true"); + expect(checkoutStep?.with?.["persist-credentials"]).toBe(false); + expect(setupNodeStep?.uses).toMatch(/^actions\/setup-node@[0-9a-f]{40}$/); + expect(setupNodeStep?.with?.cache).toBe("npm"); + expect(installStep?.run).toBe("npm ci --ignore-scripts"); + expect(buildStep?.run).toBe("npm run build:cli"); + expect(installOpenShellStep?.run).toContain("bash scripts/install-openshell.sh"); + expect(installOpenShellStep?.run).toContain('echo "${HOME}/.local/bin" >> "$GITHUB_PATH"'); + expect(installOpenShellStep?.env?.NEMOCLAW_NON_INTERACTIVE).toBe("1"); + expect(runStep?.run).toContain("npx vitest run --project e2e-scenarios-live"); + expect(runStep?.run).toContain( + "test/e2e-scenario/live/model-router-provider-routed-inference.test.ts", + ); + expect(runStep?.run).not.toContain("test/e2e/test-model-router-provider-routed-inference.sh"); + expect(runStep?.env?.NVIDIA_API_KEY).toBe("${{ secrets.NVIDIA_API_KEY }}"); + expect(runStep?.env?.NEMOCLAW_CLI_BIN).toBe("${{ github.workspace }}/bin/nemoclaw.js"); + expect(runStep?.env?.NEMOCLAW_RUN_E2E_SCENARIOS).toBe("1"); + expect(runStep?.env?.E2E_ARTIFACT_DIR).toBe( + "${{ github.workspace }}/e2e-artifacts/vitest/model-router-provider-routed-inference", + ); + expect(uploadStep?.if).toBe("always()"); + expect(uploadStep?.with?.path).toBe( + "e2e-artifacts/vitest/model-router-provider-routed-inference/", + ); + expect(uploadStep?.with?.["include-hidden-files"]).toBe(false); + expect(uploadStep?.with?.["if-no-files-found"]).toBe("ignore"); + expect(uploadStep?.with?.["retention-days"]).toBe(14); + }); }); From f9422bcf885a20489284a84e2d4d7f88973ac0cd Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 07:46:45 -0700 Subject: [PATCH 2/9] test(e2e): guard legacy shell deletion evidence --- test/e2e-scenario/docs/MIGRATION.md | 14 ++- test/e2e-scenario/docs/README.md | 5 +- .../e2e-migration-policy.test.ts | 2 + test/pr-review-advisor.test.ts | 81 +++++++++++- tools/pr-review-advisor/analyze.mts | 116 +++++++++++++++++- 5 files changed, 208 insertions(+), 10 deletions(-) diff --git a/test/e2e-scenario/docs/MIGRATION.md b/test/e2e-scenario/docs/MIGRATION.md index 28b9c01798d..e1d4e8a0e56 100644 --- a/test/e2e-scenario/docs/MIGRATION.md +++ b/test/e2e-scenario/docs/MIGRATION.md @@ -64,9 +64,17 @@ The useful deletion invariant is smaller: > A PR that deletes a legacy E2E script must show the replacement Vitest > coverage or explain the retirement rationale. -Record that evidence in the PR body and linked issue. The evidence should name -the legacy contract, the replacement Vitest coverage, any intentionally retired -behavior, and the verification that preserves fidelity. +Record that evidence in the PR body and linked issue. For each deleted script, +include a `Legacy E2E deletion evidence` block with: + +- `Script:` the deleted `test/e2e/test-*.sh` path. +- `Legacy contract:` the observable behavior the shell script protected. +- `Replacement Vitest coverage:` a `.test.ts` path, or `Retirement rationale:` + when the behavior is intentionally retired instead of replaced. +- `Intentionally retired behavior:` any assertions, probes, or workflow hooks + that are deliberately not preserved. +- `Fidelity verification:` the command, CI check, or review evidence proving the + Vitest coverage keeps the same contract value. ## Migration Pattern diff --git a/test/e2e-scenario/docs/README.md b/test/e2e-scenario/docs/README.md index 529daea534e..cd1d4295e9c 100644 --- a/test/e2e-scenario/docs/README.md +++ b/test/e2e-scenario/docs/README.md @@ -121,8 +121,9 @@ GitHub issues and PRs own changing migration status. The key issues are: The former repo-local `legacy-inventory.json` ledger and generated legacy assertion inventories are removed because they duplicated live GitHub state and drifted quickly. A PR that deletes a legacy E2E script must show the replacement -Vitest coverage or explain the retirement rationale in the PR body and linked -issue. +Vitest coverage or explain the retirement rationale in a per-script PR-body +`Legacy E2E deletion evidence` block, with the legacy contract, intentionally +retired behavior, and fidelity verification kept next to the deletion. Prefer new E2E coverage in Vitest fixtures. When shell, installer, process, platform, or full user-flow behavior is the contract, invoke that real boundary diff --git a/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts b/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts index 6eb28553c4e..def7f1bd54d 100644 --- a/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts +++ b/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts @@ -37,6 +37,8 @@ describe("E2E migration tracking policy", () => { expect(docs).toContain("source of truth"); expect(docs).toContain("replacement Vitest coverage"); expect(docs).toContain("retirement rationale"); + expect(docs).toContain("Legacy E2E deletion evidence"); + expect(docs).toContain("Fidelity verification"); expect(docs).toContain("generated legacy assertion inventories"); expect(docs).toContain("not a separate E2E framework or runner"); }); diff --git a/test/pr-review-advisor.test.ts b/test/pr-review-advisor.test.ts index 129db6ba748..86413efbaca 100644 --- a/test/pr-review-advisor.test.ts +++ b/test/pr-review-advisor.test.ts @@ -5,21 +5,22 @@ import fs from "node:fs"; import path from "node:path"; import Ajv2020 from "ajv/dist/2020.js"; import { afterEach, describe, expect, it, vi } from "vitest"; - -import { buildComment } from "../tools/pr-review-advisor/comment.mts"; +import { githubGraphql } from "../tools/advisors/github.mts"; import { + assessLegacyE2eShellDeletionEvidence, buildPromptTurns, buildSystemPrompt, classifyMonolithDelta, classifyTestDepth, detectLocalizedPatchSignals, + findDeletedLegacyE2eShellScripts, normalizeReviewResult, readTrustedSecurityReviewSkill, renderDetailedReview, renderSummary, writePromptArtifacts, } from "../tools/pr-review-advisor/analyze.mts"; -import { githubGraphql } from "../tools/advisors/github.mts"; +import { buildComment } from "../tools/pr-review-advisor/comment.mts"; import { validatePrReviewAdvisorWorkflowBoundary } from "../tools/pr-review-advisor/workflow-boundary.mts"; const ROOT = path.resolve(import.meta.dirname, ".."); @@ -39,6 +40,7 @@ function metadata(overrides: Partial = {}): ReviewMetadata { previousAdvisorReview: null, workflowSignals: [], localizedPatchSignals: [], + legacyE2eShellDeletionEvidence: [], monolithDeltas: [], driftEvidence: [], github: null, @@ -223,6 +225,8 @@ describe("PR review advisor", () => { expect(prompt).toContain( "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding", ); + expect(prompt).toContain("Legacy E2E deletion governance"); + expect(prompt).toContain("replacement Vitest coverage path or retirement rationale"); expect(prompt).toContain("multi-turn conversation"); expect(prompt).toContain( "In the final synthesis turn, return JSON only matching the schema provided in that turn", @@ -350,6 +354,77 @@ describe("PR review advisor", () => { expect(signals[0]?.reviewRule).toContain("invalid state"); }); + it("detects deleted legacy E2E shell scripts and complete PR-body evidence", () => { + const diff = `diff --git a/test/e2e/test-example.sh b/test/e2e/test-example.sh +deleted file mode 100755 +index 1234567..0000000 +--- a/test/e2e/test-example.sh ++++ /dev/null +@@ -1,2 +0,0 @@ +-#!/usr/bin/env bash +-echo ok +`; + const prBody = ` +## Legacy E2E deletion evidence + +- Script: \`test/e2e/test-example.sh\` + - Legacy contract: validates the example CLI path against a real shell. + - Replacement Vitest coverage: \`test/e2e-scenario/live/example.test.ts\` + - Intentionally retired behavior: none. + - Fidelity verification: \`npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/example.test.ts\` +`; + + expect(findDeletedLegacyE2eShellScripts(diff)).toEqual(["test/e2e/test-example.sh"]); + expect(assessLegacyE2eShellDeletionEvidence(diff, prBody)).toEqual([ + expect.objectContaining({ + script: "test/e2e/test-example.sh", + hasScriptEvidenceBlock: true, + hasLegacyContract: true, + hasReplacementVitestCoverage: true, + hasRetirementRationale: false, + hasIntentionallyRetiredBehavior: true, + hasFidelityVerification: true, + missing: [], + }), + ]); + }); + + it("adds a blocker finding when a legacy E2E deletion lacks PR-body evidence", () => { + const diff = `diff --git a/test/e2e/test-example.sh b/test/e2e/test-example.sh +deleted file mode 100755 +--- a/test/e2e/test-example.sh ++++ /dev/null +@@ -1 +0,0 @@ +-echo ok +`; + const deletionEvidence = assessLegacyE2eShellDeletionEvidence( + diff, + "- Script: `test/e2e/test-example.sh`\n - Legacy contract: validates the example CLI path.\n", + ); + const result = normalizeReviewResult( + validResult({ findings: [], sourceOfTruthReview: [] }), + metadata({ + deterministic: { + ...metadata().deterministic, + legacyE2eShellDeletionEvidence: deletionEvidence, + }, + }), + ); + + expect(deletionEvidence[0]?.missing).toEqual([ + "replacement Vitest coverage path or retirement rationale", + "intentionally retired behavior", + "fidelity verification", + ]); + expect(result.findings[0]).toMatchObject({ + severity: "blocker", + category: "tests", + file: "test/e2e/test-example.sh", + title: "Legacy E2E deletion evidence is missing", + }); + expect(result.findings[0]?.evidence).toContain("replacement Vitest coverage path"); + }); + it("adds a finding when source-of-truth review is missing follow-up", () => { const result = normalizeReviewResult( validResult({ diff --git a/tools/pr-review-advisor/analyze.mts b/tools/pr-review-advisor/analyze.mts index 7c1388d1517..57c0b7d26af 100755 --- a/tools/pr-review-advisor/analyze.mts +++ b/tools/pr-review-advisor/analyze.mts @@ -163,6 +163,7 @@ type DeterministicReviewContext = { testDepth: ReviewAdvisorResult["testDepth"]; workflowSignals: string[]; localizedPatchSignals: LocalizedPatchSignal[]; + legacyE2eShellDeletionEvidence: LegacyE2eShellDeletionEvidence[]; monolithDeltas: MonolithDelta[]; driftEvidence: DriftEvidence[]; previousAdvisorReview: PreviousAdvisorReview | null; @@ -194,6 +195,17 @@ type DriftEvidence = { renameHints: string[]; }; +type LegacyE2eShellDeletionEvidence = { + script: string; + hasScriptEvidenceBlock: boolean; + hasLegacyContract: boolean; + hasReplacementVitestCoverage: boolean; + hasRetirementRationale: boolean; + hasIntentionallyRetiredBehavior: boolean; + hasFidelityVerification: boolean; + missing: string[]; +}; + type OpenPrOverlap = { number: number; title: string; @@ -349,6 +361,10 @@ async function collectDeterministicContext(options: { const github = await collectGitHubContext(); const riskyAreas = detectRiskyAreas(options.changedFiles); const testDepth = classifyTestDepth(options.changedFiles, options.diff); + const legacyE2eShellDeletionEvidence = assessLegacyE2eShellDeletionEvidence( + options.diff, + pullRequestBodyText(github?.pullRequest), + ); return { diffStat: getDiffStat(options.baseRef, options.headRef), commits: getCommits(options.baseRef, options.headRef), @@ -357,6 +373,7 @@ async function collectDeterministicContext(options: { previousAdvisorReview: github?.previousAdvisorReview || null, workflowSignals: detectWorkflowSignals(options.changedFiles, options.diff), localizedPatchSignals: detectLocalizedPatchSignals(options.diff), + legacyE2eShellDeletionEvidence, monolithDeltas: computeMonolithDeltas(options.baseRef, options.changedFiles), driftEvidence: collectDriftEvidence(options.baseRef, options.changedFiles), github, @@ -443,6 +460,74 @@ function detectWorkflowSignals(changedFiles: string[], diff: string): string[] { return signals; } +export function findDeletedLegacyE2eShellScripts(diff: string): string[] { + const scripts = new Set(); + for (const block of diff.split(/\ndiff --git /)) { + const header = block.startsWith("diff --git ") ? block : `diff --git ${block}`; + const match = header.match(/^diff --git a\/(test\/e2e\/test-[^\s]+\.sh) b\/\1/m); + if (!match?.[1]) continue; + if (/^deleted file mode\b/m.test(header) || /^\+\+\+ \/dev\/null$/m.test(header)) { + scripts.add(match[1]); + } + } + return [...scripts].sort(); +} + +export function assessLegacyE2eShellDeletionEvidence( + diff: string, + prBody: string, +): LegacyE2eShellDeletionEvidence[] { + return findDeletedLegacyE2eShellScripts(diff).map((script) => { + const evidenceBlock = findDeletionEvidenceBlock(prBody, script); + const hasLegacyContract = /\blegacy contract\s*:/i.test(evidenceBlock); + const hasReplacementVitestCoverage = + /\breplacement vitest coverage\s*:/i.test(evidenceBlock) && + /\b(?:test|nemoclaw\/src)\/[^\s`)"']+\.test\.ts\b/.test(evidenceBlock); + const hasRetirementRationale = /\bretirement rationale\s*:/i.test(evidenceBlock); + const hasIntentionallyRetiredBehavior = /\bintentionally retired behavior\s*:/i.test(evidenceBlock); + const hasFidelityVerification = /\bfidelity verification\s*:/i.test(evidenceBlock); + const missing = [ + [evidenceBlock ? "" : "script evidence block", Boolean(evidenceBlock)], + ["legacy contract", hasLegacyContract], + [ + "replacement Vitest coverage path or retirement rationale", + hasReplacementVitestCoverage || hasRetirementRationale, + ], + ["intentionally retired behavior", hasIntentionallyRetiredBehavior], + ["fidelity verification", hasFidelityVerification], + ] + .filter(([, present]) => !present) + .map(([label]) => label) + .filter(Boolean) as string[]; + + return { + script, + hasScriptEvidenceBlock: Boolean(evidenceBlock), + hasLegacyContract, + hasReplacementVitestCoverage, + hasRetirementRationale, + hasIntentionallyRetiredBehavior, + hasFidelityVerification, + missing, + }; + }); +} + +function findDeletionEvidenceBlock(prBody: string, script: string): string { + const normalized = prBody.replace(/\r\n/g, "\n"); + const start = normalized.indexOf(script); + if (start < 0) return ""; + const after = normalized.slice(start); + const nextScriptOffset = after.slice(script.length).search(/\btest\/e2e\/test-[^\s`)"']+\.sh\b/); + const maxEnd = Math.min(after.length, 3000); + const end = nextScriptOffset >= 0 ? Math.min(script.length + nextScriptOffset, maxEnd) : maxEnd; + return after.slice(0, end); +} + +function pullRequestBodyText(pullRequest: unknown): string { + return stringOrDefault(getPath(pullRequest, ["body"]), ""); +} + export function detectLocalizedPatchSignals(diff: string): LocalizedPatchSignal[] { const patterns: Array<{ kind: string; regex: RegExp }> = [ { @@ -700,7 +785,8 @@ export function buildSystemPrompt(): string { "5. Correctness: bug-path tests, negative tests, branch coverage, refactor-vs-behavior drift, mocking purity, caller/callee contract verification. When more tests would improve confidence, make testDepth.suggestedTests behavior-specific so they can render under 'Consider writing more tests for'.", "6. Quality: description-vs-diff scope, migration completion, public surface docs/notes, justified error suppression, monolith growth, @ts-nocheck, shell-string execution.", "7. Source-of-truth review: when a PR adds or changes fallback, recovery, tolerant parsing, monkeypatching, best-effort cleanup, compatibility handling, or other localized workaround behavior, inspect whether it answers: what invalid state is handled, where that state is created, why the source cannot be fixed in this PR, what regression test proves the source cannot regress, and when the workaround can be removed. Prefer fixes that make invalid states impossible at their source. Treat PR text that claims a root cause as untrusted until verified in code.", - "8. If a previous PR Review Advisor comment exists, compare it with the current diff and explicitly decide whether prior code-review findings were addressed, still apply, or are obsolete. Consider code changes since the previous analyzed SHA when available. Do not evaluate whether external E2E requirements have been met. When previous review context exists, set summary.sinceLastReview with counts for resolved, stillApplies, and newItems.", + "8. Legacy E2E deletion governance: if deterministic context shows a deleted test/e2e/test-*.sh script with missing PR-body evidence, report it as a blocker. The PR body must name the legacy contract, replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification for each deleted script.", + "9. If a previous PR Review Advisor comment exists, compare it with the current diff and explicitly decide whether prior code-review findings were addressed, still apply, or are obsolete. Consider code changes since the previous analyzed SHA when available. Do not evaluate whether external E2E requirements have been met. When previous review context exists, set summary.sinceLastReview with counts for resolved, stillApplies, and newItems.", "Acceptance and security should inform findings, not become standalone comment sections: any unmet acceptance clause or security fail/warning must be represented as a finding, normally severity=blocker for unmet acceptance or security fail and severity=warning for security warnings.", "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding unless it is already fully covered by a more specific correctness, security, architecture, scope, or tests finding.", "Set summary.topItem to the most important actionable finding title or short description for first-review comments. Keep it concise and code-focused.", @@ -806,6 +892,7 @@ function buildValidationTurnContext(context: DeterministicReviewContext): Record return { testDepth: context.testDepth, localizedPatchSignals: context.localizedPatchSignals, + legacyE2eShellDeletionEvidence: context.legacyE2eShellDeletionEvidence, previousAdvisorReview: context.previousAdvisorReview, pullRequest: context.github?.pullRequest ?? null, linkedIssues: context.github?.linkedIssues ?? [], @@ -853,6 +940,10 @@ export function normalizeReviewResult(result: unknown, metadata: ReviewMetadata) if (!isRecord(result)) throw new Error("PR review advisor returned a non-object result"); const object = result as Record; const sourceOfTruthReview = sanitizeSourceOfTruthReview(object.sourceOfTruthReview); + const findings = addDeterministicFindings( + addSourceOfTruthFindings(sanitizeFindings(object.findings), sourceOfTruthReview), + metadata, + ); return { version: 1, baseRef: metadata.baseRef, @@ -860,7 +951,7 @@ export function normalizeReviewResult(result: unknown, metadata: ReviewMetadata) headSha: metadata.headSha, changedFiles: metadata.changedFiles, summary: sanitizeSummary(object.summary), - findings: addSourceOfTruthFindings(sanitizeFindings(object.findings), sourceOfTruthReview), + findings, acceptanceCoverage: sanitizeAcceptanceCoverage(object.acceptanceCoverage), securityCategories: sanitizeSecurityCategories(object.securityCategories), sourceOfTruthReview, @@ -965,6 +1056,27 @@ function addSourceOfTruthFindings(findings: Finding[], sourceOfTruthReview: Sour return [...injected, ...findings.slice(0, originalSlots)]; } +function addDeterministicFindings(findings: Finding[], metadata: ReviewMetadata): Finding[] { + const deletionEvidence = metadata.deterministic.legacyE2eShellDeletionEvidence ?? []; + const injected: Finding[] = []; + for (const evidence of deletionEvidence) { + if (evidence.missing.length === 0) continue; + injected.push({ + severity: "blocker", + category: "tests", + file: evidence.script, + line: null, + title: "Legacy E2E deletion evidence is missing", + description: `This PR deletes ${evidence.script} without complete PR-body evidence that preserves or retires the legacy contract.`, + recommendation: + "Add a per-script PR-body evidence block naming the legacy contract, replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification.", + evidence: `Missing: ${evidence.missing.join(", ")}.`, + }); + } + const originalSlots = Math.max(0, 50 - injected.length); + return [...injected, ...findings.slice(0, originalSlots)]; +} + function sanitizeTestDepth(value: unknown, fallback: ReviewAdvisorResult["testDepth"]): ReviewAdvisorResult["testDepth"] { const object = isRecord(value) ? value : {}; return { From debe9586b9ee4f29f03fc1dc0097eb77f00dade4 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 08:00:43 -0700 Subject: [PATCH 3/9] test(e2e): validate legacy deletion replacement paths --- test/e2e-scenario/docs/MIGRATION.md | 9 +++-- test/e2e-scenario/docs/README.md | 3 +- .../e2e-migration-policy.test.ts | 2 + test/pr-review-advisor.test.ts | 37 ++++++++++++++++--- tools/pr-review-advisor/analyze.mts | 25 ++++++++++--- 5 files changed, 60 insertions(+), 16 deletions(-) diff --git a/test/e2e-scenario/docs/MIGRATION.md b/test/e2e-scenario/docs/MIGRATION.md index e1d4e8a0e56..d97f3914990 100644 --- a/test/e2e-scenario/docs/MIGRATION.md +++ b/test/e2e-scenario/docs/MIGRATION.md @@ -64,13 +64,14 @@ The useful deletion invariant is smaller: > A PR that deletes a legacy E2E script must show the replacement Vitest > coverage or explain the retirement rationale. -Record that evidence in the PR body and linked issue. For each deleted script, -include a `Legacy E2E deletion evidence` block with: +Record that evidence in the PR body, which is the machine-checkable boundary for +the deletion. Link or summarize that PR evidence from the issue when useful. For +each deleted script, include a `Legacy E2E deletion evidence` block with: - `Script:` the deleted `test/e2e/test-*.sh` path. - `Legacy contract:` the observable behavior the shell script protected. -- `Replacement Vitest coverage:` a `.test.ts` path, or `Retirement rationale:` - when the behavior is intentionally retired instead of replaced. +- `Replacement Vitest coverage:` an existing `.test.ts` path, or `Retirement + rationale:` when the behavior is intentionally retired instead of replaced. - `Intentionally retired behavior:` any assertions, probes, or workflow hooks that are deliberately not preserved. - `Fidelity verification:` the command, CI check, or review evidence proving the diff --git a/test/e2e-scenario/docs/README.md b/test/e2e-scenario/docs/README.md index cd1d4295e9c..a424b91f696 100644 --- a/test/e2e-scenario/docs/README.md +++ b/test/e2e-scenario/docs/README.md @@ -123,7 +123,8 @@ assertion inventories are removed because they duplicated live GitHub state and drifted quickly. A PR that deletes a legacy E2E script must show the replacement Vitest coverage or explain the retirement rationale in a per-script PR-body `Legacy E2E deletion evidence` block, with the legacy contract, intentionally -retired behavior, and fidelity verification kept next to the deletion. +retired behavior, and fidelity verification kept next to the deletion. The +replacement coverage path must point at an existing `.test.ts` file. Prefer new E2E coverage in Vitest fixtures. When shell, installer, process, platform, or full user-flow behavior is the contract, invoke that real boundary diff --git a/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts b/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts index def7f1bd54d..0c5ffe1c9bb 100644 --- a/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts +++ b/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts @@ -39,6 +39,8 @@ describe("E2E migration tracking policy", () => { expect(docs).toContain("retirement rationale"); expect(docs).toContain("Legacy E2E deletion evidence"); expect(docs).toContain("Fidelity verification"); + expect(docs).toContain("machine-checkable boundary"); + expect(docs).toContain("existing `.test.ts` file"); expect(docs).toContain("generated legacy assertion inventories"); expect(docs).toContain("not a separate E2E framework or runner"); }); diff --git a/test/pr-review-advisor.test.ts b/test/pr-review-advisor.test.ts index 86413efbaca..d7f7694dc12 100644 --- a/test/pr-review-advisor.test.ts +++ b/test/pr-review-advisor.test.ts @@ -226,7 +226,7 @@ describe("PR review advisor", () => { "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding", ); expect(prompt).toContain("Legacy E2E deletion governance"); - expect(prompt).toContain("replacement Vitest coverage path or retirement rationale"); + expect(prompt).toContain("existing replacement Vitest coverage path or retirement rationale"); expect(prompt).toContain("multi-turn conversation"); expect(prompt).toContain( "In the final synthesis turn, return JSON only matching the schema provided in that turn", @@ -369,9 +369,9 @@ index 1234567..0000000 - Script: \`test/e2e/test-example.sh\` - Legacy contract: validates the example CLI path against a real shell. - - Replacement Vitest coverage: \`test/e2e-scenario/live/example.test.ts\` + - Replacement Vitest coverage: \`test/e2e-scenario/live/openshell-version-pin.test.ts\` - Intentionally retired behavior: none. - - Fidelity verification: \`npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/example.test.ts\` + - Fidelity verification: \`npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/openshell-version-pin.test.ts\` `; expect(findDeletedLegacyE2eShellScripts(diff)).toEqual(["test/e2e/test-example.sh"]); @@ -381,6 +381,7 @@ index 1234567..0000000 hasScriptEvidenceBlock: true, hasLegacyContract: true, hasReplacementVitestCoverage: true, + replacementVitestCoveragePath: "test/e2e-scenario/live/openshell-version-pin.test.ts", hasRetirementRationale: false, hasIntentionallyRetiredBehavior: true, hasFidelityVerification: true, @@ -412,7 +413,7 @@ deleted file mode 100755 ); expect(deletionEvidence[0]?.missing).toEqual([ - "replacement Vitest coverage path or retirement rationale", + "existing replacement Vitest coverage path or retirement rationale", "intentionally retired behavior", "fidelity verification", ]); @@ -422,7 +423,33 @@ deleted file mode 100755 file: "test/e2e/test-example.sh", title: "Legacy E2E deletion evidence is missing", }); - expect(result.findings[0]?.evidence).toContain("replacement Vitest coverage path"); + expect(result.findings[0]?.evidence).toContain("existing replacement Vitest coverage path"); + }); + + it("rejects replacement Vitest paths that do not exist in the checkout", () => { + const diff = `diff --git a/test/e2e/test-example.sh b/test/e2e/test-example.sh +deleted file mode 100755 +--- a/test/e2e/test-example.sh ++++ /dev/null +@@ -1 +0,0 @@ +-echo ok +`; + const [evidence] = assessLegacyE2eShellDeletionEvidence( + diff, + ` +- Script: \`test/e2e/test-example.sh\` + - Legacy contract: validates the example CLI path. + - Replacement Vitest coverage: \`test/e2e-scenario/live/does-not-exist.test.ts\` + - Intentionally retired behavior: none. + - Fidelity verification: focused Vitest run. +`, + ); + + expect(evidence).toMatchObject({ + replacementVitestCoveragePath: "test/e2e-scenario/live/does-not-exist.test.ts", + hasReplacementVitestCoverage: false, + missing: ["existing replacement Vitest coverage path or retirement rationale"], + }); }); it("adds a finding when source-of-truth review is missing follow-up", () => { diff --git a/tools/pr-review-advisor/analyze.mts b/tools/pr-review-advisor/analyze.mts index 57c0b7d26af..d1647bb4a9f 100755 --- a/tools/pr-review-advisor/analyze.mts +++ b/tools/pr-review-advisor/analyze.mts @@ -200,6 +200,7 @@ type LegacyE2eShellDeletionEvidence = { hasScriptEvidenceBlock: boolean; hasLegacyContract: boolean; hasReplacementVitestCoverage: boolean; + replacementVitestCoveragePath: string | null; hasRetirementRationale: boolean; hasIntentionallyRetiredBehavior: boolean; hasFidelityVerification: boolean; @@ -480,9 +481,8 @@ export function assessLegacyE2eShellDeletionEvidence( return findDeletedLegacyE2eShellScripts(diff).map((script) => { const evidenceBlock = findDeletionEvidenceBlock(prBody, script); const hasLegacyContract = /\blegacy contract\s*:/i.test(evidenceBlock); - const hasReplacementVitestCoverage = - /\breplacement vitest coverage\s*:/i.test(evidenceBlock) && - /\b(?:test|nemoclaw\/src)\/[^\s`)"']+\.test\.ts\b/.test(evidenceBlock); + const replacementVitestCoveragePath = extractReplacementVitestCoveragePath(evidenceBlock); + const hasReplacementVitestCoverage = replacementVitestCoveragePath !== null && repoFileExists(replacementVitestCoveragePath); const hasRetirementRationale = /\bretirement rationale\s*:/i.test(evidenceBlock); const hasIntentionallyRetiredBehavior = /\bintentionally retired behavior\s*:/i.test(evidenceBlock); const hasFidelityVerification = /\bfidelity verification\s*:/i.test(evidenceBlock); @@ -490,7 +490,7 @@ export function assessLegacyE2eShellDeletionEvidence( [evidenceBlock ? "" : "script evidence block", Boolean(evidenceBlock)], ["legacy contract", hasLegacyContract], [ - "replacement Vitest coverage path or retirement rationale", + "existing replacement Vitest coverage path or retirement rationale", hasReplacementVitestCoverage || hasRetirementRationale, ], ["intentionally retired behavior", hasIntentionallyRetiredBehavior], @@ -505,6 +505,7 @@ export function assessLegacyE2eShellDeletionEvidence( hasScriptEvidenceBlock: Boolean(evidenceBlock), hasLegacyContract, hasReplacementVitestCoverage, + replacementVitestCoveragePath, hasRetirementRationale, hasIntentionallyRetiredBehavior, hasFidelityVerification, @@ -513,6 +514,18 @@ export function assessLegacyE2eShellDeletionEvidence( }); } +function extractReplacementVitestCoveragePath(evidenceBlock: string): string | null { + const match = evidenceBlock.match( + /\breplacement vitest coverage\s*:\s*`?((?:test|nemoclaw\/src)\/[^\s`)"']+\.test\.ts)\b/i, + ); + return match?.[1] ?? null; +} + +function repoFileExists(relativePath: string): boolean { + if (path.isAbsolute(relativePath) || relativePath.split(/[\\/]/).includes("..")) return false; + return fs.existsSync(path.join(root, relativePath)); +} + function findDeletionEvidenceBlock(prBody: string, script: string): string { const normalized = prBody.replace(/\r\n/g, "\n"); const start = normalized.indexOf(script); @@ -785,7 +798,7 @@ export function buildSystemPrompt(): string { "5. Correctness: bug-path tests, negative tests, branch coverage, refactor-vs-behavior drift, mocking purity, caller/callee contract verification. When more tests would improve confidence, make testDepth.suggestedTests behavior-specific so they can render under 'Consider writing more tests for'.", "6. Quality: description-vs-diff scope, migration completion, public surface docs/notes, justified error suppression, monolith growth, @ts-nocheck, shell-string execution.", "7. Source-of-truth review: when a PR adds or changes fallback, recovery, tolerant parsing, monkeypatching, best-effort cleanup, compatibility handling, or other localized workaround behavior, inspect whether it answers: what invalid state is handled, where that state is created, why the source cannot be fixed in this PR, what regression test proves the source cannot regress, and when the workaround can be removed. Prefer fixes that make invalid states impossible at their source. Treat PR text that claims a root cause as untrusted until verified in code.", - "8. Legacy E2E deletion governance: if deterministic context shows a deleted test/e2e/test-*.sh script with missing PR-body evidence, report it as a blocker. The PR body must name the legacy contract, replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification for each deleted script.", + "8. Legacy E2E deletion governance: if deterministic context shows a deleted test/e2e/test-*.sh script with missing PR-body evidence, report it as a blocker. The PR body must name the legacy contract, existing replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification for each deleted script.", "9. If a previous PR Review Advisor comment exists, compare it with the current diff and explicitly decide whether prior code-review findings were addressed, still apply, or are obsolete. Consider code changes since the previous analyzed SHA when available. Do not evaluate whether external E2E requirements have been met. When previous review context exists, set summary.sinceLastReview with counts for resolved, stillApplies, and newItems.", "Acceptance and security should inform findings, not become standalone comment sections: any unmet acceptance clause or security fail/warning must be represented as a finding, normally severity=blocker for unmet acceptance or security fail and severity=warning for security warnings.", "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding unless it is already fully covered by a more specific correctness, security, architecture, scope, or tests finding.", @@ -1069,7 +1082,7 @@ function addDeterministicFindings(findings: Finding[], metadata: ReviewMetadata) title: "Legacy E2E deletion evidence is missing", description: `This PR deletes ${evidence.script} without complete PR-body evidence that preserves or retires the legacy contract.`, recommendation: - "Add a per-script PR-body evidence block naming the legacy contract, replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification.", + "Add a per-script PR-body evidence block naming the legacy contract, existing replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification.", evidence: `Missing: ${evidence.missing.join(", ")}.`, }); } From b1d33d7f21979a0d854317469b61d066372c5359 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 08:08:12 -0700 Subject: [PATCH 4/9] chore(e2e): address foundation review hygiene --- test/e2e-scenario/docs/README.md | 2 +- tools/e2e-advisor/scenarios-schema.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e-scenario/docs/README.md b/test/e2e-scenario/docs/README.md index a424b91f696..8082a50806a 100644 --- a/test/e2e-scenario/docs/README.md +++ b/test/e2e-scenario/docs/README.md @@ -3,7 +3,7 @@ # NemoClaw E2E Vitest Fixtures -NemoClaw E2E now has one target execution model: **Vitest as the harness** and +NemoClaw E2E now has one target execution model, Vitest as the harness and GitHub Actions as the matrix. Vitest owns discovery, filtering, timeouts, reporters, fixture lifecycle, skips, and CI integration. NemoClaw owns the domain layer: scenario metadata, phase fixtures, product clients, evidence diff --git a/tools/e2e-advisor/scenarios-schema.json b/tools/e2e-advisor/scenarios-schema.json index f7a8a3c139a..64a7f74808f 100644 --- a/tools/e2e-advisor/scenarios-schema.json +++ b/tools/e2e-advisor/scenarios-schema.json @@ -1,4 +1,6 @@ { + "SPDX-FileCopyrightText": "Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.", + "SPDX-License-Identifier": "Apache-2.0", "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://github.com/NVIDIA/NemoClaw/tools/e2e-advisor/scenarios-schema.json", "title": "NemoClaw Vitest E2E Scenario Advisor Result", From 6062f531123b44a67fc467d0bfd172ae93d2e27e Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 08:35:48 -0700 Subject: [PATCH 5/9] test(e2e): block retired ledger reintroduction --- test/pr-review-advisor.test.ts | 54 ++++++++++++++++++++++++++++- tools/pr-review-advisor/analyze.mts | 46 +++++++++++++++++++++++- 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/test/pr-review-advisor.test.ts b/test/pr-review-advisor.test.ts index d7f7694dc12..d458c586186 100644 --- a/test/pr-review-advisor.test.ts +++ b/test/pr-review-advisor.test.ts @@ -14,6 +14,7 @@ import { classifyTestDepth, detectLocalizedPatchSignals, findDeletedLegacyE2eShellScripts, + findRetiredE2eMigrationLedgerChanges, normalizeReviewResult, readTrustedSecurityReviewSkill, renderDetailedReview, @@ -41,6 +42,7 @@ function metadata(overrides: Partial = {}): ReviewMetadata { workflowSignals: [], localizedPatchSignals: [], legacyE2eShellDeletionEvidence: [], + retiredE2eMigrationLedgerChanges: [], monolithDeltas: [], driftEvidence: [], github: null, @@ -225,7 +227,8 @@ describe("PR review advisor", () => { expect(prompt).toContain( "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding", ); - expect(prompt).toContain("Legacy E2E deletion governance"); + expect(prompt).toContain("Legacy E2E migration governance"); + expect(prompt).toContain("retired repo-local E2E migration ledger"); expect(prompt).toContain("existing replacement Vitest coverage path or retirement rationale"); expect(prompt).toContain("multi-turn conversation"); expect(prompt).toContain( @@ -452,6 +455,55 @@ deleted file mode 100755 }); }); + it("detects retired E2E migration ledgers only when added or modified", () => { + const diff = `diff --git a/test/e2e-scenario/migration/legacy-inventory.json b/test/e2e-scenario/migration/legacy-inventory.json +index 1111111..2222222 100644 +--- a/test/e2e-scenario/migration/legacy-inventory.json ++++ b/test/e2e-scenario/migration/legacy-inventory.json +@@ -1 +1 @@ +-{"status":"old"} ++{"status":"bridge-probe"} +diff --git a/test/e2e/docs/parity-inventory.generated.json b/test/e2e/docs/parity-inventory.generated.json +deleted file mode 100644 +--- a/test/e2e/docs/parity-inventory.generated.json ++++ /dev/null +@@ -1 +0,0 @@ +-{} +`; + + expect(findRetiredE2eMigrationLedgerChanges(diff)).toEqual([ + { + file: "test/e2e-scenario/migration/legacy-inventory.json", + change: "modified", + }, + ]); + }); + + it("adds a blocker finding when a retired E2E migration ledger is reintroduced", () => { + const result = normalizeReviewResult( + validResult({ findings: [], sourceOfTruthReview: [] }), + metadata({ + deterministic: { + ...metadata().deterministic, + retiredE2eMigrationLedgerChanges: [ + { + file: "test/e2e-scenario/migration/legacy-inventory.json", + change: "added", + }, + ], + }, + }), + ); + + expect(result.findings[0]).toMatchObject({ + severity: "blocker", + category: "tests", + file: "test/e2e-scenario/migration/legacy-inventory.json", + title: "Retired E2E migration ledger is being reintroduced", + }); + expect(result.findings[0]?.recommendation).toContain("Remove repo-local migration ledger"); + }); + it("adds a finding when source-of-truth review is missing follow-up", () => { const result = normalizeReviewResult( validResult({ diff --git a/tools/pr-review-advisor/analyze.mts b/tools/pr-review-advisor/analyze.mts index d1647bb4a9f..b80e5d1eab5 100755 --- a/tools/pr-review-advisor/analyze.mts +++ b/tools/pr-review-advisor/analyze.mts @@ -164,6 +164,7 @@ type DeterministicReviewContext = { workflowSignals: string[]; localizedPatchSignals: LocalizedPatchSignal[]; legacyE2eShellDeletionEvidence: LegacyE2eShellDeletionEvidence[]; + retiredE2eMigrationLedgerChanges: RetiredE2eMigrationLedgerChange[]; monolithDeltas: MonolithDelta[]; driftEvidence: DriftEvidence[]; previousAdvisorReview: PreviousAdvisorReview | null; @@ -207,6 +208,11 @@ type LegacyE2eShellDeletionEvidence = { missing: string[]; }; +type RetiredE2eMigrationLedgerChange = { + file: string; + change: "added" | "modified"; +}; + type OpenPrOverlap = { number: number; title: string; @@ -366,6 +372,7 @@ async function collectDeterministicContext(options: { options.diff, pullRequestBodyText(github?.pullRequest), ); + const retiredE2eMigrationLedgerChanges = findRetiredE2eMigrationLedgerChanges(options.diff); return { diffStat: getDiffStat(options.baseRef, options.headRef), commits: getCommits(options.baseRef, options.headRef), @@ -375,6 +382,7 @@ async function collectDeterministicContext(options: { workflowSignals: detectWorkflowSignals(options.changedFiles, options.diff), localizedPatchSignals: detectLocalizedPatchSignals(options.diff), legacyE2eShellDeletionEvidence, + retiredE2eMigrationLedgerChanges, monolithDeltas: computeMonolithDeltas(options.baseRef, options.changedFiles), driftEvidence: collectDriftEvidence(options.baseRef, options.changedFiles), github, @@ -474,6 +482,28 @@ export function findDeletedLegacyE2eShellScripts(diff: string): string[] { return [...scripts].sort(); } +export function findRetiredE2eMigrationLedgerChanges(diff: string): RetiredE2eMigrationLedgerChange[] { + const retiredLedgers = new Set([ + "test/e2e-scenario/migration/legacy-inventory.json", + "test/e2e/docs/parity-inventory.generated.json", + ]); + const changes = new Map(); + for (const block of diff.split(/\ndiff --git /)) { + const header = block.startsWith("diff --git ") ? block : `diff --git ${block}`; + const match = header.match(/^diff --git a\/(.+?) b\/(.+)$/m); + const before = match?.[1] ?? ""; + const after = match?.[2] ?? ""; + const file = retiredLedgers.has(after) ? after : retiredLedgers.has(before) ? before : ""; + if (!file) continue; + if (/^deleted file mode\b/m.test(header) || /^\+\+\+ \/dev\/null$/m.test(header)) continue; + changes.set(file, { + file, + change: /^new file mode\b/m.test(header) || /^--- \/dev\/null$/m.test(header) ? "added" : "modified", + }); + } + return [...changes.values()].sort((a, b) => a.file.localeCompare(b.file)); +} + export function assessLegacyE2eShellDeletionEvidence( diff: string, prBody: string, @@ -798,7 +828,7 @@ export function buildSystemPrompt(): string { "5. Correctness: bug-path tests, negative tests, branch coverage, refactor-vs-behavior drift, mocking purity, caller/callee contract verification. When more tests would improve confidence, make testDepth.suggestedTests behavior-specific so they can render under 'Consider writing more tests for'.", "6. Quality: description-vs-diff scope, migration completion, public surface docs/notes, justified error suppression, monolith growth, @ts-nocheck, shell-string execution.", "7. Source-of-truth review: when a PR adds or changes fallback, recovery, tolerant parsing, monkeypatching, best-effort cleanup, compatibility handling, or other localized workaround behavior, inspect whether it answers: what invalid state is handled, where that state is created, why the source cannot be fixed in this PR, what regression test proves the source cannot regress, and when the workaround can be removed. Prefer fixes that make invalid states impossible at their source. Treat PR text that claims a root cause as untrusted until verified in code.", - "8. Legacy E2E deletion governance: if deterministic context shows a deleted test/e2e/test-*.sh script with missing PR-body evidence, report it as a blocker. The PR body must name the legacy contract, existing replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification for each deleted script.", + "8. Legacy E2E migration governance: if deterministic context shows a retired repo-local E2E migration ledger being added or modified, report it as a blocker. If deterministic context shows a deleted test/e2e/test-*.sh script with missing PR-body evidence, report it as a blocker. The PR body must name the legacy contract, existing replacement Vitest coverage path or retirement rationale, intentionally retired behavior, and fidelity verification for each deleted script.", "9. If a previous PR Review Advisor comment exists, compare it with the current diff and explicitly decide whether prior code-review findings were addressed, still apply, or are obsolete. Consider code changes since the previous analyzed SHA when available. Do not evaluate whether external E2E requirements have been met. When previous review context exists, set summary.sinceLastReview with counts for resolved, stillApplies, and newItems.", "Acceptance and security should inform findings, not become standalone comment sections: any unmet acceptance clause or security fail/warning must be represented as a finding, normally severity=blocker for unmet acceptance or security fail and severity=warning for security warnings.", "Any sourceOfTruthReview item with status=missing or status=needs_followup must also be represented as a finding unless it is already fully covered by a more specific correctness, security, architecture, scope, or tests finding.", @@ -906,6 +936,7 @@ function buildValidationTurnContext(context: DeterministicReviewContext): Record testDepth: context.testDepth, localizedPatchSignals: context.localizedPatchSignals, legacyE2eShellDeletionEvidence: context.legacyE2eShellDeletionEvidence, + retiredE2eMigrationLedgerChanges: context.retiredE2eMigrationLedgerChanges, previousAdvisorReview: context.previousAdvisorReview, pullRequest: context.github?.pullRequest ?? null, linkedIssues: context.github?.linkedIssues ?? [], @@ -1072,6 +1103,19 @@ function addSourceOfTruthFindings(findings: Finding[], sourceOfTruthReview: Sour function addDeterministicFindings(findings: Finding[], metadata: ReviewMetadata): Finding[] { const deletionEvidence = metadata.deterministic.legacyE2eShellDeletionEvidence ?? []; const injected: Finding[] = []; + for (const ledger of metadata.deterministic.retiredE2eMigrationLedgerChanges ?? []) { + injected.push({ + severity: "blocker", + category: "tests", + file: ledger.file, + line: null, + title: "Retired E2E migration ledger is being reintroduced", + description: `This PR ${ledger.change === "added" ? "adds" : "modifies"} ${ledger.file}, which is retired migration state.`, + recommendation: + "Remove repo-local migration ledger changes and record migration status, convergence evidence, and deletion rationale in the relevant GitHub issue or PR body instead.", + evidence: `${ledger.file} is a retired durable tracking ledger; #5126 makes GitHub issues and PRs the migration source of truth.`, + }); + } for (const evidence of deletionEvidence) { if (evidence.missing.length === 0) continue; injected.push({ From c2113a82002f2e49adf8a67350f2589b96bd17dc Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 09:11:59 -0700 Subject: [PATCH 6/9] test(release): disable signing in tag fixtures --- test/release-latest-tag.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/release-latest-tag.test.ts b/test/release-latest-tag.test.ts index b23be5005b0..0771114ff11 100644 --- a/test/release-latest-tag.test.ts +++ b/test/release-latest-tag.test.ts @@ -31,9 +31,11 @@ function testEnv(extra: NodeJS.ProcessEnv = {}): NodeJS.ProcessEnv { GIT_AUTHOR_EMAIL: "release-test@example.com", GIT_COMMITTER_NAME: "Release Test", GIT_COMMITTER_EMAIL: "release-test@example.com", - GIT_CONFIG_COUNT: "1", + GIT_CONFIG_COUNT: "2", GIT_CONFIG_KEY_0: "tag.gpgSign", GIT_CONFIG_VALUE_0: "false", + GIT_CONFIG_KEY_1: "commit.gpgSign", + GIT_CONFIG_VALUE_1: "false", ...extra, }); } @@ -122,11 +124,13 @@ function runReleaseLatestWithoutIdentity( fs.mkdirSync(home); fs.mkdirSync(xdgConfigHome); const env = baseEnv({ - GIT_CONFIG_COUNT: "2", + GIT_CONFIG_COUNT: "3", GIT_CONFIG_KEY_0: "user.useConfigOnly", GIT_CONFIG_VALUE_0: "true", GIT_CONFIG_KEY_1: "tag.gpgSign", GIT_CONFIG_VALUE_1: "false", + GIT_CONFIG_KEY_2: "commit.gpgSign", + GIT_CONFIG_VALUE_2: "false", GITHUB_STEP_SUMMARY: fixture.summary, HOME: home, RELEASE_TAG: releaseTag, From 3c1ffccf8abd9c7f45640d181c98ea97fb7abcad Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 09:13:15 -0700 Subject: [PATCH 7/9] test(e2e): rename scenario fixtures surface --- test/e2e-scenario-advisor.test.ts | 4 +- test/e2e-scenario/docs/MIGRATION.md | 6 +- test/e2e-scenario/docs/README.md | 8 +-- test/e2e-scenario/docs/RETIREMENT.md | 2 +- .../{framework => fixtures}/artifacts.ts | 0 .../availability-env.ts | 4 +- .../{framework => fixtures}/cleanup.ts | 0 .../clients/command.ts | 0 .../clients/gateway.ts | 0 .../{framework => fixtures}/clients/host.ts | 0 .../{framework => fixtures}/clients/index.ts | 0 .../clients/provider.ts | 2 +- .../clients/sandbox.ts | 0 .../{framework => fixtures}/clients/state.ts | 0 .../{framework => fixtures}/e2e-test.ts | 0 .../live-project-gate.ts | 0 .../phases/environment.ts | 0 .../{framework => fixtures}/phases/index.ts | 0 .../phases/lifecycle.ts | 2 +- .../phases/onboarding.ts | 0 .../{framework => fixtures}/phases/runtime.ts | 0 .../phases/state-validation.ts | 2 +- .../{framework => fixtures}/redaction.ts | 58 +++++++++---------- .../{framework => fixtures}/secrets.ts | 2 +- .../{framework => fixtures}/shell-probe.ts | 4 +- .../shell/supervisor.ts | 2 +- .../shell/trusted-command.ts | 2 +- .../live/openshell-version-pin.test.ts | 4 +- .../live/registry-scenarios.test.ts | 4 +- .../live/ubuntu-repo-cli-smoke.test.ts | 2 +- test/e2e-scenario/scenarios/types.ts | 12 ++-- .../support-tests/e2e-clients.test.ts | 6 +- .../support-tests/e2e-fixture-context.test.ts | 10 ++-- .../e2e-live-project-config.test.ts | 2 +- .../e2e-migration-policy.test.ts | 2 +- .../e2e-phase-environment.test.ts | 10 ++-- .../support-tests/e2e-phase-lifecycle.test.ts | 10 ++-- .../e2e-phase-onboarding.test.ts | 12 ++-- .../support-tests/e2e-phase-runtime.test.ts | 8 +-- .../e2e-phase-state-validation.test.ts | 10 ++-- .../support-tests/e2e-redaction-entry.test.ts | 10 ++-- .../e2e-redaction-parity.test.ts | 34 +++++------ .../e2e-shell-supervisor.test.ts | 10 ++-- tools/e2e-advisor/scenarios.mts | 2 +- vitest.config.ts | 2 +- 45 files changed, 124 insertions(+), 124 deletions(-) rename test/e2e-scenario/{framework => fixtures}/artifacts.ts (100%) rename test/e2e-scenario/{framework => fixtures}/availability-env.ts (89%) rename test/e2e-scenario/{framework => fixtures}/cleanup.ts (100%) rename test/e2e-scenario/{framework => fixtures}/clients/command.ts (100%) rename test/e2e-scenario/{framework => fixtures}/clients/gateway.ts (100%) rename test/e2e-scenario/{framework => fixtures}/clients/host.ts (100%) rename test/e2e-scenario/{framework => fixtures}/clients/index.ts (100%) rename test/e2e-scenario/{framework => fixtures}/clients/provider.ts (99%) rename test/e2e-scenario/{framework => fixtures}/clients/sandbox.ts (100%) rename test/e2e-scenario/{framework => fixtures}/clients/state.ts (100%) rename test/e2e-scenario/{framework => fixtures}/e2e-test.ts (100%) rename test/e2e-scenario/{framework => fixtures}/live-project-gate.ts (100%) rename test/e2e-scenario/{framework => fixtures}/phases/environment.ts (100%) rename test/e2e-scenario/{framework => fixtures}/phases/index.ts (100%) rename test/e2e-scenario/{framework => fixtures}/phases/lifecycle.ts (99%) rename test/e2e-scenario/{framework => fixtures}/phases/onboarding.ts (100%) rename test/e2e-scenario/{framework => fixtures}/phases/runtime.ts (100%) rename test/e2e-scenario/{framework => fixtures}/phases/state-validation.ts (99%) rename test/e2e-scenario/{framework => fixtures}/redaction.ts (81%) rename test/e2e-scenario/{framework => fixtures}/secrets.ts (96%) rename test/e2e-scenario/{framework => fixtures}/shell-probe.ts (97%) rename test/e2e-scenario/{framework => fixtures}/shell/supervisor.ts (98%) rename test/e2e-scenario/{framework => fixtures}/shell/trusted-command.ts (96%) diff --git a/test/e2e-scenario-advisor.test.ts b/test/e2e-scenario-advisor.test.ts index 863706927ec..c728627fa71 100644 --- a/test/e2e-scenario-advisor.test.ts +++ b/test/e2e-scenario-advisor.test.ts @@ -38,13 +38,13 @@ describe("Vitest E2E scenario advisor — prompt construction", () => { const prompt = buildPrompt({ baseRef: "origin/main", headRef: "HEAD", - changedFiles: ["test/e2e-scenario/framework/phases/onboarding.ts"], + changedFiles: ["test/e2e-scenario/fixtures/phases/onboarding.ts"], diff: "+ echo ok", }); // Caller of normalizeScenarioAdvisorResult re-injects metadata, but the // prompt must still surface enough context for the model to reason. expect(prompt).toContain("origin/main"); - expect(prompt).toContain("test/e2e-scenario/framework/phases/onboarding.ts"); + expect(prompt).toContain("test/e2e-scenario/fixtures/phases/onboarding.ts"); expect(prompt).toContain("+ echo ok"); }); diff --git a/test/e2e-scenario/docs/MIGRATION.md b/test/e2e-scenario/docs/MIGRATION.md index d97f3914990..4757f633121 100644 --- a/test/e2e-scenario/docs/MIGRATION.md +++ b/test/e2e-scenario/docs/MIGRATION.md @@ -21,7 +21,7 @@ The scenario runner cutover is complete: - `e2e-vitest-scenarios.yaml` is the scenario workflow. - `test/e2e-scenario/live/registry-scenarios.test.ts` is the registry-driven live scenario entrypoint. -- `test/e2e-scenario/framework/` owns phase fixtures, clients, artifact +- `test/e2e-scenario/fixtures/` owns phase fixtures, clients, artifact capture, redaction, cleanup, and shell-probe bridges. - `test/e2e-scenario/scenarios/run.ts` only lists scenarios and emits the live Vitest matrix. @@ -44,8 +44,8 @@ The durable E2E system has one execution path: - NemoClaw fixtures own setup, onboarding, lifecycle mutations, expected-state probes, assertion helpers, expected-failure evidence, cleanup, artifacts, and secret redaction. -- The historical `test/e2e-scenario/framework/` path is fixture/support code, - not a separate E2E framework or runner. +- `test/e2e-scenario/fixtures/` is fixture/support code, not a test harness + or runner. - Typed scenario definitions and matrix helpers describe stable scenario IDs and supported combinations without becoming a second runner. - Product-facing manifests describe desired setup/onboarding state, not test diff --git a/test/e2e-scenario/docs/README.md b/test/e2e-scenario/docs/README.md index 8082a50806a..563819bfbb5 100644 --- a/test/e2e-scenario/docs/README.md +++ b/test/e2e-scenario/docs/README.md @@ -25,7 +25,7 @@ runner cutover; migrate them by contract using the rules in `MIGRATION.md`. | Live scenario IDs and metadata | `test/e2e-scenario/scenarios/registry.ts`, `test/e2e-scenario/scenarios/scenarios/baseline.ts` | | GitHub Actions matrix emission | `test/e2e-scenario/scenarios/run.ts --emit-live-matrix` | | Live scenario execution | `test/e2e-scenario/live/registry-scenarios.test.ts` | -| Phase fixtures and clients | `test/e2e-scenario/framework/` | +| Phase fixtures and clients | `test/e2e-scenario/fixtures/` | | Expected-state probes | `test/e2e-scenario/scenarios/expected-states.ts` | | Product-facing setup/onboarding state | `test/e2e-scenario/manifests/*.yaml` | | Legacy direct E2E coverage | `test/e2e/test-*.sh` and their workflows | @@ -52,8 +52,8 @@ Live execution happens through Vitest fixtures: - `artifacts`, `secrets`, `cleanup`, and `shellProbe` provide shared fixture services. -The historical `test/e2e-scenario/framework/` path is a fixture/support layer, -not a separate E2E framework or runner. Vitest remains the only test harness. +The `test/e2e-scenario/fixtures/` path is fixture/support code, not a test +harness or runner. Vitest remains the only test harness. `suiteIds` remain metadata for reporting and migration planning. They do not dispatch shell validation suites. @@ -86,7 +86,7 @@ paths must not be reintroduced. ```text test/e2e-scenario/ docs/ # Fixture guide, migration notes, retirement record - framework/ # Vitest fixtures, clients, redaction, artifacts, cleanup + fixtures/ # Vitest fixtures, clients, redaction, artifacts, cleanup live/ # Opt-in live Vitest scenario tests manifests/ # Product-facing NemoClawInstance desired state scenarios/ # Typed registry, matrix helpers, expected states diff --git a/test/e2e-scenario/docs/RETIREMENT.md b/test/e2e-scenario/docs/RETIREMENT.md index 03e55d17434..644298f5922 100644 --- a/test/e2e-scenario/docs/RETIREMENT.md +++ b/test/e2e-scenario/docs/RETIREMENT.md @@ -45,7 +45,7 @@ and artifact shape operators needed from the retired workflows: - `.github/workflows/e2e-vitest-scenarios.yaml` runs the live matrix. - `test/e2e-scenario/live/registry-scenarios.test.ts` executes supported registry scenarios through Vitest. -- `test/e2e-scenario/framework/` owns fixtures, clients, shell-probe bridges, +- `test/e2e-scenario/fixtures/` owns fixtures, clients, shell-probe bridges, artifact writing, cleanup, and redaction. ## What Was Not Removed diff --git a/test/e2e-scenario/framework/artifacts.ts b/test/e2e-scenario/fixtures/artifacts.ts similarity index 100% rename from test/e2e-scenario/framework/artifacts.ts rename to test/e2e-scenario/fixtures/artifacts.ts diff --git a/test/e2e-scenario/framework/availability-env.ts b/test/e2e-scenario/fixtures/availability-env.ts similarity index 89% rename from test/e2e-scenario/framework/availability-env.ts rename to test/e2e-scenario/fixtures/availability-env.ts index 55b2ce6bd77..b05dfa29866 100644 --- a/test/e2e-scenario/framework/availability-env.ts +++ b/test/e2e-scenario/fixtures/availability-env.ts @@ -18,9 +18,9 @@ export function buildAvailabilityProbeEnv( ): NodeJS.ProcessEnv { // Availability probes run outside live scenario phases, but they need // the same child-env and PATH policy. Add only Docker - // discovery knobs on top of the shared framework boundary. + // discovery knobs on top of the shared fixture boundary. return buildChildEnv(base, { additionalAllowedEnv: AVAILABILITY_PROBE_EXTRA_ENV_KEYS, - frameworkOverlay: {}, + fixtureOverlay: {}, }); } diff --git a/test/e2e-scenario/framework/cleanup.ts b/test/e2e-scenario/fixtures/cleanup.ts similarity index 100% rename from test/e2e-scenario/framework/cleanup.ts rename to test/e2e-scenario/fixtures/cleanup.ts diff --git a/test/e2e-scenario/framework/clients/command.ts b/test/e2e-scenario/fixtures/clients/command.ts similarity index 100% rename from test/e2e-scenario/framework/clients/command.ts rename to test/e2e-scenario/fixtures/clients/command.ts diff --git a/test/e2e-scenario/framework/clients/gateway.ts b/test/e2e-scenario/fixtures/clients/gateway.ts similarity index 100% rename from test/e2e-scenario/framework/clients/gateway.ts rename to test/e2e-scenario/fixtures/clients/gateway.ts diff --git a/test/e2e-scenario/framework/clients/host.ts b/test/e2e-scenario/fixtures/clients/host.ts similarity index 100% rename from test/e2e-scenario/framework/clients/host.ts rename to test/e2e-scenario/fixtures/clients/host.ts diff --git a/test/e2e-scenario/framework/clients/index.ts b/test/e2e-scenario/fixtures/clients/index.ts similarity index 100% rename from test/e2e-scenario/framework/clients/index.ts rename to test/e2e-scenario/fixtures/clients/index.ts diff --git a/test/e2e-scenario/framework/clients/provider.ts b/test/e2e-scenario/fixtures/clients/provider.ts similarity index 99% rename from test/e2e-scenario/framework/clients/provider.ts rename to test/e2e-scenario/fixtures/clients/provider.ts index 257c7c8b6ac..e6bf00fb137 100644 --- a/test/e2e-scenario/framework/clients/provider.ts +++ b/test/e2e-scenario/fixtures/clients/provider.ts @@ -19,7 +19,7 @@ export interface TrustedProviderEndpoint { export interface TrustedProviderEndpointOptions { /** - * Static framework-owned trust configuration for external HTTPS provider + * Static fixture-owned trust configuration for external HTTPS provider * endpoints. Do not populate this from scenario manifests or user input. */ allowedHosts?: readonly string[]; diff --git a/test/e2e-scenario/framework/clients/sandbox.ts b/test/e2e-scenario/fixtures/clients/sandbox.ts similarity index 100% rename from test/e2e-scenario/framework/clients/sandbox.ts rename to test/e2e-scenario/fixtures/clients/sandbox.ts diff --git a/test/e2e-scenario/framework/clients/state.ts b/test/e2e-scenario/fixtures/clients/state.ts similarity index 100% rename from test/e2e-scenario/framework/clients/state.ts rename to test/e2e-scenario/fixtures/clients/state.ts diff --git a/test/e2e-scenario/framework/e2e-test.ts b/test/e2e-scenario/fixtures/e2e-test.ts similarity index 100% rename from test/e2e-scenario/framework/e2e-test.ts rename to test/e2e-scenario/fixtures/e2e-test.ts diff --git a/test/e2e-scenario/framework/live-project-gate.ts b/test/e2e-scenario/fixtures/live-project-gate.ts similarity index 100% rename from test/e2e-scenario/framework/live-project-gate.ts rename to test/e2e-scenario/fixtures/live-project-gate.ts diff --git a/test/e2e-scenario/framework/phases/environment.ts b/test/e2e-scenario/fixtures/phases/environment.ts similarity index 100% rename from test/e2e-scenario/framework/phases/environment.ts rename to test/e2e-scenario/fixtures/phases/environment.ts diff --git a/test/e2e-scenario/framework/phases/index.ts b/test/e2e-scenario/fixtures/phases/index.ts similarity index 100% rename from test/e2e-scenario/framework/phases/index.ts rename to test/e2e-scenario/fixtures/phases/index.ts diff --git a/test/e2e-scenario/framework/phases/lifecycle.ts b/test/e2e-scenario/fixtures/phases/lifecycle.ts similarity index 99% rename from test/e2e-scenario/framework/phases/lifecycle.ts rename to test/e2e-scenario/fixtures/phases/lifecycle.ts index 6617bddd1e4..263f7c6f965 100644 --- a/test/e2e-scenario/framework/phases/lifecycle.ts +++ b/test/e2e-scenario/fixtures/phases/lifecycle.ts @@ -165,7 +165,7 @@ export class LifecyclePhaseFixture { // Final step: drive the user-visible action that exposed #4423. // We invoke status through the host CLI client so artifacts are // captured and the command goes through the same - // shellProbe/redaction layer the rest of the framework uses. + // shellProbe/redaction layer the rest of the fixture code uses. // Status is allowed to fail (exit non-zero) because on unfixed // code it intentionally fails after destroying state — the // post-action invariants are checked by state-validation. diff --git a/test/e2e-scenario/framework/phases/onboarding.ts b/test/e2e-scenario/fixtures/phases/onboarding.ts similarity index 100% rename from test/e2e-scenario/framework/phases/onboarding.ts rename to test/e2e-scenario/fixtures/phases/onboarding.ts diff --git a/test/e2e-scenario/framework/phases/runtime.ts b/test/e2e-scenario/fixtures/phases/runtime.ts similarity index 100% rename from test/e2e-scenario/framework/phases/runtime.ts rename to test/e2e-scenario/fixtures/phases/runtime.ts diff --git a/test/e2e-scenario/framework/phases/state-validation.ts b/test/e2e-scenario/fixtures/phases/state-validation.ts similarity index 99% rename from test/e2e-scenario/framework/phases/state-validation.ts rename to test/e2e-scenario/fixtures/phases/state-validation.ts index ea09977afdf..47651635f27 100644 --- a/test/e2e-scenario/framework/phases/state-validation.ts +++ b/test/e2e-scenario/fixtures/phases/state-validation.ts @@ -19,7 +19,7 @@ import type { ExpectedState, StateProbeId } from "../../scenarios/types.ts"; import type { NemoClawInstance } from "./onboarding.ts"; // Mirror of `src/lib/state/registry.ts::REGISTRY_FILE`. The fixture -// owns its own copy because the framework code must not import from +// owns its own copy because the fixture code must not import from // `src/lib/**` (CLI source) — that boundary keeps the live runner // honest about probing only host-observable state. const NEMOCLAW_REGISTRY_RELPATH = [".nemoclaw", "sandboxes.json"] as const; diff --git a/test/e2e-scenario/framework/redaction.ts b/test/e2e-scenario/fixtures/redaction.ts similarity index 81% rename from test/e2e-scenario/framework/redaction.ts rename to test/e2e-scenario/fixtures/redaction.ts index 8a56d1a509f..965f4205d97 100644 --- a/test/e2e-scenario/framework/redaction.ts +++ b/test/e2e-scenario/fixtures/redaction.ts @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 /** - * Framework-owned secret hygiene at the spawn boundary. + * Fixture-owned secret hygiene at the spawn boundary. * - * Spec ownership: redaction and child-env minimization are FRAMEWORK + * Spec ownership: redaction and child-env minimization are FIXTURE * INFRASTRUCTURE, not a per-action / per-script / per-workflow concern. - * Children spawned by framework command boundaries must (a) receive a minimal, - * typed env (framework allowlist + per-action declared `secretEnv` + * Children spawned by fixture command boundaries must (a) receive a minimal, + * typed env (fixture allowlist + per-action declared `secretEnv` * passthrough only), and (b) have their stdout/stderr passed through * redaction before any byte reaches an evidence log or * PhaseResult.message. There is no opt-out flag, no env switch, no @@ -16,9 +16,9 @@ * rest of this PR. * * Pattern source-of-truth: src/lib/security/secret-patterns.ts. We - * import the canonical regex sets and apply them here so framework + * import the canonical regex sets and apply them here so fixture-layer * redaction stays in lockstep with product-runtime redaction without - * coupling the framework to product runtime modules. + * coupling the fixture layer to product runtime modules. * * Tests: * test/e2e-scenario/support-tests/e2e-redaction-entry.test.ts @@ -26,7 +26,7 @@ * test/e2e-scenario/support-tests/e2e-phase-environment.test.ts * - canonical token redaction parity with product runtime patterns * - explicit per-test redaction values - * - child-env allowlist filtering for framework probes + * - child-env allowlist filtering for fixture probes */ import type { Readable, Writable } from "node:stream"; @@ -34,8 +34,8 @@ import type { Readable, Writable } from "node:stream"; const REDACTED = ""; const EXPLICIT_REDACTED = "[REDACTED]"; -// Framework-local mirror of src/lib/security/secret-patterns.ts. The -// framework deliberately does not import from src/lib/security/ so it +// Fixture-local mirror of src/lib/security/secret-patterns.ts. The +// fixture layer deliberately does not import from src/lib/security/ so it // stays decoupled from product runtime modules and the cross-tsconfig // boundary. A parity test // (test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts) @@ -46,7 +46,7 @@ const EXPLICIT_REDACTED = "[REDACTED]"; // (test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts) can // import the actual RegExp values rather than parsing source text. // Production code in this module continues to use them via the local -// binding; nothing in the framework runtime imports these. +// binding; nothing in the fixture runtime imports these. export const TOKEN_PREFIX_PATTERNS: RegExp[] = [ /nvapi-[A-Za-z0-9_-]{10,}/g, /nvcf-[A-Za-z0-9_-]{10,}/g, @@ -110,11 +110,11 @@ export function redactString(text: string, explicitValues?: Iterable): s return out; } -// Env keys the framework guarantees children may always see. Anything -// outside this set, outside FRAMEWORK_ENV_PREFIXES, and not declared +// Env keys the fixture layer guarantees children may always see. Anything +// outside this set, outside FIXTURE_ENV_PREFIXES, and not declared // in PhaseAction.secretEnv / AssertionStep.secretEnv is dropped before // the child spawns. -const FRAMEWORK_ENV_ALLOWLIST: ReadonlySet = new Set([ +const FIXTURE_ENV_ALLOWLIST: ReadonlySet = new Set([ "PATH", "HOME", "SHELL", @@ -134,12 +134,12 @@ const FRAMEWORK_ENV_ALLOWLIST: ReadonlySet = new Set([ "NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE", ]); -const FRAMEWORK_ENV_PREFIXES: readonly string[] = ["E2E_", "NEMOCLAW_LOG_"]; +const FIXTURE_ENV_PREFIXES: readonly string[] = ["E2E_", "NEMOCLAW_LOG_"]; // Shape required of any declared secretEnv key — must look like a // secret-bearing variable. Prevents accidental allowlisting of // non-secret values via the secretEnv channel and keeps the -// "framework-allowlist vs declared-secret" distinction honest. +// "fixture-allowlist vs declared-secret" distinction honest. const SECRET_ENV_KEY_SHAPE = /^[A-Z][A-Z0-9_]*(?:API[_]?KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL|PASSPHRASE|PRIVATE[_]?KEY|ACCESS[_]?KEY)$/; @@ -150,20 +150,20 @@ export function isValidSecretEnvKey(key: string): boolean { export interface BuildChildEnvOptions { /** Per-action / per-step declared secret-bearing env keys to pass through. */ secretEnv?: readonly string[]; - /** Additional non-secret env keys required by a framework-owned spawn helper. */ + /** Additional non-secret env keys required by a fixture-owned spawn helper. */ additionalAllowedEnv?: readonly string[]; - /** Framework-controlled overlay (E2E_CONTEXT_DIR, E2E_PHASE, E2E_*_ID). */ - frameworkOverlay: NodeJS.ProcessEnv; + /** Fixture-controlled overlay (E2E_CONTEXT_DIR, E2E_PHASE, E2E_*_ID). */ + fixtureOverlay: NodeJS.ProcessEnv; } /** * Build the child's env from `base` (typically `process.env`) by * keeping only: - * 1. keys in FRAMEWORK_ENV_ALLOWLIST - * 2. keys starting with one of FRAMEWORK_ENV_PREFIXES + * 1. keys in FIXTURE_ENV_ALLOWLIST + * 2. keys starting with one of FIXTURE_ENV_PREFIXES * 3. non-secret keys explicitly declared in `opts.additionalAllowedEnv` * 4. keys explicitly declared in `opts.secretEnv` (validated shape) - * then layering `opts.frameworkOverlay` on top. + * then layering `opts.fixtureOverlay` on top. * * Throws if a `secretEnv` entry doesn't match the secret-key shape; * better to fail loudly at compile/runtime than silently leak a @@ -176,11 +176,11 @@ export function buildChildEnv( const out: NodeJS.ProcessEnv = {}; for (const [key, value] of Object.entries(base)) { if (value === undefined) continue; - if (FRAMEWORK_ENV_ALLOWLIST.has(key)) { + if (FIXTURE_ENV_ALLOWLIST.has(key)) { out[key] = value; continue; } - if (FRAMEWORK_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) { + if (FIXTURE_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) { out[key] = value; continue; } @@ -208,14 +208,14 @@ export function buildChildEnv( out[key] = base[key]; } } - Object.assign(out, opts.frameworkOverlay); + Object.assign(out, opts.fixtureOverlay); // The install action drops nemoclaw / openshell shims under // ~/.local/bin (the historical repo-current install location). // On Ubuntu GH runners ~/.local/bin is on the default PATH; on // self-hosted GPU runners and inside WSL it often is not, so the // onboarding action's child runs without nemoclaw on PATH and // dies with 'nemoclaw: command not found'. Add ~/.local/bin to - // every child's PATH at the framework boundary so the install + // every child's PATH at the fixture boundary so the install // location is consistent across phases. Idempotent equivalent of // the install-path-refresh.sh nemoclaw_ensure_local_bin_on_path // helper, applied centrally instead of per-script. @@ -250,15 +250,15 @@ export function pipeRedacted( } /** - * Compact array of all framework env keys the child sees by default. + * Compact array of all fixture env keys the child sees by default. * Exported for tests/diagnostics; do not use to bypass the boundary. */ -export function frameworkEnvAllowlistSnapshot(): { +export function fixtureEnvAllowlistSnapshot(): { keys: string[]; prefixes: string[]; } { return { - keys: [...FRAMEWORK_ENV_ALLOWLIST].sort(), - prefixes: [...FRAMEWORK_ENV_PREFIXES], + keys: [...FIXTURE_ENV_ALLOWLIST].sort(), + prefixes: [...FIXTURE_ENV_PREFIXES], }; } diff --git a/test/e2e-scenario/framework/secrets.ts b/test/e2e-scenario/fixtures/secrets.ts similarity index 96% rename from test/e2e-scenario/framework/secrets.ts rename to test/e2e-scenario/fixtures/secrets.ts index 6f3d59e6d97..ff18bc607f0 100644 --- a/test/e2e-scenario/framework/secrets.ts +++ b/test/e2e-scenario/fixtures/secrets.ts @@ -10,7 +10,7 @@ const SENSITIVE_NAME_PATTERN = /(api[_-]?key|token|secret|password|credential)/i * * Holds the per-test view of `process.env` and lets fixtures discover * sensitive values by name. Redaction itself is owned by the canonical - * entry point in framework/redaction.ts; this class only + * entry point in fixtures/redaction.ts; this class only * supplies the explicit values it knows about and delegates. There is * no separate fixture redaction pattern source. */ diff --git a/test/e2e-scenario/framework/shell-probe.ts b/test/e2e-scenario/fixtures/shell-probe.ts similarity index 97% rename from test/e2e-scenario/framework/shell-probe.ts rename to test/e2e-scenario/fixtures/shell-probe.ts index 2fd3dc81149..f78582a89f2 100644 --- a/test/e2e-scenario/framework/shell-probe.ts +++ b/test/e2e-scenario/fixtures/shell-probe.ts @@ -12,9 +12,9 @@ import type { TrustedShellCommand } from "./shell/trusted-command.ts"; * * The lifecycle boundary (detached process-group cleanup, SIGTERM -> * SIGKILL escalation, timeout, AbortSignal) is owned by - * framework/shell/supervisor.ts and shared with the phase orchestrator + * fixtures/shell/supervisor.ts and shared with the phase orchestrator * and probe helpers. The trusted-command brand + NUL-byte guard live - * in framework/shell/trusted-command.ts. This file layers the + * in fixtures/shell/trusted-command.ts. This file layers the * fixture-specific policy on top: redaction at the canonical entry * point, artefact persistence, and explicit-env-by-default. */ diff --git a/test/e2e-scenario/framework/shell/supervisor.ts b/test/e2e-scenario/fixtures/shell/supervisor.ts similarity index 98% rename from test/e2e-scenario/framework/shell/supervisor.ts rename to test/e2e-scenario/fixtures/shell/supervisor.ts index 1da9845776b..492c6e5b62e 100644 --- a/test/e2e-scenario/framework/shell/supervisor.ts +++ b/test/e2e-scenario/fixtures/shell/supervisor.ts @@ -9,7 +9,7 @@ import type { ChildProcess } from "node:child_process"; * * Spec ownership: detached process-group cleanup, SIGTERM -> SIGKILL * escalation, timeout enforcement, and AbortSignal handling are - * FRAMEWORK INFRASTRUCTURE. Every TS spawn site delegates here so the + * FIXTURE INFRASTRUCTURE. Every TS spawn site delegates here so the * cleanup contract stays in one place. Callers keep their own spawn() * call so per-site argv contracts (literal `bash -c` scripts with * positional argv, host-CLI argv arrays, trusted-command descriptors) diff --git a/test/e2e-scenario/framework/shell/trusted-command.ts b/test/e2e-scenario/fixtures/shell/trusted-command.ts similarity index 96% rename from test/e2e-scenario/framework/shell/trusted-command.ts rename to test/e2e-scenario/fixtures/shell/trusted-command.ts index 1c211c8a599..54aa0fc93a3 100644 --- a/test/e2e-scenario/framework/shell/trusted-command.ts +++ b/test/e2e-scenario/fixtures/shell/trusted-command.ts @@ -5,7 +5,7 @@ * Trusted command descriptor + NUL-byte guard shared by every E2E * TypeScript spawn site. * - * Spec ownership: command shape validation is FRAMEWORK INFRASTRUCTURE, + * Spec ownership: command shape validation is FIXTURE INFRASTRUCTURE, * not a per-helper concern. Whether the spawn site is the fixture layer * (ShellProbe), the phase orchestrator (PhaseOrchestrator.runAction / * runShellStep), or the probe helpers (spawnBash, runHostCmd, docs / diff --git a/test/e2e-scenario/live/openshell-version-pin.test.ts b/test/e2e-scenario/live/openshell-version-pin.test.ts index b20db553dd2..84a77066c9a 100644 --- a/test/e2e-scenario/live/openshell-version-pin.test.ts +++ b/test/e2e-scenario/live/openshell-version-pin.test.ts @@ -6,8 +6,8 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { type ArtifactSink } from "../framework/artifacts.ts"; -import { expect, test } from "../framework/e2e-test.ts"; +import { type ArtifactSink } from "../fixtures/artifacts.ts"; +import { expect, test } from "../fixtures/e2e-test.ts"; // Migrated from test/e2e/test-openshell-version-pin.sh (regression guard for // #3474). The legacy bash script is a hermetic installer-script behavioral diff --git a/test/e2e-scenario/live/registry-scenarios.test.ts b/test/e2e-scenario/live/registry-scenarios.test.ts index 7391f20dcde..0e94f7e1575 100644 --- a/test/e2e-scenario/live/registry-scenarios.test.ts +++ b/test/e2e-scenario/live/registry-scenarios.test.ts @@ -4,8 +4,8 @@ import fs from "node:fs"; import path from "node:path"; -import { expect, test } from "../framework/e2e-test.ts"; -import type { LifecycleProfile } from "../framework/phases/index.ts"; +import { expect, test } from "../fixtures/e2e-test.ts"; +import type { LifecycleProfile } from "../fixtures/phases/index.ts"; import { listScenarios } from "../scenarios/registry.ts"; import { liveScenarioSupport, liveScenarioTestName } from "../scenarios/runtime-support.ts"; import { buildLiveScenarioRunPlan } from "./run-plan.ts"; diff --git a/test/e2e-scenario/live/ubuntu-repo-cli-smoke.test.ts b/test/e2e-scenario/live/ubuntu-repo-cli-smoke.test.ts index c8186507418..d9ef8613cb3 100644 --- a/test/e2e-scenario/live/ubuntu-repo-cli-smoke.test.ts +++ b/test/e2e-scenario/live/ubuntu-repo-cli-smoke.test.ts @@ -4,7 +4,7 @@ import fs from "node:fs"; import path from "node:path"; -import { expect, test } from "../framework/e2e-test.ts"; +import { expect, test } from "../fixtures/e2e-test.ts"; const REPO_ROOT = path.resolve(import.meta.dirname, "../../.."); const CLI_DIST_ENTRYPOINT = path.join(REPO_ROOT, "dist", "nemoclaw.js"); diff --git a/test/e2e-scenario/scenarios/types.ts b/test/e2e-scenario/scenarios/types.ts index 0310c344041..a95f928f97d 100644 --- a/test/e2e-scenario/scenarios/types.ts +++ b/test/e2e-scenario/scenarios/types.ts @@ -150,10 +150,10 @@ export interface AssertionStep { }; evidencePath?: string; reliability?: AssertionStepReliability; - // Declared parent-env keys this step requires beyond the framework's + // Declared parent-env keys this step requires beyond the fixture layer's // allowlist. Anything not allowlisted and not declared here is - // dropped before spawn. See framework/redaction.ts. Each entry - // must match the secret-key shape; the framework rejects non-secret + // dropped before spawn. See fixtures/redaction.ts. Each entry + // must match the secret-key shape; the fixture layer rejects non-secret // names to keep the allowlist-vs-declared-secret boundary honest. secretEnv?: readonly string[]; // When true, a probe/pending step that resolves as "skipped" is @@ -234,10 +234,10 @@ export interface PhaseAction { // keep working without coupling them to the action's stable id. aliasPath?: string; // Declared parent-env keys this action requires beyond the - // framework's allowlist (PATH, HOME, E2E_*, NEMOCLAW_*, ...). + // fixture layer's allowlist (PATH, HOME, E2E_*, NEMOCLAW_*, ...). // Anything not allowlisted and not declared here is dropped before - // spawn. See framework/redaction.ts. Each entry must match the - // secret-key shape; the framework rejects non-secret names so the + // spawn. See fixtures/redaction.ts. Each entry must match the + // secret-key shape; the fixture layer rejects non-secret names so the // allowlist-vs-declared-secret boundary stays honest. Cloud install // declares ["NVIDIA_API_KEY"]; slack onboarding declares the slack // tokens it actually needs; etc. diff --git a/test/e2e-scenario/support-tests/e2e-clients.test.ts b/test/e2e-scenario/support-tests/e2e-clients.test.ts index 77e8824fe22..05be65beaa6 100644 --- a/test/e2e-scenario/support-tests/e2e-clients.test.ts +++ b/test/e2e-scenario/support-tests/e2e-clients.test.ts @@ -7,7 +7,7 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; -import { assertExitZero, type CommandRunner } from "../framework/clients/index.ts"; +import { assertExitZero, type CommandRunner } from "../fixtures/clients/index.ts"; import { GatewayClient, HostCliClient, @@ -15,12 +15,12 @@ import { SandboxClient, StateClient, trustedProviderEndpoint, -} from "../framework/clients/index.ts"; +} from "../fixtures/clients/index.ts"; import type { ShellProbeResult, ShellProbeRunOptions, TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; interface RunnerCall { command: string; diff --git a/test/e2e-scenario/support-tests/e2e-fixture-context.test.ts b/test/e2e-scenario/support-tests/e2e-fixture-context.test.ts index c1f19c8e0b6..1e5cbc003d0 100644 --- a/test/e2e-scenario/support-tests/e2e-fixture-context.test.ts +++ b/test/e2e-scenario/support-tests/e2e-fixture-context.test.ts @@ -7,15 +7,15 @@ import path from "node:path"; import { describe, expect, expectTypeOf, it } from "vitest"; -import { ArtifactSink, createArtifactSink } from "../framework/artifacts.ts"; -import { assertCleanupPassed, CleanupRegistry } from "../framework/cleanup.ts"; -import { test as e2eTest } from "../framework/e2e-test.ts"; -import { SecretStore } from "../framework/secrets.ts"; +import { ArtifactSink, createArtifactSink } from "../fixtures/artifacts.ts"; +import { assertCleanupPassed, CleanupRegistry } from "../fixtures/cleanup.ts"; +import { test as e2eTest } from "../fixtures/e2e-test.ts"; +import { SecretStore } from "../fixtures/secrets.ts"; import { ShellProbe, trustedShellCommand, type TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; const delay = (ms: number): Promise => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/test/e2e-scenario/support-tests/e2e-live-project-config.test.ts b/test/e2e-scenario/support-tests/e2e-live-project-config.test.ts index 208cab1a438..4679999a8da 100644 --- a/test/e2e-scenario/support-tests/e2e-live-project-config.test.ts +++ b/test/e2e-scenario/support-tests/e2e-live-project-config.test.ts @@ -7,7 +7,7 @@ import { shouldRunBranchValidationE2E, shouldRunInstallerIntegration, shouldRunLiveE2EScenarios, -} from "../framework/live-project-gate.ts"; +} from "../fixtures/live-project-gate.ts"; import config from "../../../vitest.config.ts"; import { readYaml, type WorkflowStep } from "../../helpers/e2e-workflow-contract.ts"; diff --git a/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts b/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts index 0c5ffe1c9bb..c809e9880f1 100644 --- a/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts +++ b/test/e2e-scenario/support-tests/e2e-migration-policy.test.ts @@ -42,7 +42,7 @@ describe("E2E migration tracking policy", () => { expect(docs).toContain("machine-checkable boundary"); expect(docs).toContain("existing `.test.ts` file"); expect(docs).toContain("generated legacy assertion inventories"); - expect(docs).toContain("not a separate E2E framework or runner"); + expect(docs).toMatch(/not a test\s+harness or runner/); }); it("keeps durable taxonomy out of the repo-local migration docs", () => { diff --git a/test/e2e-scenario/support-tests/e2e-phase-environment.test.ts b/test/e2e-scenario/support-tests/e2e-phase-environment.test.ts index 59e10497355..acf00a359d5 100644 --- a/test/e2e-scenario/support-tests/e2e-phase-environment.test.ts +++ b/test/e2e-scenario/support-tests/e2e-phase-environment.test.ts @@ -7,15 +7,15 @@ import path from "node:path"; import { describe, expect, expectTypeOf, it } from "vitest"; -import { ArtifactSink } from "../framework/artifacts.ts"; -import { HostCliClient, type CommandRunner } from "../framework/clients/index.ts"; -import type { E2EScenarioFixtures } from "../framework/e2e-test.ts"; -import { EnvironmentPhaseFixture, type DockerRuntimeReady } from "../framework/phases/index.ts"; +import { ArtifactSink } from "../fixtures/artifacts.ts"; +import { HostCliClient, type CommandRunner } from "../fixtures/clients/index.ts"; +import type { E2EScenarioFixtures } from "../fixtures/e2e-test.ts"; +import { EnvironmentPhaseFixture, type DockerRuntimeReady } from "../fixtures/phases/index.ts"; import type { ShellProbeResult, ShellProbeRunOptions, TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; import type { ScenarioEnvironment } from "../scenarios/types.ts"; interface RunnerCall { diff --git a/test/e2e-scenario/support-tests/e2e-phase-lifecycle.test.ts b/test/e2e-scenario/support-tests/e2e-phase-lifecycle.test.ts index 16407719c6c..a960495412d 100644 --- a/test/e2e-scenario/support-tests/e2e-phase-lifecycle.test.ts +++ b/test/e2e-scenario/support-tests/e2e-phase-lifecycle.test.ts @@ -3,19 +3,19 @@ import { describe, expect, expectTypeOf, it } from "vitest"; -import { HostCliClient, SandboxClient, type CommandRunner } from "../framework/clients/index.ts"; -import type { E2EScenarioFixtures } from "../framework/e2e-test.ts"; +import { HostCliClient, SandboxClient, type CommandRunner } from "../fixtures/clients/index.ts"; +import type { E2EScenarioFixtures } from "../fixtures/e2e-test.ts"; import { buildBackupContainerName, LifecyclePhaseFixture, type LifecycleCleanup, -} from "../framework/phases/lifecycle.ts"; -import type { NemoClawInstance } from "../framework/phases/index.ts"; +} from "../fixtures/phases/lifecycle.ts"; +import type { NemoClawInstance } from "../fixtures/phases/index.ts"; import type { ShellProbeResult, ShellProbeRunOptions, TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; interface RunnerCall { command: string; diff --git a/test/e2e-scenario/support-tests/e2e-phase-onboarding.test.ts b/test/e2e-scenario/support-tests/e2e-phase-onboarding.test.ts index 7add981d6c5..7475fd0a9ff 100644 --- a/test/e2e-scenario/support-tests/e2e-phase-onboarding.test.ts +++ b/test/e2e-scenario/support-tests/e2e-phase-onboarding.test.ts @@ -6,16 +6,16 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; -import { ArtifactSink } from "../framework/artifacts.ts"; -import { HostCliClient, type CommandRunner } from "../framework/clients/index.ts"; -import type { E2EScenarioFixtures } from "../framework/e2e-test.ts"; -import { OnboardingPhaseFixture, type OnboardingSecrets } from "../framework/phases/index.ts"; -import type { EnvironmentReady } from "../framework/phases/index.ts"; +import { ArtifactSink } from "../fixtures/artifacts.ts"; +import { HostCliClient, type CommandRunner } from "../fixtures/clients/index.ts"; +import type { E2EScenarioFixtures } from "../fixtures/e2e-test.ts"; +import { OnboardingPhaseFixture, type OnboardingSecrets } from "../fixtures/phases/index.ts"; +import type { EnvironmentReady } from "../fixtures/phases/index.ts"; import type { ShellProbeResult, ShellProbeRunOptions, TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; interface RunnerCall { command: string; diff --git a/test/e2e-scenario/support-tests/e2e-phase-runtime.test.ts b/test/e2e-scenario/support-tests/e2e-phase-runtime.test.ts index 926c54b5fe7..4df3452eade 100644 --- a/test/e2e-scenario/support-tests/e2e-phase-runtime.test.ts +++ b/test/e2e-scenario/support-tests/e2e-phase-runtime.test.ts @@ -8,18 +8,18 @@ import { SandboxClient, trustedProviderEndpoint, type CommandRunner, -} from "../framework/clients/index.ts"; -import type { E2EScenarioFixtures } from "../framework/e2e-test.ts"; +} from "../fixtures/clients/index.ts"; +import type { E2EScenarioFixtures } from "../fixtures/e2e-test.ts"; import { inferenceRouteUrl, RuntimePhaseFixture, type NemoClawInstance, -} from "../framework/phases/index.ts"; +} from "../fixtures/phases/index.ts"; import type { ShellProbeResult, ShellProbeRunOptions, TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; interface RunnerCall { command: string; diff --git a/test/e2e-scenario/support-tests/e2e-phase-state-validation.test.ts b/test/e2e-scenario/support-tests/e2e-phase-state-validation.test.ts index ca69fc221b4..2cd437d0b90 100644 --- a/test/e2e-scenario/support-tests/e2e-phase-state-validation.test.ts +++ b/test/e2e-scenario/support-tests/e2e-phase-state-validation.test.ts @@ -7,20 +7,20 @@ import path from "node:path"; import { describe, expect, expectTypeOf, it } from "vitest"; -import { ArtifactSink } from "../framework/artifacts.ts"; +import { ArtifactSink } from "../fixtures/artifacts.ts"; import { GatewayClient, HostCliClient, SandboxClient, type CommandRunner, -} from "../framework/clients/index.ts"; -import type { E2EScenarioFixtures } from "../framework/e2e-test.ts"; -import { StateValidationPhaseFixture, type NemoClawInstance } from "../framework/phases/index.ts"; +} from "../fixtures/clients/index.ts"; +import type { E2EScenarioFixtures } from "../fixtures/e2e-test.ts"; +import { StateValidationPhaseFixture, type NemoClawInstance } from "../fixtures/phases/index.ts"; import type { ShellProbeResult, ShellProbeRunOptions, TrustedShellCommand, -} from "../framework/shell-probe.ts"; +} from "../fixtures/shell-probe.ts"; interface RunnerCall { command: string; diff --git a/test/e2e-scenario/support-tests/e2e-redaction-entry.test.ts b/test/e2e-scenario/support-tests/e2e-redaction-entry.test.ts index 28505531997..fd7fb9f5d8c 100644 --- a/test/e2e-scenario/support-tests/e2e-redaction-entry.test.ts +++ b/test/e2e-scenario/support-tests/e2e-redaction-entry.test.ts @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 /** - * Single-entry contract for the framework redactor. + * Single-entry contract for the fixture redactor. * * Both per-test explicit secret values and canonical secret-shape - * matches must flow through `redactString` so the framework has one + * matches must flow through `redactString` so the fixture layer has one * redaction entry point. This file asserts the contract so any future * helper that wants to add an explicit-value path stays inside the * canonical entry rather than introducing a parallel one. @@ -17,10 +17,10 @@ import { describe, expect, it } from "vitest"; -import { SecretStore } from "../framework/secrets.ts"; -import { redactString } from "../framework/redaction.ts"; +import { SecretStore } from "../fixtures/secrets.ts"; +import { redactString } from "../fixtures/redaction.ts"; -describe("framework redaction entry point", () => { +describe("fixture redaction entry point", () => { it("redacts explicit values with [REDACTED] and canonical shapes with ", () => { const explicit = "test-secret-aBcD"; const canonical = `nvapi-${"x".repeat(24)}`; diff --git a/test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts b/test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts index 8c90f313520..a42cb5643ed 100644 --- a/test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts +++ b/test/e2e-scenario/support-tests/e2e-redaction-parity.test.ts @@ -2,19 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 /** - * Parity test: the framework's local secret-pattern set - * (test/e2e-scenario/framework/redaction.ts) must stay in + * Parity test: the fixture layer's local secret-pattern set + * (test/e2e-scenario/fixtures/redaction.ts) must stay in * lockstep with the canonical product source * (src/lib/security/secret-patterns.ts). * - * The framework deliberately mirrors rather than imports — see the - * "Framework-local mirror" comment in redaction.ts for why — but the + * The fixture layer deliberately mirrors rather than imports — see the + * "Fixture-local mirror" comment in redaction.ts for why — but the * mirror is only safe if it is actually a mirror. This test imports * the RegExp arrays from both modules and compares them by behavior * (`.source` + `.flags`) rather than by source-text shape, so the * source-shape budget (ci/source-shape-test-budget.json) stays at 0. * - * The framework-runtime decoupling is preserved: redaction.ts itself + * The fixture-runtime decoupling is preserved: redaction.ts itself * does not import from src/lib/security/. Only this test crosses the * boundary, which is the entire point of a parity test. */ @@ -22,9 +22,9 @@ import { describe, expect, it } from "vitest"; import { - CONTEXT_PATTERNS as FRAMEWORK_CONTEXT_PATTERNS, - TOKEN_PREFIX_PATTERNS as FRAMEWORK_TOKEN_PREFIX_PATTERNS, -} from "../framework/redaction.ts"; + CONTEXT_PATTERNS as FIXTURE_CONTEXT_PATTERNS, + TOKEN_PREFIX_PATTERNS as FIXTURE_TOKEN_PREFIX_PATTERNS, +} from "../fixtures/redaction.ts"; import { CONTEXT_PATTERNS as PRODUCT_CONTEXT_PATTERNS, TOKEN_PREFIX_PATTERNS as PRODUCT_TOKEN_PREFIX_PATTERNS, @@ -34,20 +34,20 @@ function fingerprint(patterns: readonly RegExp[]): string[] { return patterns.map((re) => `${re.source}::${re.flags}`); } -describe("framework redaction parity with product source-of-truth", () => { - it("framework token prefix patterns match product token prefix patterns", () => { - const framework = fingerprint(FRAMEWORK_TOKEN_PREFIX_PATTERNS); +describe("fixture redaction parity with product source-of-truth", () => { + it("fixture token prefix patterns match product token prefix patterns", () => { + const fixture = fingerprint(FIXTURE_TOKEN_PREFIX_PATTERNS); const product = fingerprint(PRODUCT_TOKEN_PREFIX_PATTERNS); - expect(framework.length).toBeGreaterThan(0); + expect(fixture.length).toBeGreaterThan(0); expect(product.length).toBeGreaterThan(0); - expect(framework).toEqual(product); + expect(fixture).toEqual(product); }); - it("framework context patterns match product context patterns", () => { - const framework = fingerprint(FRAMEWORK_CONTEXT_PATTERNS); + it("fixture context patterns match product context patterns", () => { + const fixture = fingerprint(FIXTURE_CONTEXT_PATTERNS); const product = fingerprint(PRODUCT_CONTEXT_PATTERNS); - expect(framework.length).toBeGreaterThan(0); + expect(fixture.length).toBeGreaterThan(0); expect(product.length).toBeGreaterThan(0); - expect(framework).toEqual(product); + expect(fixture).toEqual(product); }); }); diff --git a/test/e2e-scenario/support-tests/e2e-shell-supervisor.test.ts b/test/e2e-scenario/support-tests/e2e-shell-supervisor.test.ts index 06e04ab1af8..35c031d1c7d 100644 --- a/test/e2e-scenario/support-tests/e2e-shell-supervisor.test.ts +++ b/test/e2e-scenario/support-tests/e2e-shell-supervisor.test.ts @@ -10,7 +10,7 @@ * with SIGTERM -> SIGKILL escalation, so a bash child that * ignores SIGTERM (e.g. `trap "" TERM`) still dies on timeout. * - * Both come from the leaf modules under framework/shell/, so the + * Both come from the leaf modules under fixtures/shell/, so the * assertions live here at the leaf level. The end-to-end behaviour * (orchestrator log redaction, fixture artifact persistence, probe * outcome mapping) stays covered by the existing support-tests @@ -20,12 +20,12 @@ import { spawn } from "node:child_process"; import { describe, expect, it } from "vitest"; -import { superviseChild } from "../framework/shell/supervisor.ts"; -import { trustedShellCommand, validateShellToken } from "../framework/shell/trusted-command.ts"; +import { superviseChild } from "../fixtures/shell/supervisor.ts"; +import { trustedShellCommand, validateShellToken } from "../fixtures/shell/trusted-command.ts"; const NUL = String.fromCharCode(0); -describe("framework/shell/trusted-command", () => { +describe("fixtures/shell/trusted-command", () => { it("validateShellToken rejects NUL bytes with a labelled error", () => { expect(() => validateShellToken(`a${NUL}b`, "argv[0]")).toThrowError( /argv\[0\] cannot contain NUL bytes/, @@ -68,7 +68,7 @@ describe("framework/shell/trusted-command", () => { }); }); -describe("framework/shell/supervisor", () => { +describe("fixtures/shell/supervisor", () => { it("returns exitCode 0 when the child exits cleanly", async () => { const child = spawn("bash", ["-c", "exit 0"], { detached: true, diff --git a/tools/e2e-advisor/scenarios.mts b/tools/e2e-advisor/scenarios.mts index e5156128362..0e20ae94d4d 100755 --- a/tools/e2e-advisor/scenarios.mts +++ b/tools/e2e-advisor/scenarios.mts @@ -233,7 +233,7 @@ export function buildSystemPrompt(schema: AdvisorSchema): string { "- `test/e2e-scenario/scenarios/registry.ts` and `test/e2e-scenario/scenarios/scenarios/` — typed scenario IDs and metadata.", "- `test/e2e-scenario/scenarios/runtime-support.ts` — which typed scenarios are wired for live Vitest execution.", "- `test/e2e-scenario/live/registry-scenarios.test.ts` — live Vitest registry scenario entry point.", - "- `test/e2e-scenario/framework/` and `test/e2e-scenario/support-tests/` — shared Vitest fixtures, clients, and phase helpers.", + "- `test/e2e-scenario/fixtures/` and `test/e2e-scenario/support-tests/` — shared Vitest fixtures, clients, and phase helpers.", "", "Decision policy:", "- Required (all scenarios): changes to scenario registry, matrix emission, expected-state metadata, live support classification, shared fixtures, or the Vitest scenario workflow itself. Recommend the `e2e-scenarios-all` fan-out through `e2e-vitest-scenarios.yaml`.", diff --git a/vitest.config.ts b/vitest.config.ts index f510748dcd5..05f57627ed6 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -7,7 +7,7 @@ import { shouldRunBranchValidationE2E, shouldRunInstallerIntegration, shouldRunLiveE2EScenarios, -} from "./test/e2e-scenario/framework/live-project-gate.ts"; +} from "./test/e2e-scenario/fixtures/live-project-gate.ts"; import { testTimeout } from "./test/helpers/timeouts"; const isGithubActions = process.env.GITHUB_ACTIONS === "true"; From e9b9be0cea8e5eeefa1827ae92aaeaea205626cf Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 06:32:38 -0700 Subject: [PATCH 8/9] test(e2e): migrate model router routed inference to Vitest --- .github/workflows/regression-e2e.yaml | 48 +++- ...l-router-provider-routed-inference.test.ts | 237 ++++++++++++++++++ ...-model-router-provider-routed-inference.sh | 196 --------------- test/regression-e2e-workflow.test.ts | 52 ++++ 4 files changed, 328 insertions(+), 205 deletions(-) create mode 100644 test/e2e-scenario/live/model-router-provider-routed-inference.test.ts delete mode 100755 test/e2e/test-model-router-provider-routed-inference.sh diff --git a/.github/workflows/regression-e2e.yaml b/.github/workflows/regression-e2e.yaml index 400ded2bae2..ec424d2135d 100644 --- a/.github/workflows/regression-e2e.yaml +++ b/.github/workflows/regression-e2e.yaml @@ -336,28 +336,58 @@ jobs: github.repository == 'NVIDIA/NemoClaw' && needs.select_regression_jobs.outputs.model_router_provider_routed_inference == 'true' runs-on: ubuntu-latest + permissions: + contents: read timeout-minutes: 45 steps: - name: Checkout uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + with: + node-version: "22" + cache: npm + + - name: Install root dependencies + run: npm ci --ignore-scripts + + - name: Build CLI + run: npm run build:cli - - name: Run Model Router provider-routed inference E2E test + - name: Install OpenShell + env: + NEMOCLAW_NON_INTERACTIVE: "1" + run: | + set -euo pipefail + bash scripts/install-openshell.sh + echo "${HOME}/.local/bin" >> "$GITHUB_PATH" + + - name: Run Model Router provider-routed inference Vitest E2E test env: NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }} NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - run: bash test/e2e/test-model-router-provider-routed-inference.sh + NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js + NEMOCLAW_RUN_E2E_SCENARIOS: "1" + E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/model-router-provider-routed-inference + run: | + set -euo pipefail + npx vitest run --project e2e-scenarios-live \ + test/e2e-scenario/live/model-router-provider-routed-inference.test.ts \ + --silent=false --reporter=default - - name: Upload Model Router provider-routed inference logs on failure - if: failure() + - name: Upload Model Router provider-routed inference artifacts + if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: model-router-provider-routed-inference-logs - path: | - /tmp/nemoclaw-e2e-model-router-onboard.log - /tmp/nemoclaw-e2e-model-router-health.log - /tmp/nemoclaw-e2e-model-router-response.log + name: model-router-provider-routed-inference-artifacts + path: e2e-artifacts/vitest/model-router-provider-routed-inference/ + include-hidden-files: false if-no-files-found: ignore + retention-days: 14 # ── OpenClaw plugin runtime-deps EXDEV E2E ───────────────────── # Coverage guard for #3513 / #3127. On Ubuntu/OpenShell sandbox layouts diff --git a/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts b/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts new file mode 100644 index 00000000000..674ebdd394b --- /dev/null +++ b/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts @@ -0,0 +1,237 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import fs from "node:fs"; +import path from "node:path"; + +import { expect, test } from "../framework/e2e-test.ts"; +import { shouldRunLiveE2EScenarios } from "../framework/live-project-gate.ts"; +import type { ShellProbeResult } from "../framework/shell-probe.ts"; + +// Migrated from test/e2e/test-model-router-provider-routed-inference.sh. This +// regression guard for #3255 provisions a real cloud-backed sandbox through the +// Model Router provider and proves inference.local returns a routed completion +// instead of HTTP 503 / "inference service unavailable" after onboard. + +const REPO_ROOT = path.resolve(import.meta.dirname, "../../.."); +const REPO_CLI = path.join(REPO_ROOT, "bin", "nemoclaw.js"); +const CLI_DIST_ENTRYPOINT = path.join(REPO_ROOT, "dist", "nemoclaw.js"); +const ONBOARD_TIMEOUT_MS = 1_500_000; +const HEALTH_TIMEOUT_MS = 15_000; +const COMPLETION_TIMEOUT_MS = 120_000; +const CLEANUP_TIMEOUT_MS = 180_000; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-model-router"; +const runModelRouterProviderRoutedTest = shouldRunLiveE2EScenarios() ? test : test.skip; + +process.env.NEMOCLAW_CLI_BIN ??= REPO_CLI; + +function resultText(result: ShellProbeResult): string { + return [result.stdout, result.stderr].filter(Boolean).join("\n"); +} + +function baseCommandEnv(extra: NodeJS.ProcessEnv = {}): NodeJS.ProcessEnv { + return { + PATH: process.env.PATH ?? "", + HOME: process.env.HOME ?? "", + TMPDIR: process.env.TMPDIR ?? "", + TEMP: process.env.TEMP ?? "", + TMP: process.env.TMP ?? "", + CI: process.env.CI ?? "", + GITHUB_ACTIONS: process.env.GITHUB_ACTIONS ?? "", + RUNNER_TEMP: process.env.RUNNER_TEMP ?? "", + RUNNER_TOOL_CACHE: process.env.RUNNER_TOOL_CACHE ?? "", + NEMOCLAW_CLI_BIN: REPO_CLI, + NEMOCLAW_NON_INTERACTIVE: "1", + NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1", + ...extra, + }; +} + +function wait(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function isHealthyModelRouter(raw: string): boolean { + return /"healthy_count"\s*:\s*[1-9]/.test(raw); +} + +function isServiceUnavailable(raw: string): boolean { + return /inference service unavailable|HTTP 503|healthy_count.*0/i.test(raw); +} + +function isMissingSandboxDelete(result: ShellProbeResult): boolean { + return /not found|no such sandbox|does not exist/i.test(resultText(result)); +} + +function isRoutedPongResponse(raw: string): boolean { + try { + const data = JSON.parse(raw) as { + model?: unknown; + choices?: Array<{ message?: { content?: unknown } }>; + }; + const model = String(data.model ?? ""); + const content = String(data.choices?.[0]?.message?.content ?? ""); + return ( + (model === "nvidia-routed" || model.startsWith("nvidia-routed")) && /\bPONG\b/i.test(content) + ); + } catch { + return false; + } +} + +runModelRouterProviderRoutedTest( + "model router provider-routed inference answers through inference.local", + { + timeout: ONBOARD_TIMEOUT_MS + 6 * 60_000, + }, + async ({ artifacts, cleanup, host, sandbox, secrets }) => { + const apiKey = secrets.optional("NVIDIA_API_KEY") ?? ""; + expect(apiKey, "NVIDIA_API_KEY must be set to a real NVIDIA API key").toMatch(/^nvapi-/); + + expect( + fs.existsSync(CLI_DIST_ENTRYPOINT), + "run `npm run build:cli` before live repo CLI scenarios", + ).toBe(true); + + await artifacts.writeJson("scenario.json", { + id: "model-router-provider-routed-inference", + runner: "vitest", + boundary: "live-model-router-provider", + migratedFrom: "test/e2e/test-model-router-provider-routed-inference.sh", + issue: 3255, + phases: [ + "docker-prerequisite", + "checkout-install", + "model-router-onboard", + "host-router-health", + "sandbox-inference-local-completion", + ], + }); + + const nonSecretEnv = baseCommandEnv({ + NVIDIA_API_KEY: "", + NEMOCLAW_PROVIDER_KEY: "", + }); + const routedEnv = baseCommandEnv({ + NEMOCLAW_PROVIDER_KEY: apiKey, + NEMOCLAW_SANDBOX_NAME: SANDBOX_NAME, + NEMOCLAW_POLICY_TIER: "open", + NEMOCLAW_PROVIDER: "routed", + NVIDIA_API_KEY: apiKey, + }); + + const docker = await host.command("docker", ["info"], { + artifactName: "model-router-provider-routed-docker-info", + env: nonSecretEnv, + timeoutMs: HEALTH_TIMEOUT_MS, + }); + expect(docker.exitCode, `Docker is required for this E2E\n${resultText(docker)}`).toBe(0); + + cleanup.add(`destroy NemoClaw sandbox ${SANDBOX_NAME}`, async () => { + if (process.env.NEMOCLAW_E2E_KEEP_SANDBOX === "1") return; + const result = await host.nemoclaw([SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "model-router-provider-routed-cleanup-destroy", + cwd: REPO_ROOT, + env: nonSecretEnv, + timeoutMs: CLEANUP_TIMEOUT_MS, + }); + if (result.exitCode !== 0 && !isMissingSandboxDelete(result)) { + throw new Error(`cleanup destroy failed\n${resultText(result)}`); + } + }); + + await host.nemoclaw([SANDBOX_NAME, "destroy", "--yes"], { + artifactName: "model-router-provider-routed-preclean-destroy", + cwd: REPO_ROOT, + env: nonSecretEnv, + timeoutMs: CLEANUP_TIMEOUT_MS, + }); + + const onboard = await host.nemoclaw( + ["onboard", "--fresh", "--non-interactive", "--yes-i-accept-third-party-software"], + { + artifactName: "model-router-provider-routed-onboard", + cwd: REPO_ROOT, + env: routedEnv, + redactionValues: [apiKey], + timeoutMs: ONBOARD_TIMEOUT_MS, + }, + ); + expect(onboard.exitCode, `Model Router onboard failed\n${resultText(onboard)}`).toBe(0); + + let health: ShellProbeResult | undefined; + for (let attempt = 1; attempt <= 20; attempt += 1) { + health = await host.command( + "curl", + ["-s", "--max-time", "10", "http://127.0.0.1:4000/health"], + { + artifactName: `model-router-provider-routed-health-${attempt}`, + env: nonSecretEnv, + timeoutMs: HEALTH_TIMEOUT_MS, + }, + ); + if (isHealthyModelRouter(health.stdout)) { + break; + } + await wait(3_000); + } + expect( + health && isHealthyModelRouter(health.stdout), + `model-router has no healthy endpoints\n${health ? resultText(health) : ""}`, + ).toBe(true); + + const payload = JSON.stringify({ + model: "nvidia-routed", + messages: [{ role: "user", content: "Reply with exactly one word: PONG" }], + max_tokens: 50, + }); + let completion: ShellProbeResult | undefined; + for (let attempt = 1; attempt <= 3; attempt += 1) { + completion = await sandbox.exec( + SANDBOX_NAME, + [ + "curl", + "-sk", + "--max-time", + "90", + "https://inference.local/v1/chat/completions", + "-H", + "Content-Type: application/json", + "-d", + payload, + ], + { + artifactName: `model-router-provider-routed-completion-${attempt}`, + env: nonSecretEnv, + timeoutMs: COMPLETION_TIMEOUT_MS, + }, + ); + if (isRoutedPongResponse(completion.stdout)) { + break; + } + if (isServiceUnavailable(completion.stdout) || isServiceUnavailable(completion.stderr)) { + break; + } + await wait(5_000); + } + + expect( + completion && isRoutedPongResponse(completion.stdout), + `Model Router inference.local did not return a routed completion\n${ + completion ? resultText(completion) : "" + }`, + ).toBe(true); + + await artifacts.writeJson("scenario-result.json", { + sandboxName: SANDBOX_NAME, + modelRouterHealthy: health ? isHealthyModelRouter(health.stdout) : false, + inferenceLocalRoutedCompletion: completion ? isRoutedPongResponse(completion.stdout) : false, + }); + if (health) { + await artifacts.writeText("logs/model-router-health.log", resultText(health)); + } + if (completion) { + await artifacts.writeText("logs/model-router-response.log", resultText(completion)); + } + }, +); diff --git a/test/e2e/test-model-router-provider-routed-inference.sh b/test/e2e/test-model-router-provider-routed-inference.sh deleted file mode 100755 index 4daf611cbce..00000000000 --- a/test/e2e/test-model-router-provider-routed-inference.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env bash -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Coverage guard for #3255 — Model Router (Provider Routed) onboard must -# produce a working inference.local route instead of HTTP 503. - -set -uo pipefail - -PASS=0 -FAIL=0 -TOTAL=0 - -pass() { - ((PASS++)) - ((TOTAL++)) - echo " OK: $1" -} -fail() { - ((FAIL++)) - ((TOTAL++)) - echo " ERROR: $1" -} -section() { - echo "" - printf '\033[1;36m=== %s ===\033[0m\n' "$1" -} -info() { printf '\033[1;34m [info]\033[0m %s\n' "$1"; } - -is_routed_pong_response() { - local raw="$1" - python3 - "$raw" <<'PY' -import json, re, sys -raw = sys.argv[1] -try: - data = json.loads(raw) -except Exception: - raise SystemExit(1) -model = str(data.get("model", "")) -choices = data.get("choices") or [] -content = "" -if choices and isinstance(choices[0], dict): - message = choices[0].get("message") or {} - content = str(message.get("content", "")) -ok_model = model == "nvidia-routed" or model.startswith("nvidia-routed") -ok_content = re.search(r"\bPONG\b", content, re.IGNORECASE) is not None -raise SystemExit(0 if ok_model and ok_content else 1) -PY -} - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -REPO="$(cd "${SCRIPT_DIR}/../.." && pwd)" -SANDBOX_NAME="${NEMOCLAW_SANDBOX_NAME:-e2e-model-router}" -ONBOARD_LOG="${E2E_MODEL_ROUTER_ONBOARD_LOG:-/tmp/nemoclaw-e2e-model-router-onboard.log}" -RESPONSE_LOG="${E2E_MODEL_ROUTER_RESPONSE_LOG:-/tmp/nemoclaw-e2e-model-router-response.log}" -HEALTH_LOG="${E2E_MODEL_ROUTER_HEALTH_LOG:-/tmp/nemoclaw-e2e-model-router-health.log}" -TIMEOUT_CMD="${TIMEOUT_CMD:-timeout}" - -# shellcheck source=test/e2e/lib/install-path-refresh.sh -. "${SCRIPT_DIR}/lib/install-path-refresh.sh" -# shellcheck source=test/e2e/lib/sandbox-teardown.sh -. "${SCRIPT_DIR}/lib/sandbox-teardown.sh" -register_sandbox_for_teardown "$SANDBOX_NAME" - -redact_file() { - local file="$1" - [ -f "$file" ] || return 0 - python3 - "$file" <<'PY' -import os, sys -path = sys.argv[1] -secrets = [os.environ.get("NVIDIA_API_KEY", ""), os.environ.get("NEMOCLAW_PROVIDER_KEY", "")] -text = open(path, "r", errors="replace").read() -for secret in filter(None, secrets): - text = text.replace(secret, "") -open(path, "w").write(text) -PY -} - -# shellcheck disable=SC2317,SC2329 # Invoked indirectly by the EXIT trap. -cleanup() { - local rc=$? - redact_file "$ONBOARD_LOG" - redact_file "$RESPONSE_LOG" - redact_file "$HEALTH_LOG" - if [ "${NEMOCLAW_E2E_KEEP_SANDBOX:-0}" != "1" ]; then - nemoclaw "$SANDBOX_NAME" destroy --yes >/dev/null 2>&1 || true - fi - exit "$rc" -} -trap cleanup EXIT # invoked by EXIT trap - -section "Prerequisites" -if docker info >/dev/null 2>&1; then - pass "Docker is running" -else - fail "Docker is not running" - exit 1 -fi - -if [ -n "${NVIDIA_API_KEY:-}" ] && [[ "${NVIDIA_API_KEY}" == nvapi-* ]]; then - pass "NVIDIA_API_KEY is set" -else - fail "NVIDIA_API_KEY is required and must start with nvapi-" - exit 1 -fi - -section "Install NemoClaw from checkout" -if ! command -v nemoclaw >/dev/null 2>&1; then - NEMOCLAW_NON_INTERACTIVE=1 \ - NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \ - bash "${REPO}/install.sh" --non-interactive --yes-i-accept-third-party-software >"$ONBOARD_LOG" 2>&1 || true - nemoclaw_refresh_install_env -fi - -if command -v nemoclaw >/dev/null 2>&1; then - pass "nemoclaw is available: $(nemoclaw --version 2>/dev/null || echo unknown)" -else - fail "nemoclaw not found after install" - exit 1 -fi - -section "Onboard with Model Router provider" -rm -f "$HOME/.nemoclaw/onboard.lock" 2>/dev/null || true -nemoclaw "$SANDBOX_NAME" destroy --yes >/dev/null 2>&1 || true - -env \ - NEMOCLAW_PROVIDER_KEY="$NVIDIA_API_KEY" \ - NEMOCLAW_SANDBOX_NAME="$SANDBOX_NAME" \ - NEMOCLAW_NON_INTERACTIVE=1 \ - NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \ - NEMOCLAW_POLICY_TIER="open" \ - NEMOCLAW_PROVIDER="routed" \ - NVIDIA_API_KEY="$NVIDIA_API_KEY" \ - "$TIMEOUT_CMD" 1500 nemoclaw onboard --fresh --non-interactive --yes-i-accept-third-party-software \ - >"$ONBOARD_LOG" 2>&1 -onboard_rc=$? -redact_file "$ONBOARD_LOG" -if [ "$onboard_rc" -eq 0 ]; then - pass "Model Router onboard completed" -else - fail "Model Router onboard failed (exit ${onboard_rc}); see ${ONBOARD_LOG}" - exit 1 -fi - -section "Host model-router health" -health="" -for _ in $(seq 1 20); do - health="$(curl -s --max-time 10 http://127.0.0.1:4000/health 2>&1 || true)" - printf '%s\n' "$health" >"$HEALTH_LOG" - redact_file "$HEALTH_LOG" - if echo "$health" | grep -Eq '"healthy_count"[[:space:]]*:[[:space:]]*[1-9]'; then - pass "model-router reports at least one healthy endpoint" - break - fi - sleep 3 -done -if ! echo "$health" | grep -Eq '"healthy_count"[[:space:]]*:[[:space:]]*[1-9]'; then - fail "model-router has no healthy endpoints; expected #3255 main-equivalent failure" - info "Health excerpt: $(head -c 500 "$HEALTH_LOG")" - exit 1 -fi - -section "Sandbox inference.local routed completion" -response="" -for _ in $(seq 1 3); do - response="$(openshell sandbox exec --name "$SANDBOX_NAME" -- \ - curl -sk --max-time 90 https://inference.local/v1/chat/completions \ - -H 'Content-Type: application/json' \ - -d '{"model":"nvidia-routed","messages":[{"role":"user","content":"Reply with exactly one word: PONG"}],"max_tokens":50}' \ - 2>&1 || true)" - printf '%s\n' "$response" >"$RESPONSE_LOG" - redact_file "$RESPONSE_LOG" - if is_routed_pong_response "$response"; then - pass "inference.local returned a routed Model Router completion" - break - fi - if echo "$response" | grep -qi 'inference service unavailable\|HTTP 503\|healthy_count.*0'; then - break - fi - sleep 5 -done - -if is_routed_pong_response "$response"; then - : -else - fail "Model Router inference.local did not return a routed completion; expected #3255 main-equivalent failure" - info "Response excerpt: $(head -c 500 "$RESPONSE_LOG")" - exit 1 -fi - -section "Summary" -if [ "$FAIL" -eq 0 ]; then - pass "Model Router provider-routed inference guard passed" - exit 0 -fi -exit 1 diff --git a/test/regression-e2e-workflow.test.ts b/test/regression-e2e-workflow.test.ts index 8a932973d2c..03ee97fd11a 100644 --- a/test/regression-e2e-workflow.test.ts +++ b/test/regression-e2e-workflow.test.ts @@ -36,4 +36,56 @@ describe("Regression E2E workflow contract", () => { expect(selectorScript).not.toContain("docker-unreachable-gateway-start-e2e"); expect(selectorScript).not.toContain("docker_unreachable_gateway_start"); }); + + it("runs model router provider-routed inference directly through Vitest artifacts", () => { + const jobsDescription = workflow.on?.workflow_dispatch?.inputs?.jobs?.description ?? ""; + const selectorScript = + workflow.jobs?.select_regression_jobs?.steps?.find((step) => step.id === "select")?.run ?? ""; + const job = workflow.jobs?.["model-router-provider-routed-inference-e2e"]; + const checkoutStep = job?.steps?.find((step) => + String(step.uses ?? "").startsWith("actions/checkout@"), + ); + const setupNodeStep = job?.steps?.find((step) => + String(step.uses ?? "").startsWith("actions/setup-node@"), + ); + const installStep = job?.steps?.find((step) => step.name === "Install root dependencies"); + const buildStep = job?.steps?.find((step) => step.name === "Build CLI"); + const installOpenShellStep = job?.steps?.find((step) => step.name === "Install OpenShell"); + const runStep = job?.steps?.find( + (step) => step.name === "Run Model Router provider-routed inference Vitest E2E test", + ); + const uploadStep = job?.steps?.find( + (step) => step.name === "Upload Model Router provider-routed inference artifacts", + ); + + expect(jobsDescription).toContain("model-router-provider-routed-inference-e2e"); + expect(selectorScript).toContain("model-router-provider-routed-inference-e2e"); + expect(selectorScript).toContain("model_router_provider_routed_inference=true"); + expect(checkoutStep?.with?.["persist-credentials"]).toBe(false); + expect(setupNodeStep?.uses).toMatch(/^actions\/setup-node@[0-9a-f]{40}$/); + expect(setupNodeStep?.with?.cache).toBe("npm"); + expect(installStep?.run).toBe("npm ci --ignore-scripts"); + expect(buildStep?.run).toBe("npm run build:cli"); + expect(installOpenShellStep?.run).toContain("bash scripts/install-openshell.sh"); + expect(installOpenShellStep?.run).toContain('echo "${HOME}/.local/bin" >> "$GITHUB_PATH"'); + expect(installOpenShellStep?.env?.NEMOCLAW_NON_INTERACTIVE).toBe("1"); + expect(runStep?.run).toContain("npx vitest run --project e2e-scenarios-live"); + expect(runStep?.run).toContain( + "test/e2e-scenario/live/model-router-provider-routed-inference.test.ts", + ); + expect(runStep?.run).not.toContain("test/e2e/test-model-router-provider-routed-inference.sh"); + expect(runStep?.env?.NVIDIA_API_KEY).toBe("${{ secrets.NVIDIA_API_KEY }}"); + expect(runStep?.env?.NEMOCLAW_CLI_BIN).toBe("${{ github.workspace }}/bin/nemoclaw.js"); + expect(runStep?.env?.NEMOCLAW_RUN_E2E_SCENARIOS).toBe("1"); + expect(runStep?.env?.E2E_ARTIFACT_DIR).toBe( + "${{ github.workspace }}/e2e-artifacts/vitest/model-router-provider-routed-inference", + ); + expect(uploadStep?.if).toBe("always()"); + expect(uploadStep?.with?.path).toBe( + "e2e-artifacts/vitest/model-router-provider-routed-inference/", + ); + expect(uploadStep?.with?.["include-hidden-files"]).toBe(false); + expect(uploadStep?.with?.["if-no-files-found"]).toBe("ignore"); + expect(uploadStep?.with?.["retention-days"]).toBe(14); + }); }); From 2e736de92a692fe6c38f73be54299f4501b8b5f7 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Wed, 10 Jun 2026 09:18:57 -0700 Subject: [PATCH 9/9] test(e2e): refresh fixture imports --- .../live/model-router-provider-routed-inference.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts b/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts index 674ebdd394b..0f92b53e0ee 100644 --- a/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts +++ b/test/e2e-scenario/live/model-router-provider-routed-inference.test.ts @@ -4,9 +4,9 @@ import fs from "node:fs"; import path from "node:path"; -import { expect, test } from "../framework/e2e-test.ts"; -import { shouldRunLiveE2EScenarios } from "../framework/live-project-gate.ts"; -import type { ShellProbeResult } from "../framework/shell-probe.ts"; +import { expect, test } from "../fixtures/e2e-test.ts"; +import { shouldRunLiveE2EScenarios } from "../fixtures/live-project-gate.ts"; +import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; // Migrated from test/e2e/test-model-router-provider-routed-inference.sh. This // regression guard for #3255 provisions a real cloud-backed sandbox through the