fix(plan): a 1.9 Test first names its test only on a line that opens with File:
The step check read File: anywhere on the Test first lines, so a 1.9 plan whose only File: stood mid-line validated while the executor, K6 and the red proof read no test file. From 1.9 checkSteps reads the test the way testFirstFiles does; below 1.9 it reads as before (decision 16). Found by the step 5 controller in /trekexecute --session 2; fixed on the operator's decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
64e6771c8b
commit
3009c5eddb
3 changed files with 61 additions and 8 deletions
|
|
@ -227,3 +227,45 @@ test('1.9: the red proof\'s tests_only reads Files by the grammar (CLI, temp git
|
|||
}
|
||||
} finally { rmSync(repo, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
// The validator reads the step's test the way the executor does (S139): from
|
||||
// 1.9 `Test first:` names its test only through a line that opens with
|
||||
// `File:` and its backticked path (testFirstFiles), so a `File:` mid-line is
|
||||
// no test. Below 1.9 the step check is read as before (decision 16).
|
||||
const planTestFirst19 = (version, line) =>
|
||||
buildPlan({ version, steps: [{ testFirstRaw: line }, { endToEnd: 'bash tests/e2e.sh' }] });
|
||||
|
||||
test('1.9: a Test first whose File: stands mid-line names no test - PLAN_STEP_NO_TEST_FIRST under --strict, a warning under --soft', () => {
|
||||
for (const line of [
|
||||
' - see File: `tests/mod1.test.mjs` for the test',
|
||||
' - Pattern: File: `tests/mod1.test.mjs`',
|
||||
]) {
|
||||
const text = planTestFirst19('1.9', line);
|
||||
assert.ok(text.includes(`${line}\n`), 'the builder writes the raw File line');
|
||||
assert.deepEqual(schema.testFirstFiles(schema.parseStepFields(text.split('### Step 1:')[1].split('### Step 2:')[0]), '1.9'), [],
|
||||
'the executor reads no test file here');
|
||||
const r = validatePlanContent(text, { strict: true });
|
||||
assert.equal(r.valid, false, `${line}: ${errCodes(r).join(',')}`);
|
||||
const no = r.errors.filter((e) => e.code === 'PLAN_STEP_NO_TEST_FIRST');
|
||||
assert.equal(no.length, 1, `${line}: ${errCodes(r).join(',')}`);
|
||||
assert.match(no[0].message, /Step 1/);
|
||||
const soft = validatePlanContent(text, { strict: false });
|
||||
assert.ok(warnCodes(soft).includes('PLAN_STEP_NO_TEST_FIRST'), `${line}: ${warnCodes(soft).join(',')}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('1.9: a File: line that opens the line names its test - no PLAN_STEP_NO_TEST_FIRST', () => {
|
||||
for (const line of [
|
||||
' - File: `tests/mod1.test.mjs` (new)',
|
||||
' - **File:** `tests/mod1.test.mjs` *(new)*',
|
||||
' - File: `tests/mod1.test.mjs`, `tests/mod1b.test.mjs` (new)',
|
||||
]) {
|
||||
const r = validatePlanContent(planTestFirst19('1.9', line), { strict: true });
|
||||
assert.equal(r.errors.find((e) => e.code === 'PLAN_STEP_NO_TEST_FIRST'), undefined, `${line}: ${errCodes(r).join(',')}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('below 1.9: the step check reads a mid-line File: as before', () => {
|
||||
const r = validatePlanContent(planTestFirst19('1.8', ' - see File: `tests/mod1.test.mjs` for the test'), { strict: true });
|
||||
assert.equal(r.errors.find((e) => e.code === 'PLAN_STEP_NO_TEST_FIRST'), undefined, errCodes(r).join(','));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue