feat(sdk): flag headings missing the result field (#3184)
Cycle 12 of ~15: heading-without-result-line was previously silently dropped by the regex — meaning a phase with an unfilled UAT item could falsely pass the predicate. We now scan for orphan headings and emit ORPHAN_ITEM_MISSING_RESULT so the operator's typo / unfilled-template is surfaced.
This commit is contained in:
@@ -306,6 +306,39 @@ result: pass
|
||||
}
|
||||
});
|
||||
|
||||
it("emits ORPHAN_ITEM_MISSING_RESULT reason for headings missing the result field", async () => {
|
||||
const localTmp = await mkdtemp(join(tmpdir(), 'gsd-uat-c12-'));
|
||||
try {
|
||||
const phaseDir = join(localTmp, '.planning', 'phases', '05-orphan-heading');
|
||||
await mkdir(phaseDir, { recursive: true });
|
||||
const content = `---
|
||||
status: complete
|
||||
phase: 5
|
||||
source: roadmap
|
||||
started: 2026-05-18T00:00:00Z
|
||||
updated: 2026-05-18T00:00:00Z
|
||||
---
|
||||
|
||||
### 1. Forgot to fill this in
|
||||
expected: something
|
||||
|
||||
### 2. Real one
|
||||
expected: works
|
||||
result: pass
|
||||
`;
|
||||
await writeFile(join(phaseDir, '05-HUMAN-UAT.md'), content);
|
||||
|
||||
const result = await isPhaseUatPassed(localTmp, '5');
|
||||
expect(result.passed).toBe(false);
|
||||
expect(result.items.length).toBe(1);
|
||||
expect(result.reasons.length).toBe(1);
|
||||
expect(result.reasons[0].code).toBe(REASON_CODE.ORPHAN_ITEM_MISSING_RESULT);
|
||||
expect(result.reasons[0].itemName).toBe('Forgot to fill this in');
|
||||
} finally {
|
||||
await rm(localTmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("emits CASE_MISMATCH reason when result value is \"PASS\" (uppercase variant of pass)", async () => {
|
||||
const localTmp = await mkdtemp(join(tmpdir(), 'gsd-uat-c10-'));
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user