3578f38b45
Заменил pilot chains (L1 brainstorming-skill / L8 TDD-skill) на полные 16 цепочек из routing-off-phase.md §4 v1.6: L1 feature discovery & implementation L2 system orientation L3 as-is ↔ to-be process L4 diagram rendering L5 architecture triangle L6 security layered L7 integration development L8 runtime debug (Sentry+Redis+systematic-debug) L9 project management L10 LLM feature L11 Claude infra extension L12 CLAUDE.md capture L13 finance chain L14 backend-quality chain L15 security go-live chain L16 marketing chain chain_membership обновлён на каждом участвующем узле (sorted). Pilot L1/L8 переопределены под routing-off-phase: #19 Superpowers больше не в L1/L8; #18 Pest перенесён в L13. Task 9 закрывает Phase B плана (Task 8+9). Task 10 - render check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
81 lines
2.8 KiB
JavaScript
81 lines
2.8 KiB
JavaScript
// tools/registry-load.test.mjs
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import { loadRegistry, clearCache, findByClassification, findByKeyword, findActiveNodes, findChainsByNode } from './registry-load.mjs';
|
|
|
|
describe('registry-load', () => {
|
|
beforeEach(() => clearCache());
|
|
|
|
it('loads registry (83 nodes after task 8d)', () => {
|
|
const r = loadRegistry();
|
|
expect(r.nodes).toHaveLength(83);
|
|
expect(r.version).toBe('0.1.0');
|
|
});
|
|
|
|
it('indexes by classification', () => {
|
|
const r = loadRegistry();
|
|
const features = findByClassification(r, 'feature');
|
|
expect(features).toHaveLength(1);
|
|
expect(features[0].node.id).toBe('#19');
|
|
expect(features[0].weight).toBe(1.0);
|
|
});
|
|
|
|
it('returns empty array for unknown classification', () => {
|
|
const r = loadRegistry();
|
|
expect(findByClassification(r, 'nonexistent')).toEqual([]);
|
|
});
|
|
|
|
it('indexes by keyword case-insensitive', () => {
|
|
const r = loadRegistry();
|
|
expect(findByKeyword(r, 'tdd')).toHaveLength(1);
|
|
expect(findByKeyword(r, 'TDD')).toHaveLength(1);
|
|
});
|
|
|
|
it('excludes historic/dormant from trigger index', () => {
|
|
const r = loadRegistry();
|
|
// #1 PostgreSQL MCP — historic, не должен попасть в индексы
|
|
for (const entries of r.indexByTrigger.values()) {
|
|
expect(entries.find(e => e.node.id === '#1')).toBeUndefined();
|
|
}
|
|
});
|
|
|
|
it('includes historic in nodes array (full reference)', () => {
|
|
const r = loadRegistry();
|
|
expect(r.indexById.get('#1').status).toBe('historic');
|
|
});
|
|
|
|
it('findActiveNodes excludes non-active', () => {
|
|
const r = loadRegistry();
|
|
const active = findActiveNodes(r);
|
|
// After task 8d: 83 nodes total; #1 historic, #17 dormant, #44/#50/#54/#67/#82/#83 deferred → 75 active
|
|
expect(active).toHaveLength(75);
|
|
expect(active.map(n => n.id)).toContain('#18');
|
|
expect(active.map(n => n.id)).toContain('#19');
|
|
expect(active.map(n => n.id)).not.toContain('#1');
|
|
expect(active.map(n => n.id)).not.toContain('#17');
|
|
});
|
|
|
|
it('findChainsByNode returns chain membership', () => {
|
|
const r = loadRegistry();
|
|
// L8 = runtime debug chain: systematic-debugging + Sentry (#34) + Redis (#35)
|
|
const sentryChains = findChainsByNode(r, '#34');
|
|
expect(sentryChains.map(c => c.chainId)).toContain('L8');
|
|
});
|
|
|
|
it('caches across calls in same process', () => {
|
|
const r1 = loadRegistry();
|
|
const r2 = loadRegistry();
|
|
expect(r1).toBe(r2); // same reference
|
|
});
|
|
|
|
it('clearCache forces reload', () => {
|
|
const r1 = loadRegistry();
|
|
clearCache();
|
|
const r2 = loadRegistry();
|
|
expect(r1).not.toBe(r2);
|
|
});
|
|
|
|
it('throws on schema violation', () => {
|
|
expect(() => loadRegistry({ registryPath: '/nonexistent/path.yaml', useCache: false })).toThrow();
|
|
});
|
|
});
|