Repository navigation
Description
Summary
A name bound by import { X } from "<external package>" is in neither JS/TS shadow set, so using it as a value produces a fabricated indirect_call edge (INFERRED, 0.8) to an unrelated same-named definition elsewhere in the corpus.
This is the same failure test_indirect_call_catch_binding_shadow.py documents for catch bindings — "read as an unresolved by-name reference, resolved against the corpus-wide label index, and fabricated an indirect_call edge (INFERRED, 0.8) to an unrelated same-named callable" — and the same one already fixed for single-parameter arrows and untracked closures (#2241 family). An import is simply a module-scoped binding, and it was never added to the set.
Reproduction
Two files, two packages. Widget comes from an external package; pkg-b happens to define a Widget() that consumer.tsx never imports.
// pkg-a/consumer.tsx
import { Widget, Search } from 'some-external-pkg';
export function buildMenu() {
return [{ label: 'p', icon: Widget }, { label: 'f', icon: Search }];
}// pkg-b/Widget.tsx
export function Widget() { return null; }$ graphify update .
indirect_call pkg_a_consumer_buildmenu -> pkg_b_widget_widget [INFERRED]
consumer.tsx never references pkg-b. Search, imported from the same external package and used the same way, correctly produces nothing — because no local definition shares its name. That contrast is the mechanism: it is the unique-label fallback firing on an identifier that is already bound.
Reproduced on v8 @ 7281f27 (0.9.43).
Why it lands often in practice
Icon kits collide with component names. Found on a monorepo where three unrelated components appeared to call a Palette() in a different package; all three import the lucide-react icon of that name. analyze.py::_surprise_score then pays +2 for crossing a directory, +2 for crossing a file type and +2 for INFERRED — so these edges lead the "Surprising Connections" section of GRAPH_REPORT.md, where they read as discoveries.
Mechanism
_js_local_bound_names collects a function's locals from parameters and variable_declarator nodes; _js_module_bound_names collects only the latter. An import_statement binding is neither, so the name never reaches the shadow check in _emit_indirect_ref and falls through to _rewire_unique_stub_nodes' label index.
Suggested fix
Collect names bound by an import whose specifier the resolver says is external, and consult that set in _emit_indirect_ref — an import binds the whole module, so one file-level set covers every scope.
Deciding "external" by asking _resolve_js_import_target rather than forming a second opinion keeps relative imports resolving, which is the behaviour that must not regress. One extra condition is needed: a tsconfig paths entry pointing a package at its own installed copy ("lucide-react": ["./node_modules/lucide-react"], which is common) does resolve — to a tree every scan prunes — so a resolved path containing node_modules still counts as external.
Tests
A patch along those lines is on a fork branch if it is useful — happy to open a PR.
- 7 new tests in
tests/test_indirect_call_external_import_shadow.py, modelled on the existing shadow tests: 5 red onv8without the patch, 7 green with it. The 2 that pass either way are the counter-tests that bound the fix — a relative import must still resolve, and an unshadowed by-name reference in a file that also imports something external must still emit. - Full suite, same machine, with and without:
5 failed / 4386 passed→5 failed / 4393 passed. Identical failures both ways (test_ollama_retry_capneedsopenai,test_installneeds the codex CLI), so they are environmental; the delta is exactly the 7 new tests.
Activity
fix: an import from outside the corpus must shadow indirect_call reso…
docs(skill): credit is what wakes you, not what you may publish
fix(js): an import from outside the corpus shadows indirect_call reso…
test(js): cover external-import-shadow vs same-named local callable (#…
fix(js): shadow untracked function-expression bindings from indirect_…
chore: bump to 0.9.44
safishamsi commentedon Aug 15, 2026
Fixed in v0.9.44 (on PyPI now) via #2758, thanks @phudayyy. Closing.
docs(skill): merge a record-only PR without asking (#8)