From cc19584cc418ca5b7c0db79d319f66f337c9bac9 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Sun, 23 Aug 2026 18:34:39 -0700 Subject: [PATCH] test: stop the quality-runner self-tests from re-entering the suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These cases live in the `api:curated` lane and spawned `pnpm --filter @fusion/dashboard test` — the very command whose lanes they were running inside. Under a full 15-lane run that child had to resolve pnpm through Corepack while other lanes held the machine, and it intermittently produced nothing at all: the lane log came back empty, the assertion read "0 lanes launched", and a test about the orchestrator failed with no orchestrator defect involved. Seen in both `--all --no-fail-fast` runs today; the file passed alone every time. An earlier attempt only set COREPACK_ENABLE_DOWNLOAD_PROMPT=0, which removed the visible Corepack line but not the failure — the child still produced no output. That fix is replaced rather than kept. They now invoke `node scripts/run-quality-tests.mjs` directly. Every assertion is unchanged (lane names, the 15-lane count, fail-fast labelling, `--` passthrough, which parseArgs already unit-tests), and the one thing the pnpm spawn uniquely proved — that the package script actually points at this orchestrator — is now asserted directly against package.json. Co-Authored-By: Claude Opus 5 --- .../__tests__/run-quality-tests.test.ts | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/packages/dashboard/scripts/__tests__/run-quality-tests.test.ts b/packages/dashboard/scripts/__tests__/run-quality-tests.test.ts index 4dc24583d1..10b6d633c0 100644 --- a/packages/dashboard/scripts/__tests__/run-quality-tests.test.ts +++ b/packages/dashboard/scripts/__tests__/run-quality-tests.test.ts @@ -10,6 +10,23 @@ import { describe, expect, it } from "vitest"; const __dirname = dirname(fileURLToPath(import.meta.url)); const workspaceRoot = resolve(__dirname, "../../../.."); const fixtureRunnerPath = join(__dirname, "quality-runner-fixture.mjs"); +const dashboardRoot = resolve(__dirname, "../.."); +const orchestratorPath = join(dashboardRoot, "scripts/run-quality-tests.mjs"); + +/* +FNXC:QualityRunnerSelfTest 2026-08-23-19:35: +THE ORCHESTRATOR IS INVOKED DIRECTLY, NOT THROUGH `pnpm ... test`. These cases run inside the very +lane set they describe (`api:curated`), so spawning the package command re-entered the suite from +within itself. Under a full 15-lane run that child had to resolve pnpm through Corepack while other +lanes held the machine, and it intermittently produced NOTHING — an empty lane log read as "0 lanes +launched" and failed an assertion about the orchestrator, with no orchestrator defect involved. +Observed twice on 2026-08-23 in `--all --no-fail-fast` runs; both times the file passed alone. + +Running `node scripts/run-quality-tests.mjs` keeps every assertion below (lane names, lane count, +fail-fast labelling, `--` passthrough — parseArgs is unit-tested above) while removing the pnpm +dependency and the recursion. The one thing the pnpm spawn additionally proved, that the package +script actually points at this orchestrator, is asserted directly in "package.json wires…" below. +*/ interface QualityLane { name: string; @@ -155,28 +172,25 @@ describe("dashboard quality orchestrator", () => { expect(() => parseArgs(["--", "--not-a-quality-option"])).toThrow("Unknown argument: --not-a-quality-option"); }); + it("package.json wires the dashboard test script at this orchestrator", () => { + /* The cases below invoke scripts/run-quality-tests.mjs directly, so this is what proves the + package command still reaches it — the one assertion the removed pnpm spawn uniquely carried. */ + const pkg = JSON.parse(readFileSync(join(dashboardRoot, "package.json"), "utf8")) as { scripts?: Record }; + expect(pkg.scripts?.test).toContain("scripts/run-quality-tests.mjs"); + }); + it.each(["--all", "--no-fail-fast"])("runs package aggregate alias %s through all 15 lanes without hiding failures", async (aggregateAlias) => { const { qualityLanes } = await loadModule(); const temporaryDirectory = mkdtempSync(join(tmpdir(), "fn-8714-quality-runner-")); const laneLogPath = join(temporaryDirectory, "lanes.log"); try { - const result = spawnSync("pnpm", ["--filter", "@fusion/dashboard", "test", "--", aggregateAlias], { - cwd: workspaceRoot, + const result = spawnSync(process.execPath, [orchestratorPath, "--", aggregateAlias], { + cwd: dashboardRoot, encoding: "utf8", env: { ...process.env, npm_config_ignore_scripts: "true", - /* - FNXC:QualityRunnerSelfTest 2026-08-23-19:20: - These cases spawn the package's OWN `pnpm ... test` command, so the child inherits Corepack. - Inside a full lane run the child hit Corepack's interactive prompt - ("! Corepack is about to download .../pnpm-10.33.0.tgz"), never launched, and the lane log - came back empty — the assertion then read 0 launched projects and failed. It passed when the - file was run alone only because that shell had already resolved pnpm. Disable the prompt so - the child resolves pnpm non-interactively; this changes nothing about what is asserted. - */ - COREPACK_ENABLE_DOWNLOAD_PROMPT: "0", FUSION_DASHBOARD_TEST_CONCURRENCY: "1", FUSION_DASHBOARD_QUALITY_TEST_MODE: "1", FUSION_DASHBOARD_QUALITY_RUNNER: fixtureRunnerPath, @@ -206,8 +220,8 @@ describe("dashboard quality orchestrator", () => { const laneLogPath = join(temporaryDirectory, "lanes.log"); try { - const result = spawnSync("pnpm", ["--filter", "@fusion/dashboard", "test"], { - cwd: workspaceRoot, + const result = spawnSync(process.execPath, [orchestratorPath], { + cwd: dashboardRoot, encoding: "utf8", env: { ...process.env,