feat(ultraplan-local): Spor 1 wave 2 — 5 validators + doc-consistency, 108 tests grønn [skip-docs]
5 nye validator-moduler (alle m/ CLI-shim for invokering fra commands): - brief-validator.mjs — frontmatter (type, brief_version, task, slug, research_topics, research_status), state machine (research_topics > 0 + skipped requires brief_quality: partial), body sections (Intent/Goal/Success Criteria) - research-validator.mjs — type=ultraresearch-brief, confidence ∈ [0,1], dimensions ≥ 1, body sections, --dir mode for batch validering - plan-validator.mjs — wrapper over plan-schema + manifest-yaml; håndhever step-count == manifest-count, plan_version=1.7 - progress-validator.mjs — schema_version, status enum, current_step in range, step shape, checkResumeReadiness - architecture-discovery.mjs — EKSTERN KONTRAKT: drift-WARN ikke drift-FAIL; tolererer non-canonical filnavn, surfacer loose files som warnings Doc-consistency-test pinning prose vs source-of-truth: - agents/*.md count == CLAUDE.md agent-tabell rader - commands/*.md mentioned i CLAUDE.md - command frontmatter.name == filnavn - templates/plan-template.md plan_version 1.7 invariant - settings.json kun kjente scopes (ultraplan, ultraresearch) - settings.json ingen exploration eller agentTeam (vestigial guard etter Spor 0) - CLAUDE.md refererer alle 4 pipeline-commands Wave 1 + Wave 2 = 108 tester grønn. [skip-docs]: Test-infrastrukturen er ikke user-facing før Spor 1 wiring lander; README/CLAUDE.md oppdateres når commands faktisk endrer atferd (neste commit). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
7219a5fe20
commit
65c9242160
11 changed files with 999 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
import { test } from 'node:test';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import { validateResearchContent } from '../../lib/validators/research-validator.mjs';
|
||||
|
||||
const GOOD = `---
|
||||
type: ultraresearch-brief
|
||||
created: 2026-04-30
|
||||
question: "How to do X?"
|
||||
confidence: 0.8
|
||||
dimensions: 3
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
3 sentences.
|
||||
|
||||
## Dimensions
|
||||
|
||||
### Dim A — Confidence: high
|
||||
`;
|
||||
|
||||
test('validateResearch — happy path', () => {
|
||||
const r = validateResearchContent(GOOD);
|
||||
assert.equal(r.valid, true, JSON.stringify(r.errors));
|
||||
});
|
||||
|
||||
test('validateResearch — wrong type', () => {
|
||||
const t = GOOD.replace('type: ultraresearch-brief', 'type: random');
|
||||
const r = validateResearchContent(t);
|
||||
assert.equal(r.valid, false);
|
||||
assert.ok(r.errors.find(e => e.code === 'RESEARCH_WRONG_TYPE'));
|
||||
});
|
||||
|
||||
test('validateResearch — confidence out of range', () => {
|
||||
const t = GOOD.replace('confidence: 0.8', 'confidence: 1.5');
|
||||
const r = validateResearchContent(t);
|
||||
assert.equal(r.valid, false);
|
||||
assert.ok(r.errors.find(e => e.code === 'RESEARCH_BAD_CONFIDENCE'));
|
||||
});
|
||||
|
||||
test('validateResearch — missing confidence is warning, not error', () => {
|
||||
const t = GOOD.replace(/^confidence: 0\.8\n/m, '');
|
||||
const r = validateResearchContent(t);
|
||||
assert.equal(r.valid, true);
|
||||
assert.ok(r.warnings.find(w => w.code === 'RESEARCH_NO_CONFIDENCE'));
|
||||
});
|
||||
|
||||
test('validateResearch — strict missing body section is error', () => {
|
||||
const t = GOOD.replace(/## Dimensions\n\n### Dim A — Confidence: high\n/, '');
|
||||
const r = validateResearchContent(t, { strict: true });
|
||||
assert.equal(r.valid, false);
|
||||
assert.ok(r.errors.find(e => e.code === 'RESEARCH_MISSING_SECTION'));
|
||||
});
|
||||
|
||||
test('validateResearch — bad dimensions value', () => {
|
||||
const t = GOOD.replace('dimensions: 3', 'dimensions: 0');
|
||||
const r = validateResearchContent(t);
|
||||
assert.equal(r.valid, false);
|
||||
assert.ok(r.errors.find(e => e.code === 'RESEARCH_BAD_DIMENSIONS'));
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue