You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(pipeline): suppress weak short-name matches for Go selector calls
A Go selector call x.foo() whose receiver the Go LSP cannot type falls
through to the generic registry resolver, which binds it by bare short
name to an arbitrary same-named project symbol. Stdlib calls are the
worst case: f.Close() on an *os.File gets a CALLS edge to whatever
project Close wins candidate ranking (measured on a real Go repo:
confidence 0.11, 15 candidates; suffix_match + unique_name were 36% of
all CALLS edges, and one 14-line stdlib-only function got 3 out of 3
false outbound edges).
Extend the TS/JS receiver-aware guard (#592/#606) to Go:
- extract_calls.c: flag Go call_expression with a selector_expression
callee as is_method, mirroring the TS/JS member_expression flag.
- registry.c: add cbm_go_suppress_weak_method_match. Unlike the TS/JS
drop-list, field_type_hint is KEPT (Go struct fields carry declared
types, so the hint is receiver-aware — lrp_go_s8_field_type_hint),
and unique_name is dropped only when its confidence carries the
import-unreachability penalty (the stdlib-hijack shape); an
unpenalized lone candidate inside the caller's import closure never
enters the field-type-hint upgrade and must survive.
- pass_calls.c / pass_parallel.c: feed the Go gate next to the TS/JS
one; the drop still defers to the emit path so service/route/HTTP
edges stay main-identical.
Reproduce-first: pipeline_go_receiver_suppresses_weak_method_edge is
RED without the extractor flag (the f.Close -> project Close edge
exists) and GREEN with it; typed same-package calls, bare local calls
and import-qualified cross-package calls still resolve. The old
extraction contract test used Go as the flag-exempt language — Python
takes that role, and extract_go_selector_call_flags_is_method pins the
new behavior.
Signed-off-by: Ilya Brykau <ilya.brykau@orca.security>
0 commit comments