feat(sdk): accept bold-prefixed **result:** key (#3184)
Cycle 9 of ~15: regex now matches both bare 'result:' and bold-prefixed '**result:**' forms. Requester used the bold form in the issue text; canonical template uses bare. Both are equally valid; predicate is form-agnostic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -243,4 +243,33 @@ result: pass
|
||||
await rm(localTmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('parses bold-prefixed **result:** key as equivalent to bare result:', async () => {
|
||||
const localTmp = await mkdtemp(join(tmpdir(), 'gsd-uat-c9-'));
|
||||
try {
|
||||
const phaseDir = join(localTmp, '.planning', 'phases', '05-bold-key');
|
||||
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. Bold-key item
|
||||
expected: thing
|
||||
**result:** pass
|
||||
`;
|
||||
await writeFile(join(phaseDir, '05-HUMAN-UAT.md'), content);
|
||||
|
||||
const result = await isPhaseUatPassed(localTmp, '5');
|
||||
expect(result.items.length).toBe(1);
|
||||
expect(result.items[0].name).toBe('Bold-key item');
|
||||
expect(result.items[0].result).toBe('pass');
|
||||
expect(result.passed).toBe(true);
|
||||
} finally {
|
||||
await rm(localTmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,9 +24,10 @@ export type UatReason = {
|
||||
capturedValue?: string;
|
||||
};
|
||||
|
||||
/** Regex to parse all UAT items regardless of result value. */
|
||||
/** Regex to parse all UAT items regardless of result value.
|
||||
* Accepts optional bold markers (**key:**) around expected/result keys. */
|
||||
const UAT_ITEM_PATTERN =
|
||||
/###\s*(\d+)\.\s*([^\n]+)\nexpected:\s*([^\n]+)\nresult:\s*(\w+)/g;
|
||||
/###\s*(\d+)\.\s*([^\n]+)\n(?:\*\*)?expected:(?:\*\*)?\s*([^\n]+)\n(?:\*\*)?result:(?:\*\*)?\s*(\w+)/g;
|
||||
|
||||
interface UatItem {
|
||||
test: number;
|
||||
|
||||
Reference in New Issue
Block a user