ce2333e309
Aggregates C1/C2/C3 outputs via execFileSync (Security Guidance #40 compliant — uses fixed args array, no shell injection surface) + observer episode count. Behavioral rule embedded in metric copy. Per ADR-011 + spec §6.4. 3 Vitest tests GREEN (31/31 total). Smoke run rebuilds STATUS.md with current state: - C1 🔴 (l1-watcher surfaces 9 plugins in settings not formalized in Tooling Прил. Н by exact name@source — see commit4382de3) - C2 🔴 (cross-ref-checker surfaces noise from 'наследие' headers — see commita780959DWC) - C3 ✅ (0 weeks since last read) - C4 ✅ (this file) Both 🔴 states surface known pre-existing drift (not regressions). C5 lefthook wiring will handle WARN-vs-FAIL semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { renderStatus } from './status-md-generator.mjs';
|
|
|
|
describe('renderStatus', () => {
|
|
it('renders all 4 controllers + metrics', () => {
|
|
const inputs = {
|
|
now: '2026-05-19T10:00:00+03:00',
|
|
c1: { status: 'ok', detail: 'no drift' },
|
|
c2: { status: 'ok', detail: '0 version drift' },
|
|
c3: { status: 'ok', detail: 'last read today, 54w remaining' },
|
|
observer: { episodeCount: 12, piiMatches: 0 },
|
|
};
|
|
const md = renderStatus(inputs);
|
|
expect(md).toContain('# Brain Status');
|
|
expect(md).toContain('| C1 L1-watcher | ✅');
|
|
expect(md).toContain('| C2 Cross-ref consistency | ✅');
|
|
expect(md).toContain('| C3 Observer-of-observer | ✅');
|
|
expect(md).toContain('| C4 Сигнальный статус | ✅');
|
|
expect(md).toContain('12 episodes');
|
|
});
|
|
|
|
it('shows red status for failing controllers', () => {
|
|
const inputs = {
|
|
now: '2026-05-19T10:00:00+03:00',
|
|
c1: { status: 'fail', detail: '2 plugins not formalized' },
|
|
c2: { status: 'ok', detail: '' },
|
|
c3: { status: 'ok', detail: '' },
|
|
observer: { episodeCount: 0, piiMatches: 0 },
|
|
};
|
|
expect(renderStatus(inputs)).toContain('| C1 L1-watcher | 🔴');
|
|
});
|
|
|
|
it('mentions capability-readiness behavioral rule', () => {
|
|
const inputs = {
|
|
now: '2026-05-19T10:00:00+03:00',
|
|
c1: { status: 'ok' }, c2: { status: 'ok' }, c3: { status: 'ok' },
|
|
observer: { episodeCount: 0, piiMatches: 0 },
|
|
};
|
|
const md = renderStatus(inputs);
|
|
expect(md).toContain('capability-readiness');
|
|
expect(md).toContain('feedback_brain_unused_tools_not_problem');
|
|
});
|
|
});
|