fix(plan): a 1.9 plan refuses placeholders and mixed-case bare names as files

Operator decision 22 (13.10); review finding 33f37f53.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-13 12:50:20 +02:00
commit 48b57284fe
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
3 changed files with 50 additions and 6 deletions

View file

@ -329,3 +329,41 @@ test('1.9: two unmarked File lines in a row give both tests', () => {
const text = planTestFirst19('1.9', ' File: `tests/mod1.test.mjs`\n File: `tests/mod1b.test.mjs`');
assert.deepEqual(schema.testFirstFiles(step1Fields(text), '1.9'), ['tests/mod1.test.mjs', 'tests/mod1b.test.mjs']);
});
// ---- Step 4 (trial 4): a 1.9 plan refuses a placeholder and a mixed-case bare
// name as a file (operator decision 22, 13.10; review 33f37f53) ----
test('1.9: isPathShape is false for a placeholder and a mixed-case bare name, true for a capitals name and ./Name', () => {
for (const s of ['None', 'none', 'TBD', 'TODO', 'TBA', 'N/A', 'n/a', 'NA', '...', 'Parser']) {
assert.equal(schema.isPathShape(s), false, s);
}
for (const s of ['LICENSE', 'README', 'Makefile', './Parser', 'TBC', 'NULL']) assert.equal(schema.isPathShape(s), true, s);
});
test('1.9: a Files entry that is a backticked None or TBD is PLAN_STEP_PATH_NOT_A_PATH under --strict, a warning under --soft', () => {
for (const files of ['`None`', '`TBD`']) {
const text = plan19(files);
const strict = validatePlanContent(text);
assert.equal(strict.valid, false, `${files}: ${errCodes(strict).join(',')}`);
const e = strict.errors.find((i) => i.code === 'PLAN_STEP_PATH_NOT_A_PATH');
assert.ok(e, `${files}: ${errCodes(strict).join(',')}`);
assert.match(e.message, /Step 1/);
assert.match(e.hint, /placeholder/i);
assert.match(e.hint, /TBD/);
assert.match(e.hint, /\.\/Name/);
const soft = validatePlanContent(text, { strict: false });
assert.ok(warnCodes(soft).includes('PLAN_STEP_PATH_NOT_A_PATH'), `${files}: ${warnCodes(soft).join(',')}`);
assert.deepEqual(pathIssues(soft.errors), []);
}
});
test('1.9: a Test first File line naming TBD gives no test, and K6 does not plan it', () => {
const text = planTestFirst19('1.9', ' - File: `TBD`');
assert.ok(text.includes(' - File: `TBD`\n'), 'the builder writes the raw File line');
assert.deepEqual(schema.testFirstFiles(step1Fields(text), '1.9'), []);
assert.ok(!plannedPaths(text).includes('TBD'), JSON.stringify(plannedPaths(text)));
});
test('below 1.9: fieldPaths of a backticked None still returns it (6.3.1\'s answer)', () => {
assert.deepEqual(schema.fieldPaths('`None`'), ['None']);
});