From 515712944ead469ce48a59c37f930000301ba24d Mon Sep 17 00:00:00 2001 From: Cristhofer Pincetti Date: Sat, 3 Oct 2026 15:07:56 -0300 Subject: [PATCH 01/16] test: make Node and repo-root checks hold across patch bumps and worktrees - stock-pi: assert the Node major meets SUPPORT_MATRIX.node.minimum instead of an exact patch version, so a 24.x patch bump no longer fails the suite. - extension: drop assertCurrentNode (same exact-patch probe). - doctor AR-14: repoRoot resolved one level above the checkout, so the nested `bun test` ran whatever tests lived in the parent directory (fails inside worktrees). Resolve from the test dir, assert the target suites exist, and drop handoff.test.ts/sdd.test.ts, which were deleted long ago. Co-Authored-By: Claude Opus 5.5 --- test/workit-core/doctor.test.ts | 12 +++++------- test/workit-pi/extension.test.ts | 7 ------- test/workit-pi/stock-pi.test.ts | 5 +++-- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/test/workit-core/doctor.test.ts b/test/workit-core/doctor.test.ts index 05f5d811..db6c74d3 100644 --- a/test/workit-core/doctor.test.ts +++ b/test/workit-core/doctor.test.ts @@ -80,7 +80,7 @@ const runInstaller = (overrides: { env?: NodeJS.ProcessEnv; cwd?: string } = {}) installer: true, }); -const repoRoot = path.resolve(path.dirname(import.meta.dir), "..", ".."); +const repoRoot = path.resolve(import.meta.dir, "..", ".."); // Fix helpers mutate a file then restore the original content at teardown. const writeConfig = (p: string, content: string, mode?: number) => { @@ -1733,12 +1733,10 @@ test("reports managed_content_conflict when managed bytes drift from cutover rec test( "AR-14: negative fixtures never leak raw git usage/fatal dumps into the suite output", () => { - const noisy = [ - "test/workit-core/handoff.test.ts", - "test/workit-core/sdd.test.ts", - "test/workit-core/repo.test.ts", - ]; - const r = spawnSync("bun", ["test", ...noisy], { + // Suites whose fixtures run git against missing revisions and non-repos. + const noisy = ["test/workit-core/repo.test.ts", "test/workit-core/typescript-parity.test.ts"]; + for (const file of noisy) expect(existsSync(path.join(repoRoot, file)), file).toBe(true); + const r = spawnSync("bun", ["test", ...noisy.map((file) => `./${file}`)], { cwd: repoRoot, encoding: "utf8", timeout: 300_000, diff --git a/test/workit-pi/extension.test.ts b/test/workit-pi/extension.test.ts index 55c00fec..c8a45bae 100644 --- a/test/workit-pi/extension.test.ts +++ b/test/workit-pi/extension.test.ts @@ -9,7 +9,6 @@ import { OPERATION_SCHEMA_MAX_DEPTH, type OperationContext, } from "@/packages/workit-core/src/core"; -import { SUPPORT_MATRIX } from "@/packages/workit-core/src/core/support-matrix"; import extension, { persistUncertainCancel } from "@/packages/workit-pi/extensions/workit"; import { nativeWorkerForEvidence } from "@/packages/workit-pi/src/worker"; import { piCapabilities } from "@/packages/workit-pi/src/context"; @@ -109,11 +108,6 @@ const decisionInput = (root: string) => { const nodeExecutable = "node"; -const assertCurrentNode = () => { - const result = spawnSync(nodeExecutable, ["--version"], { encoding: "utf8" }); - if (result.status !== 0) throw new Error(result.stderr || result.stdout); - expect(result.stdout.trim()).toBe(`v${SUPPORT_MATRIX.node.current}`); -}; test("clean Pi package declares stock discovery and the eight families plus external action", async () => { const manifest = JSON.parse( @@ -1022,7 +1016,6 @@ test("stock Pi discovers the package manifest through its local package manager" const home = path.join(stage, "home"); mkdirSync(home); const env = { ...process.env, PI_CODING_AGENT_DIR: agentDir, HOME: home }; - assertCurrentNode(); const packed = spawnSync( "npm", ["pack", "--json", "--workspace", packageRoot, "--pack-destination", stage], diff --git a/test/workit-pi/stock-pi.test.ts b/test/workit-pi/stock-pi.test.ts index 4380e5e2..021f665a 100644 --- a/test/workit-pi/stock-pi.test.ts +++ b/test/workit-pi/stock-pi.test.ts @@ -9,10 +9,11 @@ import { taskStartRequest } from "@/test/workit-core/task-fixtures"; const node = "node"; -test("stock Node runtime is the supported current line for Pi workers", () => { +test("stock Node runtime meets the supported major line for Pi workers", () => { const result = spawnSync(node, ["--version"], { encoding: "utf8" }); expect(result.status).toBe(0); - expect(result.stdout.trim()).toBe("v" + SUPPORT_MATRIX.node.current); + const major = Number(/^v(\d+)\./.exec(result.stdout.trim())?.[1]); + expect(major).toBeGreaterThanOrEqual(Number(SUPPORT_MATRIX.node.minimum)); }); test( From 4f8f56bdf8416b66a29eb5dfa457f076d3f09623 Mon Sep 17 00:00:00 2001 From: Cristhofer Pincetti Date: Sat, 3 Oct 2026 15:08:01 -0300 Subject: [PATCH 02/16] test: delete the phase-9 traceability gate phase-9-traceability.test.ts (485 lines) mapped POST-xx/AR-xx/CA-xx rows of the archived reliability-overhaul plan to "file::exact test name" strings and required the stale branch feature/workit-reliability-overhaul. It asserted document cross-references, not product behavior: it failed on test renames or plan edits and forced a head_ref checkout in CI. Every behavior it pointed at keeps its own test. Co-Authored-By: Claude Opus 5.5 --- test/artifacts/phase-9-traceability.test.ts | 485 -------------------- 1 file changed, 485 deletions(-) delete mode 100644 test/artifacts/phase-9-traceability.test.ts diff --git a/test/artifacts/phase-9-traceability.test.ts b/test/artifacts/phase-9-traceability.test.ts deleted file mode 100644 index 401f43c4..00000000 --- a/test/artifacts/phase-9-traceability.test.ts +++ /dev/null @@ -1,485 +0,0 @@ -import { expect, test } from "bun:test"; -import { spawnSync } from "node:child_process"; -import { existsSync, readFileSync } from "node:fs"; -import path from "node:path"; -import { REPO_ROOT } from "@/test/shared/helpers/packages"; - -const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); - -// Task 31 Phase 9 traceability gate (AR-15, CA-44, CA-45): every post-audit -// finding (POST-01..15), every AR row (AR-01..15), and every Phase 9 -// acceptance criterion (CA-33..45) maps to an exact test file+case or an -// exact command. A row is prose-only when its evidence target does not exist; -// the gate fails naming those rows. Evidence for behavior proven by Tasks -// 24-30 is referenced here, never re-implemented. - -const DECLARED_BRANCH = "feature/workit-reliability-overhaul"; -const PLAN = path.join(REPO_ROOT, "docs", "workit-reliability-overhaul", "plan.md"); -const SPEC = path.join(REPO_ROOT, "docs", "workit-reliability-overhaul", "spec.md"); - -type Row = { row: string; requirement: string; evidence: string[] }; - -// Evidence grammar: "test-file::exact test name" resolves against the named -// test file; "command:bun run