fix(sync): refresh synthesized edges after incremental changes (#1988) (#2033)

* fix(sync): refresh synthesized edges after incremental changes (#1988)

Scoped sync skipped synthesis and retained obsolete dispatch edges.
Refresh all synthesis passes after base resolution when dependencies or source patterns change.
Stage and atomically replace owned edges, preserve ordinary edges, and retry interrupted refreshes.
Stabilize traversal order and migrate existing indexes for rebuild convergence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: preserve structural Go containment during synthesis refresh

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-09-27 13:41:49 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 9649ce1bd6
commit 2a2f71ec41
12 changed files with 570 additions and 38 deletions
+6 -1
View File
@@ -3037,7 +3037,9 @@ export class ExtractionOrchestrator {
* is stored, when no extraction transaction is open, so a checkpoint can
* safely catch up before the next file grows the WAL further.
*/
backpressure?: () => Promise<void> | null
backpressure?: () => Promise<void> | null,
/** Inspect changed inputs before deletion/re-extraction cascades their edges. */
onFileChange?: (filePath: string, content?: string) => void
): Promise<SyncResult> {
await initGrammars(); // Initialize WASM runtime (grammars loaded lazily below)
const startTime = Date.now();
@@ -3153,6 +3155,7 @@ export class ExtractionOrchestrator {
this.queries.insertUnresolvedRefsBatch(resurrected);
}
}
onFileChange?.(tracked.path);
this.queries.deleteFile(tracked.path);
filesRemoved++;
}
@@ -3202,10 +3205,12 @@ export class ExtractionOrchestrator {
const contentHash = hashContent(content);
if (!tracked) {
onFileChange?.(filePath, content);
filesToIndex.push(filePath);
changedFilePaths.push(filePath);
filesAdded++;
} else if (tracked.contentHash !== contentHash) {
onFileChange?.(filePath, content);
filesToIndex.push(filePath);
changedFilePaths.push(filePath);
filesModified++;