fix(gsd): ignore prose inputs in pre-exec checks
This commit is contained in:
parent
23f1e72868
commit
3f407b0ec4
2 changed files with 52 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue