From 9479fe07bd94f4aa76fb73077ac6bc143bcfac64 Mon Sep 17 00:00:00 2001 From: Tibsfox Date: Mon, 6 Apr 2026 22:40:29 -0700 Subject: [PATCH] fix(test): update file path consistency tests for inputs-only checking The fix changed checkFilePathConsistency to only check task.inputs, not task.files, since files includes paths the task will create. Update tests to use inputs instead of files for consistency checks. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../gsd/tests/pre-execution-checks.test.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts b/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts index c9b18f24a..86fc8c5f6 100644 --- a/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +++ b/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts @@ -193,7 +193,7 @@ describe("checkFilePathConsistency", () => { } }); - test("fails when files don't exist and not in prior outputs", () => { + test("fails when inputs don't exist and not in prior outputs", () => { tempDir = join(tmpdir(), `pre-exec-test-${Date.now()}`); mkdirSync(tempDir, { recursive: true }); @@ -201,8 +201,8 @@ describe("checkFilePathConsistency", () => { const tasks = [ createTask({ id: "T01", - files: ["nonexistent.ts"], - inputs: [], + files: [], + inputs: ["nonexistent.ts"], expected_output: [], }), ]; @@ -218,7 +218,7 @@ describe("checkFilePathConsistency", () => { } }); - test("checks both files and inputs arrays", () => { + test("checks only inputs array, not files array", () => { tempDir = join(tmpdir(), `pre-exec-test-${Date.now()}`); mkdirSync(tempDir, { recursive: true }); @@ -232,10 +232,13 @@ describe("checkFilePathConsistency", () => { }), ]; + // Only inputs are checked — files ("files likely touched") are excluded + // because they may include files the task will create (#3626) const results = checkFilePathConsistency(tasks, tempDir); - assert.equal(results.length, 2); - assert.ok(results.some((r) => r.target === "missing-file.ts")); + assert.equal(results.length, 1); assert.ok(results.some((r) => r.target === "missing-input.ts")); + // missing-file.ts should NOT produce a failure + assert.ok(!results.some((r) => r.target === "missing-file.ts")); } finally { rmSync(tempDir, { recursive: true, force: true }); } @@ -825,8 +828,8 @@ describe("runPreExecutionChecks", () => { const tasks = [ createTask({ id: "T01", - files: ["nonexistent.ts"], - inputs: [], + files: [], + inputs: ["nonexistent.ts"], expected_output: [], }), ];