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) <noreply@anthropic.com>
This commit is contained in:
abhigyanpatwari 2026-04-09 02:22:53 +05:30
parent a7fdb36113
commit 750f4336f6
2 changed files with 17 additions and 2 deletions

View file

@ -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<calleeName, rawReturnType>. */
importedRawReturnTypesMap?: ReadonlyMap<string, ReadonlyMap<string, string>>,
heritageMap?: HeritageMap,
bindingAccumulator?: BindingAccumulator,
): Promise<ExtractedHeritage[]> => {
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 =

View file

@ -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) {