Merge pull request #3991 from mastertyko/fix/3910-plan-slice-prose-inputs

fix(gsd): ignore prose inputs in pre-exec checks
This commit is contained in:
Jeremy McSpadden 2026-04-11 22:52:34 -05:00 committed by GitHub
commit 80416f0859
2 changed files with 52 additions and 0 deletions

View file

@ -280,6 +280,38 @@ function extractPathFromAnnotation(raw: string): string {
return trimmed.replace(/`/g, "");
}
/**
* Planning units sometimes use task.inputs for prose like "Current enum shape"
* instead of concrete file paths. Those entries should not fail path checks.
* Keep validation for anything that still looks like a real file reference:
* explicit backticks, globs, separators, dot-paths, or single-token basenames
* like Dockerfile.
*/
function shouldValidateInputAsPath(raw: string): boolean {
const trimmed = raw.trim();
if (!trimmed) return false;
if (/^`+[^`]+`+/.test(trimmed)) {
return true;
}
const candidate = extractPathFromAnnotation(trimmed);
if (!candidate) return false;
if (!/\s/.test(candidate)) {
return true;
}
return (
candidate.startsWith("/") ||
candidate.startsWith("./") ||
candidate.startsWith("../") ||
candidate.startsWith("~/") ||
/[\\/]/.test(candidate) ||
/[*?[\]{}]/.test(candidate)
);
}
/**
* Build a set of files that will be created by tasks up to (but not including) taskIndex.
* All paths are normalized for consistent comparison.
@ -318,6 +350,7 @@ export function checkFilePathConsistency(
for (const file of filesToCheck) {
// Skip empty strings
if (!file.trim()) continue;
if (!shouldValidateInputAsPath(file)) continue;
// Normalize path for consistent comparison
const normalizedFile = normalizeFilePath(file);
@ -378,6 +411,8 @@ export function checkTaskOrdering(
const filesToCheck = [...task.inputs];
for (const file of filesToCheck) {
if (!shouldValidateInputAsPath(file)) continue;
const normalizedFile = normalizeFilePath(file);
const creator = fileCreators.get(normalizedFile);
if (creator && creator.index > i) {

View file

@ -1175,6 +1175,23 @@ describe("checkFilePathConsistency additional edge cases", () => {
assert.equal(results![0].blocking, true);
});
test("multi-word prose inputs are ignored by path consistency checks", () => {
const tasks = [
createTask({
id: "T01",
files: [],
inputs: [
"Current WIZARD_PRODUCTS enum",
"Existing test patterns in wizard.test.ts",
],
expected_output: [],
}),
];
const results = checkFilePathConsistency(tasks, "/tmp");
assert.equal(results.length, 0, "Prose planning hints should not be treated as missing file paths");
});
test("empty inputs array produces no results", () => {
// A task with no inputs and only files should produce zero results from
// consistency check — files are not checked (#3626).