From 27d6298858f7a04a8341c2b98d67f20d77666ca0 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sun, 8 Mar 2026 21:12:44 -0600 Subject: [PATCH 1/3] fix: use CORE_SYMBOL_KINDS in flow matching for interfaces/types/structs flow's findMatchingNodes was limited to FUNCTION_KINDS, so `codegraph flow` couldn't trace from interfaces, types, or struct declarations. Pass CORE_SYMBOL_KINDS via opts.kinds override so all 10 core symbol kinds are searchable. Also support opts.kinds array in findMatchingNodes as a general-purpose override alongside the existing opts.kind scalar. Impact: 2 functions changed, 21 affected --- src/flow.js | 10 ++++++---- src/queries.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/flow.js b/src/flow.js index 84bbc40b..6679df83 100644 --- a/src/flow.js +++ b/src/flow.js @@ -7,7 +7,7 @@ import { openReadonlyOrFail } from './db.js'; import { paginateResult } from './paginate.js'; -import { findMatchingNodes, kindIcon } from './queries.js'; +import { CORE_SYMBOL_KINDS, findMatchingNodes, kindIcon } from './queries.js'; import { outputResult } from './result-formatter.js'; import { FRAMEWORK_ENTRY_PREFIXES } from './structure.js'; import { isTestFile } from './test-filter.js'; @@ -96,13 +96,15 @@ export function flowData(name, dbPath, opts = {}) { const maxDepth = opts.depth || 10; const noTests = opts.noTests || false; - // Phase 1: Direct LIKE match on full name - let matchNode = findMatchingNodes(db, name, opts)[0] ?? null; + // Phase 1: Direct LIKE match on full name (use all 10 core symbol kinds, + // not just FUNCTION_KINDS, so flow can trace from interfaces/types/structs/etc.) + const flowOpts = { ...opts, kinds: CORE_SYMBOL_KINDS }; + let matchNode = findMatchingNodes(db, name, flowOpts)[0] ?? null; // Phase 2: Prefix-stripped matching — try adding framework prefixes if (!matchNode) { for (const prefix of FRAMEWORK_ENTRY_PREFIXES) { - matchNode = findMatchingNodes(db, `${prefix}${name}`, opts)[0] ?? null; + matchNode = findMatchingNodes(db, `${prefix}${name}`, flowOpts)[0] ?? null; if (matchNode) break; } } diff --git a/src/queries.js b/src/queries.js index f6eeb64e..6b11d324 100644 --- a/src/queries.js +++ b/src/queries.js @@ -164,7 +164,7 @@ function resolveMethodViaHierarchy(db, methodName) { * Scoring: exact=100, prefix=60, word-boundary=40, substring=10, plus fan-in tiebreaker. */ export function findMatchingNodes(db, name, opts = {}) { - const kinds = opts.kind ? [opts.kind] : FUNCTION_KINDS; + const kinds = opts.kind ? [opts.kind] : opts.kinds || FUNCTION_KINDS; const placeholders = kinds.map(() => '?').join(', '); const params = [`%${name}%`, ...kinds]; From 85b523855664984eb141e0f1011d8b8ed011fe2b Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sun, 8 Mar 2026 21:34:05 -0600 Subject: [PATCH 2/3] fix: guard against empty opts.kinds array in findMatchingNodes Impact: 1 functions changed, 5 affected --- src/queries.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/queries.js b/src/queries.js index 6b11d324..221459a3 100644 --- a/src/queries.js +++ b/src/queries.js @@ -164,7 +164,7 @@ function resolveMethodViaHierarchy(db, methodName) { * Scoring: exact=100, prefix=60, word-boundary=40, substring=10, plus fan-in tiebreaker. */ export function findMatchingNodes(db, name, opts = {}) { - const kinds = opts.kind ? [opts.kind] : opts.kinds || FUNCTION_KINDS; + const kinds = opts.kind ? [opts.kind] : (opts.kinds?.length ? opts.kinds : FUNCTION_KINDS); const placeholders = kinds.map(() => '?').join(', '); const params = [`%${name}%`, ...kinds]; From 06fb91b7efd171b8ade8ad92605d70b28b0a5360 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Sun, 8 Mar 2026 21:34:39 -0600 Subject: [PATCH 3/3] style: remove unnecessary parens to satisfy Biome formatter Impact: 1 functions changed, 5 affected --- src/queries.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/queries.js b/src/queries.js index 221459a3..75431b3b 100644 --- a/src/queries.js +++ b/src/queries.js @@ -164,7 +164,7 @@ function resolveMethodViaHierarchy(db, methodName) { * Scoring: exact=100, prefix=60, word-boundary=40, substring=10, plus fan-in tiebreaker. */ export function findMatchingNodes(db, name, opts = {}) { - const kinds = opts.kind ? [opts.kind] : (opts.kinds?.length ? opts.kinds : FUNCTION_KINDS); + const kinds = opts.kind ? [opts.kind] : opts.kinds?.length ? opts.kinds : FUNCTION_KINDS; const placeholders = kinds.map(() => '?').join(', '); const params = [`%${name}%`, ...kinds];