* Resolve references in batches to keep memory bounded on large codebases. * Processes chunks of unresolved refs, persisting results after each batch.
(
onProgress?: (current: number, total: number) => void,
onSynthesisProgress?: (done: number, total: number) => void,
// The WAL valve's writer-side backstop, threaded into the batch loop's
// pool-idle boundaries. Without it the valve's only lever during
// resolution is timer-driven passive checkpoints, which the pool's
// continuous reads keep perpetually partial — the WAL then accretes the
// whole phase's write volume (22GB on a 4.6GB DB at kernel scale).
backpressure?: () => Promise<void> | null
)
| 1226 | * Processes chunks of unresolved refs, persisting results after each batch. |
| 1227 | */ |
| 1228 | async resolveReferencesBatched( |
| 1229 | onProgress?: (current: number, total: number) => void, |
| 1230 | onSynthesisProgress?: (done: number, total: number) => void, |
| 1231 | // The WAL valve's writer-side backstop, threaded into the batch loop's |
| 1232 | // pool-idle boundaries. Without it the valve's only lever during |
| 1233 | // resolution is timer-driven passive checkpoints, which the pool's |
| 1234 | // continuous reads keep perpetually partial — the WAL then accretes the |
| 1235 | // whole phase's write volume (22GB on a 4.6GB DB at kernel scale). |
| 1236 | backpressure?: () => Promise<void> | null |
| 1237 | ): Promise<ResolutionResult> { |
| 1238 | return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, { |
| 1239 | dbPath: this.db.getPath(), |
| 1240 | // Bulk-edge-load hooks: on big runs the resolver drops the non-unique |
| 1241 | // edge indexes for the batch loop and recreates them before synthesis |
| 1242 | // (which reads kind-keyed). Concurrent readers (a daemon serving this |
| 1243 | // project mid-index) stay CORRECT during the window — target/kind reads |
| 1244 | // just degrade to scans until the recreate. |
| 1245 | bulkEdgeLoad: { |
| 1246 | begin: () => this.db.beginBulkEdgeLoad(), |
| 1247 | end: () => this.db.endBulkEdgeLoad(), |
| 1248 | }, |
| 1249 | refIndexLoad: { |
| 1250 | begin: () => this.db.beginBulkRefLoad(), |
| 1251 | end: () => this.db.endBulkRefLoad(), |
| 1252 | }, |
| 1253 | backpressure, |
| 1254 | }); |
| 1255 | } |
| 1256 | |
| 1257 | /** |
| 1258 | * References extracted but never attempted by a resolution pass. Zero on a |
no test coverage detected