Repository navigation
Description
Context
Raised by Greptile on PR #2488 (issue #2339 fix): the JS/WASM engine's reparseBarrelFiles now deletes dataflow rows referencing a barrel candidate's outgoing edges before deleting those edges (mirroring the Rust engine's pre-existing #979 fix), but never regenerates that dataflow afterward. Investigated whether this is a NEW regression from PR #2488 or a pre-existing dual-engine characteristic.
Finding: pre-existing in both engines, by design — not a regression
Rust (crates/codegraph-core/src/domain/graph/builder/pipeline.rs):
reparse_barrel_candidates(~L925-1053) re-parses barrel candidates viaparallel::parse_files_parallel(&to_parse, root_dir, false, false)(L981) — hardcodinginclude_dataflow=false. The comment at L977-980 states this explicitly: "Dataflow/AST analysis is skipped because the barrel is not itself a 'changed' file; Stage 7 will reconstruct all outgoing edge kinds from the fresh parse."parallel.rs::parse_files_parallel(L17-40) only setssymbols.dataflowif include_dataflow— so barrel candidates'FileSymbols.dataflowstaysNone.write_dataflow(~L2066-2109), the soleINSERT INTO dataflowwriter, skips any file whosesymbols.dataflowisNone(L2103-2106) — even though barrel candidates ARE included inanalysis_scopeby the time Stage 8 runs (file_symbolsis mutated in place by Stage 6b), they're skipped because the field was never populated.- Net effect: dataflow rows for a reparsed barrel candidate are deleted (L1003-1009, the bug: incremental rebuild leaks ~249 duplicate edges per run #979 fix) and never regenerated in that same incremental build — by explicit design.
JS/WASM (src/domain/graph/builder/):
reparseBarrelFiles(stages/resolve-imports.tsL128-180) parses barrel candidates with the build's realengineOpts(L155), sodataflowIS actually extracted if the build requested it — but merges results only intoctx.fileSymbols(L158), never intoctx.allSymbols.ctx.allSymbolsis populated once instages/parse-files.ts(L20) from the original changed-file set and is a separateMapfromctx.fileSymbols; nothing inresolve-imports.tsadds barrel candidates to it.runAnalyses(stages/run-analyses.tsL11-25) — the sole dataflow-persistence entry point — operates onctx.allSymbols, so barrel candidates' freshly-computed dataflow is silently discarded, never reaching the DB.
Both engines converge on the same observable behavior: a barrel candidate reparsed during an incremental build never gets its interprocedural dataflow rows regenerated, because dataflow persistence is scoped exclusively to the genuinely-changed-file set in both pipelines. This holds independent of PR #2488 — that PR only fixed a crash (silently-swallowed FK constraint exception aborting the entire JS barrel reparse, dropping import/reexport/call edges too, a strictly worse outcome than today's "just missing dataflow rows").
Follow-up (not blocking #2488)
Decide whether to extend dataflow analysis scope to reparsed barrel candidates in both engines (Rust: pass include_dataflow through to reparse_barrel_candidates instead of hardcoding false, and add the write to persistence scope; JS: merge barrel-candidate entries into ctx.allSymbols too, or run dataflow persistence against ctx.fileSymbols). Given hybrid barrel files can have real call edges (the core motivation for #2339/#979), it's plausible their interprocedural dataflow should also survive incremental rebuilds — needs product/perf tradeoff discussion since extending scope adds parse cost to a path currently optimized to skip it.
Activity