MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / getUnresolvedReferencesBatchAfter

Method getUnresolvedReferencesBatchAfter

src/db/queries.ts:4566–4592  ·  view source on GitHub ↗

* Keyset variant of getUnresolvedReferencesBatch for the batched * resolution loop: seek past the last-seen row id instead of OFFSET-walking. * OFFSET reads re-scan the accumulated failed-row prefix on every batch — * O(failed rows) per read, measured at 54.6s of the kernel-scale ba

(afterRowId: number, limit: number, prerequisites?: boolean)

Source from the content-addressed store, hash-verified

4564 * the enumeration order is identical to the OFFSET reader's.
4565 */
4566 getUnresolvedReferencesBatchAfter(afterRowId: number, limit: number, prerequisites?: boolean): UnresolvedReference[] {
4567 // Resolution prerequisites must be committed before dependent calls,
4568 // even when an interrupted sync queued their rows in a different order
4569 // from a clean index (#1577). Each phase still seeks by row id in bounded
4570 // memory; the default preserves the public reader's original enumeration.
4571 const key = prerequisites === undefined ? 'getUnresolvedBatchAfter'
4572 : prerequisites ? 'getUnresolvedPrerequisitesAfter' : 'getUnresolvedDependentsAfter';
4573 if (!this.stmts[key]) {
4574 const filter = prerequisites === undefined ? ''
4575 : ` AND reference_kind ${prerequisites ? 'IN' : 'NOT IN'} ('imports', 'extends', 'implements')`;
4576 this.stmts[key] = this.db.prepare(
4577 `SELECT * FROM unresolved_refs WHERE status = 'pending' AND id > ?${filter} ORDER BY id LIMIT ?`
4578 );
4579 }
4580 const rows = this.stmts[key]!.all(afterRowId, limit) as UnresolvedRefRow[];
4581 return rows.map((row) => ({
4582 fromNodeId: row.from_node_id,
4583 referenceName: row.reference_name,
4584 referenceKind: row.reference_kind as EdgeKind,
4585 line: row.line,
4586 column: row.col,
4587 candidates: row.candidates ? safeJsonParse(row.candidates, undefined) : undefined,
4588 filePath: row.file_path,
4589 language: row.language as Language,
4590 rowId: row.id,
4591 }));
4592 }
4593
4594 /**
4595 * Get all tracked file paths (lightweight — no full FileRecord objects)

Callers 1

readNextBatchMethod · 0.80

Calls 4

safeJsonParseFunction · 0.90
mapMethod · 0.80
prepareMethod · 0.65
allMethod · 0.65

Tested by

no test coverage detected