b917360e9b
Phase 1 Task 4 of LLM-first router overhaul. Aggressive scope per user choice (AskUserQuestion 2026-05-25). Pravila changes: - §12 (lines 678-748) extracted to docs/archive/.../pravila-12/, body replaced by 1-paragraph placeholder pointing to §17 (Task 5) + ADR-016. - §0 priority chain dropped §12, added forward note about §17. - §16.4 cross-refs migrated: tools/observer-classification-map.json -> docs/registry/nodes.yaml + buildClassificationMap; tools/.node-dormancy.json -> nodes.yaml status field + buildDormancyMap. - §16.5 hard-rule list: §12 -> §17. Code refactor (preserves test green): - tools/observer-coverage-checker.mjs + observer-transcript-parser.mjs switched from readFileSync(.json) to loadRegistry + adapter. - 9/9 + 154/154 GREEN. git mv into archive/routing-docs/: - tools/observer-classification-map.json, .node-dormancy.json, extract-node-dormancy.mjs, extract-node-dormancy.test.mjs. lefthook.yml: job 12b removed. Memory (user-level, cp+add-f): - feedback_superpowers_hard_rule.md, feedback_feature_via_writing_plans.md copied to archive/memory/. MEMORY.md user-level updated. Plan deviations (TASKLOG.md): - registry-to-classification-map.mjs KEEP (4+ active consumers). - routing-off-phase.md NOT ARCHIVED (auto-generated derivative). - router-procedure.md deferred. Verification: vitest tools/ 539 passed (baseline 543 -7 dormancy +3 rollback). Rollback: node tools/test-rollback.mjs --execute + git reset --hard brain-pre-llm-bootstrap. Plan: docs/superpowers/plans/2026-05-25-llm-first-router-overhaul.md Task 4. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
54 lines
2.4 KiB
JavaScript
54 lines
2.4 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { extractDormancy } from './extract-node-dormancy.mjs';
|
|
|
|
describe('extractDormancy', () => {
|
|
it('returns false for a live row (dormant=false, no DEFERRED in boundaries)', () => {
|
|
const md = [
|
|
'#### #10 Laravel Boost',
|
|
'',
|
|
'**Атрибуты:**',
|
|
'',
|
|
'| id | name | kind | phase | subcategory | triggers | boundaries | dormant | last-touched |',
|
|
'|---|---|---|---|---|---|---|---|---|',
|
|
'| #10 | Laravel Boost | composer-dep | 1 | — | «SQL, Eloquent» | replaces #1 PG MCP | false | 2026-05-19 |',
|
|
].join('\n');
|
|
expect(extractDormancy(md)).toEqual({ '#10': false });
|
|
});
|
|
|
|
it('returns true when Tooling marks dormant=true', () => {
|
|
const md = '| #17 | pg_partman | binary-dep | 1 | — | «partition mgmt» | none | true | 2026-05-19 |';
|
|
expect(extractDormancy(md)).toEqual({ '#17': true });
|
|
});
|
|
|
|
it('returns true when boundaries contains DEFERRED (even if dormant=false)', () => {
|
|
const md = '| #44 | Figma MCP | mcp | off-phase | design-tooling | «figma extract» | DEFERRED — нет Figma-аккаунта | false | 2026-05-19 |';
|
|
expect(extractDormancy(md)).toEqual({ '#44': true });
|
|
});
|
|
|
|
it('handles multiple nodes in one pass (mixed signals)', () => {
|
|
const md = [
|
|
'| #44 | Figma MCP | mcp | off-phase | design-tooling | «figma extract» | DEFERRED — нет Figma | false | 2026-05-17 |',
|
|
'| #45 | Universal Icons MCP | mcp | off-phase | design-tooling | «svg search» | non-Lucide | false | 2026-05-17 |',
|
|
].join('\n');
|
|
expect(extractDormancy(md)).toEqual({ '#44': true, '#45': false });
|
|
});
|
|
|
|
it('ignores header/separator rows', () => {
|
|
const md = [
|
|
'| id | name | kind | phase | subcategory | triggers | boundaries | dormant | last-touched |',
|
|
'|---|---|---|---|---|---|---|---|---|',
|
|
].join('\n');
|
|
expect(extractDormancy(md)).toEqual({});
|
|
});
|
|
|
|
it('ignores non-numeric ids (template placeholders)', () => {
|
|
const md = '| #NN | <name> | <kind> | <phase> | <subcat or —> | «<triggers>» | <ADR-NNN or none> | false | 2026-05-19 |';
|
|
expect(extractDormancy(md)).toEqual({});
|
|
});
|
|
|
|
it('does NOT match the word DEFERRED inside a longer token (boundary check)', () => {
|
|
const md = '| #99 | fake | mcp | off | tooling | «t» | NODEFERREDX prefix | false | 2026-05-19 |';
|
|
expect(extractDormancy(md)).toEqual({ '#99': false });
|
|
});
|
|
});
|