Repository navigation
Description
Problem
The Go extractor drops the package qualifier from qualified_type nodes before emitting type-reference stubs. For example, *testing.T becomes a bare T stub. The corpus-level unique-stub rewire can then attach that stub to an unrelated local type or top-level function named T, manufacturing a high-degree phantom node.
This is the type-reference counterpart of #1313: Go import statements contain enough evidence to distinguish internal and external packages, but the qualifier is discarded before resolution.
Minimal repro
repro/
├── go.mod module example.com/repro
├── translate.go func T(message string) string { return message }
└── worker_test.go func TestBuild(t *testing.T) {}
// worker_test.go
package repro
import "testing"
func TestBuild(t *testing.T) {}Expected:
TestBuildreferences an externaltesting.Tnode.- No edge connects
TestBuildto the localT()function.
Actual on v8 / graphifyy 0.9.39:
- The qualified type is reduced to bare
T. - The
referencesedge is rewired to the unrelated localT()definition.
Real-corpus impact
On a Go service corpus, a local translation function named T() became a god node with 4,349 edges; 4,309 neighboring nodes came from tests using *testing.T or suite .T(). Ignoring *_test.go reduced the symptom, but it also removed legitimate test architecture from the graph and did not fix qualifier loss.
Common external types and aliases can trigger the same class of collision anywhere a matching bare symbol exists.
Suggested fix
- Preserve
alias.Typein the Go extractor instead of reducing it to the last segment. - Retain the file's alias-to-import-path map.
- Before generic stub rewiring, resolve internal types only when the candidate's canonical Go package path exactly matches the import path.
- Park unresolved external types on an import-path-qualified sourceless node such as
testing.T, so they cannot collide with local bare symbols. - Preserve the same behavior during incremental updates by consulting unchanged resolution-context nodes and edges.
Related
- Go AST: cross-package qualified calls (pkg.Func()) never produce EXTRACTED edges #1313 — cross-package qualified Go calls are not resolved from import evidence.
- Phantom god nodes from member-call name collisions in cross-file resolver #598 / Fix: prevent cross-file member-call name collisions in extract resolver #599 — phantom god nodes from member-call name collisions.
- Semantic extractor emits cross-language INFERRED
callsedges by collapsing common identifiers within a chunk #991 — common-name collisions pollute god-node ranking and community detection.
Investigation and minimal reproduction prepared with OpenAI Codex.
Activity
chore: bump to 0.9.40
safishamsi commentedon Aug 11, 2026
Fixed in v0.9.40 (
graphifyy==0.9.40on PyPI). A Go qualified type (pkg.Type) now resolves by the file's import path instead of losing the qualifier and binding by bare name to an unrelated same-named symbol; unresolved externals park on an import-path node rather than fabricating an edge. Thanks @gnukeno (PR #2609).