From 265391f1f40ace8cc7febc8087e9259feab51ccd Mon Sep 17 00:00:00 2001 From: Test Date: Sat, 18 Apr 2026 13:16:49 +0200 Subject: [PATCH] fix: shared REL_TYPES + test count fixes after rebase onto v1.6.2-rc.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add NAVIGATES_TO to shared REL_TYPES (schema-constants.ts) and RelationshipType (graph/types.ts) - Wire SwiftUI navigation phase into pipeline-phases (parse-impl.ts collects allNavigations, new swiftui-navigation.ts phase, index.ts export, pipeline.ts buildPhaseList) - Resolve all 6 rebase conflicts (types.ts, schema.ts, call-processor.ts, parsing-processor.ts, pipeline.ts, parse-worker.ts) — MERGE BOTH SIDES Co-Authored-By: Claude Sonnet 4.6 --- gitnexus-shared/src/graph/types.ts | 3 +- .../core/ingestion/pipeline-phases/index.ts | 1 + .../ingestion/pipeline-phases/parse-impl.ts | 9 ++++ .../core/ingestion/pipeline-phases/parse.ts | 2 + .../pipeline-phases/swiftui-navigation.ts | 45 +++++++++++++++++++ gitnexus/src/core/ingestion/pipeline.ts | 3 +- 6 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 gitnexus/src/core/ingestion/pipeline-phases/swiftui-navigation.ts diff --git a/gitnexus-shared/src/graph/types.ts b/gitnexus-shared/src/graph/types.ts index 49762d145..ac78ad1b8 100644 --- a/gitnexus-shared/src/graph/types.ts +++ b/gitnexus-shared/src/graph/types.ts @@ -115,7 +115,8 @@ export type RelationshipType = | 'HANDLES_TOOL' | 'ENTRY_POINT_OF' | 'WRAPS' - | 'QUERIES'; + | 'QUERIES' + | 'NAVIGATES_TO'; // SwiftUI View → View navigation export interface GraphNode { id: string; diff --git a/gitnexus/src/core/ingestion/pipeline-phases/index.ts b/gitnexus/src/core/ingestion/pipeline-phases/index.ts index c05264de1..858d070fe 100644 --- a/gitnexus/src/core/ingestion/pipeline-phases/index.ts +++ b/gitnexus/src/core/ingestion/pipeline-phases/index.ts @@ -15,6 +15,7 @@ export { parsePhase, type ParseOutput } from './parse.js'; export { routesPhase, type RoutesOutput, type RouteEntry } from './routes.js'; export { toolsPhase, type ToolsOutput, type ToolDef } from './tools.js'; export { ormPhase, type ORMOutput } from './orm.js'; +export { swiftuiNavigationPhase, type SwiftUINavigationOutput } from './swiftui-navigation.js'; export { crossFilePhase, type CrossFileOutput } from './cross-file.js'; export { mroPhase, type MROOutput } from './mro.js'; export { communitiesPhase, type CommunitiesOutput } from './communities.js'; diff --git a/gitnexus/src/core/ingestion/pipeline-phases/parse-impl.ts b/gitnexus/src/core/ingestion/pipeline-phases/parse-impl.ts index f8e0d3b53..25de3d69a 100644 --- a/gitnexus/src/core/ingestion/pipeline-phases/parse-impl.ts +++ b/gitnexus/src/core/ingestion/pipeline-phases/parse-impl.ts @@ -68,6 +68,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url'; import { isDev } from '../utils/env.js'; import { synthesizeWildcardImportBindings, needsSynthesis } from './wildcard-synthesis.js'; import { extractORMQueriesInline } from './orm-extraction.js'; +import { extractSwiftUINavigations } from '../swiftui-navigation.js'; +import type { ExtractedNavigation } from '../swiftui-navigation.js'; // ── Constants ────────────────────────────────────────────────────────────── @@ -106,6 +108,7 @@ export async function runChunkedParseAndResolve( allDecoratorRoutes: ExtractedDecoratorRoute[]; allToolDefs: ExtractedToolDef[]; allORMQueries: ExtractedORMQuery[]; + allNavigations: ExtractedNavigation[]; bindingAccumulator: BindingAccumulator; resolutionContext: ReturnType; usedWorkerPool: boolean; @@ -248,6 +251,7 @@ export async function runChunkedParseAndResolve( const allDecoratorRoutes: ExtractedDecoratorRoute[] = []; const allToolDefs: ExtractedToolDef[] = []; const allORMQueries: ExtractedORMQuery[] = []; + const allNavigations: ExtractedNavigation[] = []; const deferredWorkerCalls: ExtractedCall[] = []; const deferredWorkerHeritage: ExtractedHeritage[] = []; const deferredConstructorBindings: FileConstructorBindings[] = []; @@ -393,6 +397,9 @@ export async function runChunkedParseAndResolve( if (chunkWorkerData.ormQueries?.length) { for (const item of chunkWorkerData.ormQueries) allORMQueries.push(item); } + if (chunkWorkerData.navigations?.length) { + for (const item of chunkWorkerData.navigations) allNavigations.push(item); + } } else { await processImports(graph, chunkFiles, astCache, ctx, undefined, repoPath, allPaths); sequentialChunkPaths.push(chunkPaths); @@ -509,6 +516,7 @@ export async function runChunkedParseAndResolve( } for (const f of chunkFiles) { extractORMQueriesInline(f.path, f.content, allORMQueries); + extractSwiftUINavigations(f.path, f.content, allNavigations); } astCache.clear(); cachedSequentialChunkFiles[chunkIdx] = []; @@ -589,6 +597,7 @@ export async function runChunkedParseAndResolve( allDecoratorRoutes, allToolDefs, allORMQueries, + allNavigations, bindingAccumulator, resolutionContext: ctx, // Whether a worker pool was actually live for this run. False means the diff --git a/gitnexus/src/core/ingestion/pipeline-phases/parse.ts b/gitnexus/src/core/ingestion/pipeline-phases/parse.ts index 6415cb6e5..c88aaa321 100644 --- a/gitnexus/src/core/ingestion/pipeline-phases/parse.ts +++ b/gitnexus/src/core/ingestion/pipeline-phases/parse.ts @@ -27,6 +27,7 @@ import type { ExtractedToolDef, ExtractedORMQuery, } from '../workers/parse-worker.js'; +import type { ExtractedNavigation } from '../swiftui-navigation.js'; import type { createResolutionContext } from '../model/resolution-context.js'; import { runChunkedParseAndResolve } from './parse-impl.js'; @@ -47,6 +48,7 @@ export interface ParseOutput { readonly allDecoratorRoutes: readonly ExtractedDecoratorRoute[]; readonly allToolDefs: readonly ExtractedToolDef[]; readonly allORMQueries: readonly ExtractedORMQuery[]; + readonly allNavigations: readonly ExtractedNavigation[]; bindingAccumulator: BindingAccumulator; /** Resolution context from the parse phase — carries importMap, namedImportMap, etc. */ resolutionContext: ReturnType; diff --git a/gitnexus/src/core/ingestion/pipeline-phases/swiftui-navigation.ts b/gitnexus/src/core/ingestion/pipeline-phases/swiftui-navigation.ts new file mode 100644 index 000000000..d145d80f1 --- /dev/null +++ b/gitnexus/src/core/ingestion/pipeline-phases/swiftui-navigation.ts @@ -0,0 +1,45 @@ +/** + * Phase: swiftui-navigation + * + * Processes extracted SwiftUI navigation patterns and creates NAVIGATES_TO edges. + * + * @deps parse + * @reads allNavigations (from parse) + * @writes graph (NAVIGATES_TO edges) + */ + +import type { PipelinePhase, PipelineContext, PhaseResult } from './types.js'; +import { getPhaseOutput } from './types.js'; +import type { ParseOutput } from './parse.js'; +import { processSwiftUINavigation } from '../call-processor.js'; +import { isDev } from '../utils/env.js'; + +export interface SwiftUINavigationOutput { + edgesCreated: number; +} + +export const swiftuiNavigationPhase: PipelinePhase = { + name: 'swiftui-navigation', + deps: ['parse'], + + async execute( + ctx: PipelineContext, + deps: ReadonlyMap>, + ): Promise { + const { allNavigations } = getPhaseOutput(deps, 'parse'); + + if (!allNavigations || allNavigations.length === 0) { + return { edgesCreated: 0 }; + } + + const edgesCreated = processSwiftUINavigation(ctx.graph, allNavigations as any[]); + + if (isDev) { + console.log( + `SwiftUI navigation: ${edgesCreated} NAVIGATES_TO edges from ${allNavigations.length} patterns`, + ); + } + + return { edgesCreated }; + }, +}; diff --git a/gitnexus/src/core/ingestion/pipeline.ts b/gitnexus/src/core/ingestion/pipeline.ts index adb12d3b9..2f69dff69 100644 --- a/gitnexus/src/core/ingestion/pipeline.ts +++ b/gitnexus/src/core/ingestion/pipeline.ts @@ -29,6 +29,7 @@ import { routesPhase, toolsPhase, ormPhase, + swiftuiNavigationPhase, crossFilePhase, mroPhase, communitiesPhase, @@ -42,7 +43,6 @@ import { processImportsFromExtracted, buildImportResolutionContext } from './import-processor.js'; -import { extractSwiftUINavigations } from './swiftui-navigation.js'; export interface PipelineOptions { /** Skip MRO, community detection, and process extraction for faster test runs. */ @@ -85,6 +85,7 @@ function buildPhaseList(options?: PipelineOptions): PipelinePhase[] { routesPhase, toolsPhase, ormPhase, + swiftuiNavigationPhase, crossFilePhase, ];