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

Function buildCallerRail

ui/src/lib/symbol-model.ts:428–472  ·  view source on GitHub ↗
(payload: WireSymbolPayload)

Source from the content-addressed store, hash-verified

426 * mixed into the same list as a resolved call. Both carry their counts.
427 */
428export function buildCallerRail(payload: WireSymbolPayload): CallerRailModel {
429 const focalFile = payload.node.file;
430 const byFile = new Map<string, CallerRow[]>();
431 const uncertain: CallerRow[] = [];
432 const testRows: CallerRow[] = [];
433
434 for (const relation of payload.incoming.items) {
435 const row: CallerRow = {
436 relation,
437 words: relationWords(relation),
438 lines: relation.lines,
439 via: synthesizedBy(relation),
440 when: relationWhens(relation),
441 };
442 // Uncertainty wins over test-ness: a name-only guess is a claim about the
443 // edge, and burying it in the tests fold would present it as established.
444 if (relation.uncertain) {
445 uncertain.push(row);
446 continue;
447 }
448 if (relation.node.test) {
449 testRows.push(row);
450 continue;
451 }
452 const bucket = byFile.get(relation.node.file);
453 if (bucket) bucket.push(row);
454 else byFile.set(relation.node.file, [row]);
455 }
456
457 const groups: CallerFileGroup[] = [...byFile.entries()]
458 .map(([file, rows]) => ({ file, same: file === focalFile, rows }))
459 .sort((a, b) => (a.same ? -1 : b.same ? 1 : a.file.localeCompare(b.file)));
460
461 return {
462 groups,
463 uncertain,
464 tests: {
465 rows: testRows,
466 calls: testRows.reduce((sum, row) => sum + row.relation.edgeCount, 0),
467 files: [...new Set(testRows.map((row) => row.relation.node.file))].sort(),
468 },
469 total: payload.incoming.total,
470 hiddenGroups: payload.incoming.total - payload.incoming.shown,
471 };
472}
473
474/* ----------------------------------------------------------- connectors -- */
475

Callers 1

Calls 7

relationWordsFunction · 0.85
synthesizedByFunction · 0.85
relationWhensFunction · 0.85
pushMethod · 0.80
mapMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected