feat(indexer): baseline + overlay incremental indexing architecture#213
Merged
feat(indexer): baseline + overlay incremental indexing architecture#213
Conversation
…212) Add incremental indexing using a baseline + overlay architecture so the index stays accurate during active editing without blocking on a full SCIP rebuild after every change. Schema changes: - Add layer (baseline|overlay) and generation columns to all data tables - Add dirty_files table tracking files with active overlay data - Add reverse_deps table for impact-set computation - Add effective_* views that merge baseline + overlay layers - Add generation, baseline_head_sha, overlay_head_sha metadata keys Pipeline changes: - PipelineContext gains layer and generation fields - ScipIndexerStage: only runs in baseline builds, writes layer=baseline - SourceIndexStage: overlay mode writes layer=overlay, preserves baseline - LspEnrichmentStage: cross-file enrichment for overlay mode only - ResolutionStage: scoped to overlay refs in overlay mode - New ReverseDepsStage: mai- New ReverseDepsStage: mai- New ReverseDepsStage: mai- New ReverseDepsStage: mai- New ReverseDepsStage: mai- New ReverseDepsStage: mai- New Rebac- New ReverseDepsStage: mai- New ReverseDepsStage: mai- New ReverseDehes- New ReverseDepsStage: mai- New ReverseDepsStage: mai- New ReverseD r- New ReverseDepsStage: mai- Nne r- New ReverseDuietPeriodMs now controls baseline rebuild scheduling Resolution taxonomy:Resolution taxonomy:Resolution taxonomy:Resolution taxonomy:ReesResolution taxonomy:Resolution taxonomy:Resolution_aResolution taxonomy:Resolution taxonomy:Resolution taxonomyr in read-only.ts Design: docs/incremental-index-design.md
Add tests for baseline+overlay architecture to restore coverage above thresholds (85% statements, 87% lines): - overlay-cleanup.test.ts: OverlayCleanupStage baseline promotion, dirty_files cleanup, generation metadata, reverse_deps rebuild - incremental-schema.test.ts: generation helpers, dirty_files table, reverse_deps table, effective_* views, layer/generation columns - freshness.test.ts: getFreshness() with baseline/mixed/overlay states - source-index-overlay.test.ts: processFile with overlay layer, dirty marking, baseline preservation, prior overlay cleanup - source-index-stage-overlay.test.ts: SourceIndexStage overlay update, file deletion in overlay/baseline modes, stale symbol tracking - stage-layer-guards.test.ts: ScipIndexerStage overlay skip, LspEnrichmentStage baseline/overlay behavior - overlay-resolution.test.ts: resolveSymbolEdges overlayOnly option - index.test.ts: IndexBuilder.baselineRebuild() with generation tracking and overlay cleanup
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #213 +/- ##
==========================================
+ Coverage 87.43% 87.54% +0.11%
==========================================
Files 82 84 +2
Lines 9429 9579 +150
Branches 2925 2958 +33
==========================================
+ Hits 8244 8386 +142
- Misses 1185 1193 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add incremental indexing to Lore using a baseline + overlay architecture so the index stays accurate during active editing — including multi-agent concurrent-writer scenarios — without blocking on a full SCIP rebuild after every change.
Closes #212
Design document: docs/incremental-index-design.md
Schema Changes
layer(baseline|overlay) andgenerationcolumns to all data tables (files,symbols,symbol_refs,type_refs,symbol_relationships,file_imports,annotations,symbol_metrics,external_deps)dirty_filestable tracking files with active overlay datareverse_depstable for impact-set computation ("file X is depended on by files Y, Z")effective_*SQL views that merge baseline + overlay layers, preferring overlay for dirty fileslore_metakeys:generation,generation_pending,baseline_head_sha,overlay_head_shagetGeneration(),incrementGeneration()Pipeline Changes
PipelineContextgainslayerandgenerationfieldslayer='baseline'with generationlayer='overlay', preserves baseline rows; only deletes prior overlay rowsresolveSymbolEdges()acceptsoverlayOnlyoption to scope name-based resolution to overlay refsreverse_depsfrom resolved imports + refsWatcher/Poller Changes
baselineRebuild()after quiet periodscipQuietPeriodMsnow controls background baseline rebuild schedulingResolution Taxonomy
overlay_staleresolution method for refs invalidated by file changes but not yet re-enrichedMCP Tool Freshness
FreshnessInfotype:{ source: 'baseline'|'mixed'|'overlay', baseline_age_s, dirty_file_count }getFreshness()helper inread-only.tsloggedHandlerInvariants
dirty_filesis authoritative — a file has active overlay data iff it appears indirty_fileslore_meta.generationonly increasescallee_iddoesn't exist in effective symbolsTest Results
All 1830 tests pass (98 test files, 0 failures).