feat(ultraplan-local): extend brief-validator to accept type:ultrareview
This commit is contained in:
parent
f6e61e92cd
commit
1c22452e81
2 changed files with 80 additions and 3 deletions
|
|
@ -92,3 +92,63 @@ test('validateBrief — missing frontmatter is hard error', () => {
|
|||
assert.equal(r.valid, false);
|
||||
assert.ok(r.errors.find(e => e.code === 'FM_MISSING'));
|
||||
});
|
||||
|
||||
const REVIEW_AS_BRIEF = `---
|
||||
type: ultrareview
|
||||
task: "Review delivered ultrareview-local v1.0"
|
||||
slug: ultrareview-local
|
||||
project_dir: .claude/projects/2026-05-01-ultrareview-local/
|
||||
findings:
|
||||
- 0123456789abcdef0123456789abcdef01234567
|
||||
- fedcba9876543210fedcba9876543210fedcba98
|
||||
---
|
||||
|
||||
# Review brief
|
||||
|
||||
## Intent
|
||||
|
||||
Adversarial review of delivered ultrareview-local v1.0.
|
||||
|
||||
## Goal
|
||||
|
||||
Find what was missed.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- All BLOCKER findings get a fix-plan.
|
||||
`;
|
||||
|
||||
test('validateBrief — ultrareview type accepted with findings array', () => {
|
||||
const r = validateBriefContent(REVIEW_AS_BRIEF, { strict: true });
|
||||
assert.equal(r.valid, true, JSON.stringify(r.errors));
|
||||
});
|
||||
|
||||
test('validateBrief — ultrareview without findings rejected (BRIEF_MISSING_FIELD)', () => {
|
||||
const t = REVIEW_AS_BRIEF.replace(/findings:\n - 0123[\s\S]*?- fedcba[0-9a-f]+\n/, '');
|
||||
const r = validateBriefContent(t);
|
||||
assert.equal(r.valid, false);
|
||||
assert.ok(
|
||||
r.errors.find(e => e.code === 'BRIEF_MISSING_FIELD' && /findings/.test(e.message)),
|
||||
`expected BRIEF_MISSING_FIELD for findings; got ${JSON.stringify(r.errors)}`,
|
||||
);
|
||||
});
|
||||
|
||||
test('validateBrief — ultrareview with findings as scalar (not array) rejected (BRIEF_BAD_FINDINGS_TYPE)', () => {
|
||||
const t = REVIEW_AS_BRIEF.replace(
|
||||
/findings:\n - 0123[\s\S]*?- fedcba[0-9a-f]+/,
|
||||
'findings: not-an-array',
|
||||
);
|
||||
const r = validateBriefContent(t);
|
||||
assert.equal(r.valid, false);
|
||||
assert.ok(r.errors.find(e => e.code === 'BRIEF_BAD_FINDINGS_TYPE'));
|
||||
});
|
||||
|
||||
test('validateBrief — wrong-type error message includes accepted set', () => {
|
||||
const t = REVIEW_AS_BRIEF.replace('type: ultrareview', 'type: somethingelse');
|
||||
const r = validateBriefContent(t);
|
||||
assert.equal(r.valid, false);
|
||||
const wrongType = r.errors.find(e => e.code === 'BRIEF_WRONG_TYPE');
|
||||
assert.ok(wrongType);
|
||||
assert.ok(/ultrabrief/.test(wrongType.message));
|
||||
assert.ok(/ultrareview/.test(wrongType.message));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue