fix(db): fail closed when WAL valve cannot checkpoint past caps (#1539) (#1751)

sync() armed the WAL valve but never called backpressure(), so daemon
catch-up could grow the WAL without bound while query-pool readers pinned
frames. Wire the writer pause into sync store + batched resolution, and
abort with WalValveAbortError after parked backfills fail past the
documented hard/file caps instead of disabling parking for 60s.

Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
This commit is contained in:
Colby Mchenry
2026-09-08 01:06:56 -05:00
committed by GitHub
co-authored by Colby McHenry
parent bb204f8855
commit 9b8bb4aba0
5 changed files with 199 additions and 38 deletions
+10 -1
View File
@@ -2712,7 +2712,13 @@ export class ExtractionOrchestrator {
* set is not exactly known (directory removals, event overflow): the full
* scan-diff remains the ground truth those cases need (#1285).
*/
scopedPaths?: string[]
scopedPaths?: string[],
/**
* Writer-side WAL pressure valve (#1539). Called after every changed file
* 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
): Promise<SyncResult> {
await initGrammars(); // Initialize WASM runtime (grammars loaded lazily below)
const startTime = Date.now();
@@ -2912,6 +2918,9 @@ export class ExtractionOrchestrator {
const result = await this.indexFile(filePath);
nodesUpdated += result.nodes.length;
const pause = backpressure?.();
if (pause) await pause;
}
// Names whose definition set this sync changed: a `file\0name` pair present