Skip to content

fix: kind mismatch causes missed detections for references #4

@TonyStef

Description

@TonyStef

Problem

symbols_referenced hardcodes kind: 'variable' for all imports (src/core.ts, line 86):

symbolsReferenced.push({ name, file: resolvedFile, kind: 'variable' });

But the actual symbol could be a function, type, interface, etc. The detection engine in symbolMatches() (src/graph/detect.ts, line 38-39) requires exact kind equality:

return stored.name === target.name && stored.file === target.file && stored.kind === target.kind;

So a reference to a function is stored as kind: 'variable' and never matches a deleted kind: 'function'.

Fix

In symbolMatches(), when comparing against symbols_referenced entries, match on name + file only, ignoring kind. References inherently don't know the kind at parse time.

Alternatively, look up the actual kind from the target file at store time — but that's more complex and slower.

Severity

This is a pre-existing bug that affects every import reference. The only reason existing tests pass is that the test fixtures use the same kind for both added and referenced symbols.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions