Summary
On CodeGraph v1.3.1, incremental sync can leave the graph semantically stale when a changed file introduces an export that satisfies an existing import/call in an unchanged file.
The index reports a clean state (pendingChanges = 0, pendingRefs = 0, state = "complete", reindexRecommended = false), but a full index of the exact same source snapshot adds missing edges.
Minimal TypeScript reproduction
Initial a.ts:
import { greet } from './b';
export function run(): number {
return greet();
}
Initial b.ts:
export function other(): number {
return 1;
}
- Run a full initial index:
- Replace
b.ts with:
export function greet(): number {
return 42;
}
- Run incremental sync and inspect the graph:
codegraph sync --quiet .
codegraph status --json .
Actual result after sync
fileCount: 2
nodeCount: 5
edgeCount: 4
- edge kinds:
contains: 3, imports: 1
pendingChanges: { added: 0, modified: 0, removed: 0 }
pendingRefs: 0
Then run a full index without changing any source file:
codegraph index --force --quiet .
codegraph status --json .
Result after full index
fileCount: 2
nodeCount: 5
edgeCount: 6
- edge kinds:
calls: 1, contains: 3, imports: 2
pendingChanges: { added: 0, modified: 0, removed: 0 }
pendingRefs: 0
Expected result
For an unchanged source snapshot, sync should produce the same resolved cross-file graph as a full index. In this case, the import/call in unchanged a.ts should be resolved after b.ts adds greet.
Impact
The MCP file watcher uses incremental sync, so impact, caller/callee, and flow results can silently omit cross-file relationships after a normal edit. Status does not indicate that a full re-index is needed.
This appears consistent with reference resolution being scoped to changed files: the unresolved reference in unchanged a.ts is not revisited after b.ts gains the matching export.
Environment
- CodeGraph:
1.3.1
- Linux x64
- TypeScript
Summary
On CodeGraph v1.3.1, incremental
synccan leave the graph semantically stale when a changed file introduces an export that satisfies an existing import/call in an unchanged file.The index reports a clean state (
pendingChanges = 0,pendingRefs = 0,state = "complete",reindexRecommended = false), but a full index of the exact same source snapshot adds missing edges.Minimal TypeScript reproduction
Initial
a.ts:Initial
b.ts:codegraph init --force .b.tswith:Actual result after
syncfileCount: 2nodeCount: 5edgeCount: 4contains: 3,imports: 1pendingChanges: { added: 0, modified: 0, removed: 0 }pendingRefs: 0Then run a full index without changing any source file:
Result after full index
fileCount: 2nodeCount: 5edgeCount: 6calls: 1,contains: 3,imports: 2pendingChanges: { added: 0, modified: 0, removed: 0 }pendingRefs: 0Expected result
For an unchanged source snapshot,
syncshould produce the same resolved cross-file graph as a full index. In this case, the import/call in unchangeda.tsshould be resolved afterb.tsaddsgreet.Impact
The MCP file watcher uses incremental sync, so
impact, caller/callee, and flow results can silently omit cross-file relationships after a normal edit. Status does not indicate that a full re-index is needed.This appears consistent with reference resolution being scoped to changed files: the unresolved reference in unchanged
a.tsis not revisited afterb.tsgains the matching export.Environment
1.3.1