mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-12 03:48:38 +00:00
fix: schema + test count fixes after rebase onto v1.6.2-rc.9
- Add StateSlot: 'inert' to registration-table.ts (satisfies NodeLabel record) - Add state-slots.ts pipeline phase (wires StateSlot detection into pipeline-phases architecture) - Fix phase progress name 'stateSlots' → 'state-slots' in state-slots.ts - Bump NODE_TABLES count 31→32, NODE_SCHEMA_QUERIES 31→32, SCHEMA_QUERIES 33→34 - Bump GITNEXUS_TOOLS count 16→17 (data_flow tool added by feature) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f883867b9e
commit
970a7cc033
4 changed files with 86 additions and 7 deletions
|
|
@ -182,6 +182,7 @@ const LABEL_BEHAVIOR = {
|
|||
Section: 'inert',
|
||||
Route: 'inert',
|
||||
Tool: 'inert',
|
||||
StateSlot: 'inert',
|
||||
} as const satisfies Record<NodeLabel, LabelBehavior> &
|
||||
// Cross-invariant 1 — every class-like label (participates in
|
||||
// qualifiedName fallback in `SymbolTable.add()`) MUST be classified as
|
||||
|
|
|
|||
78
gitnexus/src/core/ingestion/pipeline-phases/state-slots.ts
Normal file
78
gitnexus/src/core/ingestion/pipeline-phases/state-slots.ts
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* Phase: stateSlots
|
||||
*
|
||||
* Detects state slot patterns (React Query, SWR, Redux, Zustand, tRPC, etc.)
|
||||
* across all source files and creates StateSlot nodes + PRODUCES/CONSUMES edges.
|
||||
*
|
||||
* @deps crossFile
|
||||
* @reads scannedFiles (file paths + sizes), graph (symbol nodes for edge creation)
|
||||
* @writes graph (StateSlot nodes, PRODUCES edges, CONSUMES edges)
|
||||
* @output slotsCreated, producesEdges, consumesEdges, overlapWarnings
|
||||
*/
|
||||
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import type { PipelinePhase, PipelineContext, PhaseResult } from './types.js';
|
||||
import { getPhaseOutput } from './types.js';
|
||||
import type { StructureOutput } from './structure.js';
|
||||
import { detectStateSlots } from '../state-slot-detectors/index.js';
|
||||
import { processStateSlots, type StateSlotProcessorResult } from '../state-slot-processor.js';
|
||||
import { isDev } from '../utils/env.js';
|
||||
|
||||
export interface StateSlotsOutput {
|
||||
stateSlotsResult: StateSlotProcessorResult;
|
||||
}
|
||||
|
||||
export const stateSlotsPhase: PipelinePhase<StateSlotsOutput> = {
|
||||
name: 'stateSlots',
|
||||
deps: ['crossFile'],
|
||||
|
||||
async execute(
|
||||
ctx: PipelineContext,
|
||||
deps: ReadonlyMap<string, PhaseResult<unknown>>,
|
||||
): Promise<StateSlotsOutput> {
|
||||
const { scannedFiles, totalFiles } = getPhaseOutput<StructureOutput>(deps, 'structure');
|
||||
|
||||
ctx.onProgress({
|
||||
phase: 'state-slots',
|
||||
percent: 92,
|
||||
message: 'Detecting state slots...',
|
||||
stats: { filesProcessed: 0, totalFiles, nodesCreated: ctx.graph.nodeCount },
|
||||
});
|
||||
|
||||
// Run detectors over all files
|
||||
const allSlots = [];
|
||||
let filesProcessed = 0;
|
||||
|
||||
for (const file of scannedFiles) {
|
||||
let content: string;
|
||||
try {
|
||||
content = await readFile(file.path, 'utf8');
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
const slots = detectStateSlots(content, file.path);
|
||||
if (slots.length > 0) allSlots.push(...slots);
|
||||
filesProcessed++;
|
||||
}
|
||||
|
||||
ctx.onProgress({
|
||||
phase: 'state-slots',
|
||||
percent: 93,
|
||||
message: `Processing ${allSlots.length} state slot(s)...`,
|
||||
stats: { filesProcessed, totalFiles, nodesCreated: ctx.graph.nodeCount },
|
||||
});
|
||||
|
||||
const stateSlotsResult = processStateSlots(allSlots, ctx.graph);
|
||||
|
||||
if (isDev) {
|
||||
console.log(
|
||||
`🗂 State slots: ${stateSlotsResult.slotsCreated} slots, ` +
|
||||
`${stateSlotsResult.producesEdges} PRODUCES, ` +
|
||||
`${stateSlotsResult.consumesEdges} CONSUMES, ` +
|
||||
`${stateSlotsResult.overlapWarnings.length} overlap warnings`,
|
||||
);
|
||||
}
|
||||
|
||||
return { stateSlotsResult };
|
||||
},
|
||||
};
|
||||
|
|
@ -68,8 +68,8 @@ describe('LadybugDB Schema', () => {
|
|||
});
|
||||
|
||||
it('has expected total count', () => {
|
||||
// 9 core + 18 multi-language + Route + Tool + StateSlot = 31
|
||||
expect(NODE_TABLES).toHaveLength(31);
|
||||
// 9 core + 18 multi-language + Route + Tool + StateSlot = 32
|
||||
expect(NODE_TABLES).toHaveLength(32);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ describe('LadybugDB Schema', () => {
|
|||
|
||||
describe('schema query ordering', () => {
|
||||
it('NODE_SCHEMA_QUERIES has correct count', () => {
|
||||
expect(NODE_SCHEMA_QUERIES).toHaveLength(31);
|
||||
expect(NODE_SCHEMA_QUERIES).toHaveLength(32);
|
||||
});
|
||||
|
||||
it('REL_SCHEMA_QUERIES has one relation table', () => {
|
||||
|
|
@ -210,8 +210,8 @@ describe('LadybugDB Schema', () => {
|
|||
});
|
||||
|
||||
it('SCHEMA_QUERIES includes all node + rel + embedding schemas', () => {
|
||||
// 31 node + 1 rel + 1 embedding = 33
|
||||
expect(SCHEMA_QUERIES).toHaveLength(33);
|
||||
// 32 node + 1 rel + 1 embedding = 34
|
||||
expect(SCHEMA_QUERIES).toHaveLength(34);
|
||||
});
|
||||
|
||||
it('node schemas come before relation schemas in SCHEMA_QUERIES', () => {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ const GROUP_TOOLS = new Set([
|
|||
]);
|
||||
|
||||
describe('GITNEXUS_TOOLS', () => {
|
||||
it('exports all tools (7 base + 3 route/tool/shape + 1 api_impact + 5 group)', () => {
|
||||
expect(GITNEXUS_TOOLS).toHaveLength(16);
|
||||
it('exports all tools (7 base + 3 route/tool/shape + 1 api_impact + 1 data_flow + 5 group)', () => {
|
||||
expect(GITNEXUS_TOOLS).toHaveLength(17);
|
||||
});
|
||||
|
||||
it('contains all expected tool names', () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue