* fix(#2844): verify-summary binds file-claim extraction to a creation-claim context
verify-summary's Pattern 1 matched any backticked path-like token with no
context check, so a prose mention of a future deliverable (`shared/types.ts`
in a 'next phase will add…' sentence) was checked for existence and its absence
failed the verdict on a healthy phase. #2685 added shape filtering but no
context check.
- src/verify.cts: both extraction patterns now require a claim label on the line
(Created/Modified/Added/Updated/Edited/key-files). A bare prose mention no
longer matches; genuine labeled claims still do.
- gsd-core/bin/gsd-tools.cjs: remove 'verify-summary' from SKIP_ROOT_RESOLUTION
so relative claim paths resolve against the project root, not the raw cwd
(subdirectory invocation no longer manufactures missing files).
Regression tests: prose mention not treated as a claim; prose-only SUMMARY
passes; absent claimed file still fails.
* chore(#2844): backfill changeset PR 2910
---------
Co-authored-by: Test <test@example.com>
(cherry picked from commit 42f4f184c0)
This commit is contained in:
@@ -920,6 +920,70 @@ describe('verify summary command', () => {
|
||||
`Expected checked <= 1, got ${output.checks.files_created.checked}`
|
||||
);
|
||||
});
|
||||
|
||||
// #2844: a prose MENTION of a path (not a creation claim) must not be treated
|
||||
// as a file claim. Pre-fix Pattern 1 matched any backticked path-like token, so
|
||||
// `shared/types.ts` in a "next phase will add…" sentence was checked for
|
||||
// existence and its absence failed the verdict on a healthy phase.
|
||||
test('#2844 a prose path mention is not treated as a missing file claim', () => {
|
||||
// Real created file exists.
|
||||
fs.mkdirSync(path.join(tmpDir, 'src'), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, 'src', 'real.ts'), 'export const x = 1;\n');
|
||||
const summaryPath = path.join(tmpDir, '.planning', 'phases', '01-test', '01-01-SUMMARY.md');
|
||||
fs.writeFileSync(summaryPath, [
|
||||
'# Summary',
|
||||
'',
|
||||
'This phase investigated the schema surface.',
|
||||
'', // PROSE mention — NOT a creation claim; shared/types.ts does NOT exist.
|
||||
'Next phase will add `shared/types.ts` for the shared schema.',
|
||||
'',
|
||||
'Created: `src/real.ts`',
|
||||
].join('\n'));
|
||||
|
||||
const result = runGsdTools('verify-summary .planning/phases/01-test/01-01-SUMMARY.md', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output.passed, true,
|
||||
`prose mention must not fail the verdict; errors: ${JSON.stringify(output.errors)}`);
|
||||
assert.ok(!JSON.stringify(output.checks.files_created.missing).includes('shared/types.ts'),
|
||||
'shared/types.ts (a prose mention, absent) must NOT be reported missing');
|
||||
});
|
||||
|
||||
test('#2844 a SUMMARY with only future/prose path mentions passes', () => {
|
||||
// The mentioned paths are FUTURE deliverables (not produced this phase) and
|
||||
// are absent — they must not be probed. isFutureMention excludes the lines.
|
||||
const summaryPath = path.join(tmpDir, '.planning', 'phases', '01-test', '01-01-SUMMARY.md');
|
||||
fs.writeFileSync(summaryPath, [
|
||||
'# Summary',
|
||||
'',
|
||||
'Investigation only. No artifacts created this phase.',
|
||||
'`docs/schema.md` is planned for a later phase.',
|
||||
'Next phase will add `shared/types.ts` for the shared schema.',
|
||||
].join('\n'));
|
||||
|
||||
const result = runGsdTools('verify-summary .planning/phases/01-test/01-01-SUMMARY.md', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output.passed, true,
|
||||
`future/prose mentions must not fail the verdict; errors: ${JSON.stringify(output.errors)}`);
|
||||
});
|
||||
|
||||
test('#2844 negative-space: a real Created claim for an ABSENT file still fails', () => {
|
||||
// src/missing.ts is claimed but does NOT exist — must still be caught.
|
||||
const summaryPath = path.join(tmpDir, '.planning', 'phases', '01-test', '01-01-SUMMARY.md');
|
||||
fs.writeFileSync(summaryPath, [
|
||||
'# Summary',
|
||||
'',
|
||||
'Created: `src/missing.ts`',
|
||||
].join('\n'));
|
||||
|
||||
const result = runGsdTools('verify-summary .planning/phases/01-test/01-01-SUMMARY.md', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
const output = JSON.parse(result.output);
|
||||
assert.strictEqual(output.passed, false, 'an absent claimed file must fail the verdict');
|
||||
assert.ok(JSON.stringify(output.checks.files_created.missing).includes('src/missing.ts'),
|
||||
'src/missing.ts must be reported missing');
|
||||
});
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user