MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / callersOf

Function callersOf

graph-ui/src/traces/bug-paths.ts:216–257  ·  view source on GitHub ↗

The symbols the index records as calling one qualified name, in a fixed order.

(
    index: BugPathIndex,
    project: string,
    qualifiedName: string,
)

Source from the content-addressed store, hash-verified

214
215/** The symbols the index records as calling one qualified name, in a fixed order. */
216async function callersOf(
217 index: BugPathIndex,
218 project: string,
219 qualifiedName: string,
220): Promise<BugPathNode[]> {
221 let rows: Record<string, string>[];
222 try {
223 rows = await index.queryRows(project, callsIn(qualifiedName));
224 } catch {
225 // A refused query is not a finding about the code. The chain stops here
226 // and the surface says the walk ended, which is what happened.
227 return [];
228 }
229 const out: BugPathNode[] = [];
230 const seen = new Set<string>();
231 for (const row of rows) {
232 const name = row[COLUMNS.callsIn[0]] ?? '';
233 if (name.length === 0) {
234 continue;
235 }
236 const node: BugPathNode = { name };
237 const qualified = row[COLUMNS.callsIn[1]] ?? '';
238 if (qualified.length > 0) {
239 node.qualifiedName = qualified;
240 }
241 const filePath = row[COLUMNS.callsIn[2]] ?? '';
242 if (filePath.length > 0) {
243 node.filePath = filePath;
244 }
245 const line = toOptionalNumber(row[COLUMNS.callsIn[3]]);
246 if (line !== undefined) {
247 node.line = line;
248 }
249 const key = nodeKey(node);
250 if (seen.has(key)) {
251 continue;
252 }
253 seen.add(key);
254 out.push(node);
255 }
256 return out.sort((a, b) => compareText(a.qualifiedName ?? nodeKey(a), b.qualifiedName ?? nodeKey(b)));
257}
258
259/**
260 * The upstream chains, level by level.

Callers 2

staticChainsFunction · 0.85
callIsRecordedFunction · 0.85

Calls 6

callsInFunction · 0.90
toOptionalNumberFunction · 0.90
nodeKeyFunction · 0.85
compareTextFunction · 0.70
queryRowsMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected