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

Method getUnresolvedReferencesBatchAfter

src/db/queries.ts:4677–4703  ·  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

4675 * the enumeration order is identical to the OFFSET reader's.
4676 */
4677 getUnresolvedReferencesBatchAfter(afterRowId: number, limit: number, prerequisites?: boolean): UnresolvedReference[] {
4678 // Resolution prerequisites must be committed before dependent calls,
4679 // even when an interrupted sync queued their rows in a different order
4680 // from a clean index (#1577). Each phase still seeks by row id in bounded
4681 // memory; the default preserves the public reader's original enumeration.
4682 const key = prerequisites === undefined ? 'getUnresolvedBatchAfter'
4683 : prerequisites ? 'getUnresolvedPrerequisitesAfter' : 'getUnresolvedDependentsAfter';
4684 if (!this.stmts[key]) {
4685 const filter = prerequisites === undefined ? ''
4686 : ` AND reference_kind ${prerequisites ? 'IN' : 'NOT IN'} ('imports', 'extends', 'implements')`;
4687 this.stmts[key] = this.db.prepare(
4688 `SELECT * FROM unresolved_refs WHERE status = 'pending' AND id > ?${filter} ORDER BY id LIMIT ?`
4689 );
4690 }
4691 const rows = this.stmts[key]!.all(afterRowId, limit) as UnresolvedRefRow[];
4692 return rows.map((row) => ({
4693 fromNodeId: row.from_node_id,
4694 referenceName: row.reference_name,
4695 referenceKind: row.reference_kind as EdgeKind,
4696 line: row.line,
4697 column: row.col,
4698 candidates: row.candidates ? safeJsonParse(row.candidates, undefined) : undefined,
4699 filePath: row.file_path,
4700 language: row.language as Language,
4701 rowId: row.id,
4702 }));
4703 }
4704
4705 /**
4706 * 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