* 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
)
| 1157 | * Processes chunks of unresolved refs, persisting results after each batch. |
| 1158 | */ |
| 1159 | async resolveReferencesBatched( |
| 1160 | onProgress?: (current: number, total: number) => void, |
| 1161 | onSynthesisProgress?: (done: number, total: number) => void, |
| 1162 | // The WAL valve's writer-side backstop, threaded into the batch loop's |
| 1163 | // pool-idle boundaries. Without it the valve's only lever during |
| 1164 | // resolution is timer-driven passive checkpoints, which the pool's |
| 1165 | // continuous reads keep perpetually partial — the WAL then accretes the |
| 1166 | // whole phase's write volume (22GB on a 4.6GB DB at kernel scale). |
| 1167 | backpressure?: () => Promise<void> | null |
| 1168 | ): Promise<ResolutionResult> { |
| 1169 | return this.resolver.resolveAndPersistBatched(onProgress, undefined, onSynthesisProgress, { |
| 1170 | dbPath: this.db.getPath(), |
| 1171 | // Bulk-edge-load hooks: on big runs the resolver drops the non-unique |
| 1172 | // edge indexes for the batch loop and recreates them before synthesis |
| 1173 | // (which reads kind-keyed). Concurrent readers (a daemon serving this |
| 1174 | // project mid-index) stay CORRECT during the window — target/kind reads |
| 1175 | // just degrade to scans until the recreate. |
| 1176 | bulkEdgeLoad: { |
| 1177 | begin: () => this.db.beginBulkEdgeLoad(), |
| 1178 | end: () => this.db.endBulkEdgeLoad(), |
| 1179 | }, |
| 1180 | refIndexLoad: { |
| 1181 | begin: () => this.db.beginBulkRefLoad(), |
| 1182 | end: () => this.db.endBulkRefLoad(), |
| 1183 | }, |
| 1184 | backpressure, |
| 1185 | }); |
| 1186 | } |
| 1187 | |
| 1188 | /** |
| 1189 | * References extracted but never attempted by a resolution pass. Zero on a |
no test coverage detected