From 750f4336f6f2e87d6acefb72ac1f6c392dbc91ef Mon Sep 17 00:00:00 2001 From: abhigyanpatwari Date: Thu, 9 Apr 2026 02:22:53 +0530 Subject: [PATCH] feat(ingestion): wire flush() into sequential processCalls path Pass bindingAccumulator to processCalls on the sequential code path so TypeEnv scopes are flushed into the accumulator for Phase 9+ cross-file type propagation, matching the worker path wired in Task 4. Co-Authored-By: Claude Opus 4.6 (1M context) --- gitnexus/src/core/ingestion/call-processor.ts | 6 ++++++ gitnexus/src/core/ingestion/pipeline.ts | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gitnexus/src/core/ingestion/call-processor.ts b/gitnexus/src/core/ingestion/call-processor.ts index ecb778a46..b01426e55 100644 --- a/gitnexus/src/core/ingestion/call-processor.ts +++ b/gitnexus/src/core/ingestion/call-processor.ts @@ -32,6 +32,7 @@ import { buildTypeEnv, isSubclassOf } from './type-env.js'; import type { ConstructorBinding, TypeEnvironment } from './type-env.js'; import type { HeritageMap } from './heritage-map.js'; import { c3Linearize } from './mro-processor.js'; +import type { BindingAccumulator } from './binding-accumulator.js'; import { getTreeSitterBufferSize } from './constants.js'; import type { ExtractedCall, @@ -567,6 +568,7 @@ export const processCalls = async ( /** Phase 14 E3: cross-file RAW return types for for-loop element extraction. Keyed by filePath → Map. */ importedRawReturnTypesMap?: ReadonlyMap>, heritageMap?: HeritageMap, + bindingAccumulator?: BindingAccumulator, ): Promise => { const parser = await loadParser(); const collectedHeritage: ExtractedHeritage[] = []; @@ -688,6 +690,10 @@ export const processCalls = async ( const fileExports = collectExportedBindings(typeEnv, file.path, ctx.symbols, graph); if (fileExports) exportedTypeMap.set(file.path, fileExports); } + // Flush all scopes into accumulator for Phase 9+ cross-file propagation + if (bindingAccumulator) { + typeEnv.flush(file.path, bindingAccumulator); + } const callRouter = provider.callRouter; const verifiedReceivers = diff --git a/gitnexus/src/core/ingestion/pipeline.ts b/gitnexus/src/core/ingestion/pipeline.ts index 05da6e7f2..aab754899 100644 --- a/gitnexus/src/core/ingestion/pipeline.ts +++ b/gitnexus/src/core/ingestion/pipeline.ts @@ -921,13 +921,21 @@ async function runChunkedParseAndResolve( // Collect all-scope bindings into BindingAccumulator if (chunkWorkerData.allScopeBindings?.length) { for (const { filePath, bindings } of chunkWorkerData.allScopeBindings) { - const entries = bindings.map(([scope, varName, typeName]) => ({ scope, varName, typeName })); + const entries = bindings.map(([scope, varName, typeName]) => ({ + scope, + varName, + typeName, + })); bindingAccumulator.appendFile(filePath, entries); } } else if (chunkWorkerData.typeEnvBindings?.length) { // Fallback: old-style file-scope-only bindings (backward compat) for (const { filePath, bindings } of chunkWorkerData.typeEnvBindings) { - const entries = bindings.map(([varName, typeName]) => ({ scope: '', varName, typeName })); + const entries = bindings.map(([varName, typeName]) => ({ + scope: '', + varName, + typeName, + })); bindingAccumulator.appendFile(filePath, entries); } } @@ -1045,6 +1053,7 @@ async function runChunkedParseAndResolve( undefined, undefined, sequentialHeritageMap, + bindingAccumulator, ); await processHeritage(graph, chunkFiles, astCache, ctx); if (rubyHeritage.length > 0) {