gortex icon indicating copy to clipboard operation
gortex copied to clipboard

External-call placeholders in a Python-only repo are labeled language "go"

Open sronix opened this issue 1 month ago • 0 comments

Describe the bug

I tried gortex on a Python-only repo (631 .py files, no Go at all), and gortex query stats lists Go as a language:

By language:
  go           867
  py           31
  python       31430
  ...

The "go" nodes are the external-call placeholders: 572 function nodes such as dep::collections.Counter::Counter and dep::concurrent.futures.ThreadPoolExecutor::ThreadPoolExecutor, plus 295 module nodes with ids like <repo>::module::go:threading. They also turn up in search, for example gortex query symbol ThreadPoolExecutor returns <repo>::module::go:threading.

From reading the source at c7abb9b, it looks like it comes from attributeGoExternalCalls in internal/resolver/external_call_attribution.go:

  • materializeGoExternalSeen sets Language: "go", Meta["ecosystem"] = "go" and a "go:"+importPath module id for every placeholder (lines 166 and 199).
  • splitGoExternalTarget accepts any dep::, external:: or stdlib:: target, and the Python resolver emits the same prefixes, so Python externals get picked up by the Go pass.
  • The pass is gated on graphHasLanguage("go"). I couldn't work out what first makes that true on a store that only holds this one Python repo, so I may be missing something there.

To Reproduce

  1. git clone https://github.com/Nauro-AI/nauro && cd nauro && git checkout 060874c
  2. gortex daemon start --detach && gortex track .
  3. gortex query stats

Expected behavior

Python externals keep the caller's language (or the Go pass skips non-Go callers), so a Python-only repo shows no Go.

Environment:

  • OS: macOS 26 (arm64)
  • Go version: n/a (Homebrew cask; binary built with go1.27.3)
  • Gortex version: v0.64.11+c7abb9b

Additional context

Two smaller things I noticed while looking, happy to split them out if that's easier:

  • Python shows up twice in the stats, as py and python. The py nodes are builtin stubs like <repo>::builtin::py::dict::items; builtin_stub_nodes.go:59 copies the family code from the stub id, while the parser uses python.
  • About 250 of the "go" placeholders are the repo's own modules (e.g. dep::nauro.sync.generation_refresh::unlink), which reminded me of #824. Calls through a package __init__ re-export (from nauro_core import operations then operations.check_decision(...)) end up on these dep:: stubs, so query callers misses them. That's with no Python LSP installed, so pyright may already cover it.

Thanks for gortex, it's been fun to dig into.

sronix avatar Nov 02 '26 11:11 sronix