Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Merge branch 'main' into fix/go-weak-selector-calls
Martin Vogel285d21c1f1c6
diff --cc src/pipeline/pass_calls.cindex 7d8e68196,1eb3bddff..547552048--- a/src/pipeline/pass_calls.c+++ b/src/pipeline/pass_calls.c@@@ -657,8 -1120,13 +1126,15 @@@ static int resolve_single_call(cbm_piperes.strategy)) ||cbm_suppress_weak_local_binding_call(suppress_weak_local_binding,call->callee_is_locally_bound, res.strategy) ||+ cbm_go_suppress_weak_method_match(lang == CBM_LANG_GO, call->is_method, res.strategy,- res.confidence);++ res.confidence) ||+ /* Import-binding suppression (#2127): an external `from m import f`+ * binds `f` for the whole module, so a weak short-name match onto a+ * project `X.f` outside m is fabricated. Python-only (the import+ * paths are module chains) — MUST match pass_parallel.c exactly. */+ (lang == CBM_LANG_PYTHON && cbm_suppress_weak_import_bound_call(true, true, res.strategy) &&+ cbm_python_import_binding_contradicts(imports, call->callee_name, res.qualified_name,+ ctx->gbuf, ctx->project_name, rel));/* Service-pattern HTTP/ASYNC calls to an EXTERNAL client library (e.g.* `requests.get("/api/orders/{id}")`) resolve to a QN containing the librarydiff --cc src/pipeline/pass_parallel.cindex 41c15b099,2c0a9023a..37bdc26d4--- a/src/pipeline/pass_parallel.c+++ b/src/pipeline/pass_parallel.c@@@ -2960,8 -3353,13 +3355,15 @@@ static void resolve_file_calls(resolve_call->callee_name, res.strategy)) ||cbm_suppress_weak_local_binding_call(suppress_weak_local_binding,call->callee_is_locally_bound, res.strategy) ||+ cbm_go_suppress_weak_method_match(lang == CBM_LANG_GO, call->is_method, res.strategy,- res.confidence);++ res.confidence) ||+ /* Import-binding suppression (#2127) — see pass_calls.c; this gate+ * MUST stay identical to the one there. */+ (lang == CBM_LANG_PYTHON &&+ cbm_suppress_weak_import_bound_call(true, true, res.strategy) &&+ cbm_python_import_binding_contradicts(&result->imports, call->callee_name,+ res.qualified_name, rc->main_gbuf,+ rc->project_name, rel));/* Service-pattern HTTP/ASYNC client call (`requests.get(url)`): the* service signal lives in the callee_name. The registry can mis-resolvediff --cc src/pipeline/pipeline.hindex ea0a7d04e,b0ba5bc15..2baa24f81--- a/src/pipeline/pipeline.h+++ b/src/pipeline/pipeline.h@@@ -320,15 -378,16 +378,25 @@@ bool cbm_weak_member_unique_name_exemptbool cbm_suppress_weak_local_binding_call(bool enabled, bool callee_is_locally_bound,const char *strategy);+/* Go analog of the TS/JS guard, same failure class: a selector call whose+ * receiver the Go LSP could not type must not be bound by a receiver-blind+ * short-name strategy. Drops suffix_match / fuzzy always, and unique_name only+ * when its confidence is import-unreachability-penalized (the stdlib/vendor+ * hijack shape). field_type_hint is deliberately NOT dropped for Go — struct+ * fields carry declared types, so the hint is receiver-aware there. */+bool cbm_go_suppress_weak_method_match(bool is_go, bool is_method, const char *strategy,+ double confidence);++ /* Import-binding counterpart (#2127). True when the callee's root identifier+ * is bound by an import of this file whose module chain contradicts the+ * resolved target (`from unittest.mock import patch; patch()` must not bind a+ * project `PkgConfigView.patch`), and the match came from a weak short-name+ * strategy. Same drop-list as the guards above; the language set lives at the+ * call sites and must be identical in pass_calls.c and pass_parallel.c.+ * Pure; unit-tested in test_registry.c. */+ bool cbm_suppress_weak_import_bound_call(bool enabled, bool import_binding_contradicts,+ const char *strategy);+/* #725: drop a suffix_match CALLS edge when the caller language and the* target file's language disagree. unique_name (candidates == 1) is #1572* and is left alone; same_module / import_map / lsp_* are kept. JS/TS/TSXdiff --cc src/pipeline/registry.cindex db515aa67,f53d1dd12..cbfa4ec5d--- a/src/pipeline/registry.c+++ b/src/pipeline/registry.c@@@ -695,33 -748,22 +748,49 @@@ bool cbm_suppress_weak_local_binding_careturn weak_short_name_strategy(strategy);}+bool cbm_go_suppress_weak_method_match(bool is_go, bool is_method, const char *strategy,+ double confidence) {+ if (!is_go || !is_method || !strategy || !strategy[0]) {+ return false;+ }+ /* Go analog of the TS/JS guard above, same failure class: a selector call+ * whose receiver the Go LSP could not type reaches the registry and a bare+ * short-name strategy binds it to an arbitrary same-named project symbol+ * (`f.Close()` on an os.File -> a project `Close`, suffix_match over 15+ * candidates). Unlike the TS/JS list, field_type_hint is KEPT: a Go struct+ * field carries a declared type, so the parallel resolver's field-type+ * hint is receiver-aware for Go (lrp_go_s8_field_type_hint), not a+ * heuristic. */+ if (strcmp(strategy, "suffix_match") == 0 || strcmp(strategy, "fuzzy") == 0) {+ return true;+ }+ /* unique_name is dropped only when PENALIZED: resolve_name_lookup scales+ * CONF_UNIQUE_NAME by DEFAULT_CONFIDENCE exactly when the lone candidate+ * is not reachable through the caller's imports — the stdlib/vendor+ * hijack shape (`io.Copy` -> a project `Copy`). An unpenalized+ * unique_name target sits inside the caller's import closure (or the+ * file has no imports, e.g. a same-package call) and must be kept —+ * dropping it kills genuinely-typed lone-candidate calls that never+ * enter the field-type-hint upgrade (candidate_count == 1). */+ return strcmp(strategy, "unique_name") == 0 && confidence < CONF_UNIQUE_NAME;+}++ /* Import-binding counterpart of the parameter guard above (#2127). An import+ * binds the identifier for the whole module; when that import is external it+ * never materializes, and the chain falls through to project-wide short-name+ * strategies (`from unittest.mock import patch; patch()` -> a REST view's+ * `PkgConfigView.patch`). The caller decides whether the binding contradicts+ * the target (cbm_python_import_binding_contradicts: a SCOPE FACT about this+ * file, not a spelling list); only weak strategies are dropped, so import_map /+ * same_module / lsp_* edges are untouched. Pure; unit-tested in test_registry.c. */+ bool cbm_suppress_weak_import_bound_call(bool enabled, bool import_binding_contradicts,+ const char *strategy) {+ if (!enabled || !import_binding_contradicts) {+ return false;+ }+ return weak_short_name_strategy(strategy);+ }+static bool js_ts_family(CBMLanguage lang) {return lang == CBM_LANG_JAVASCRIPT || lang == CBM_LANG_TYPESCRIPT || lang == CBM_LANG_TSX ||lang == CBM_LANG_ARKTS;diff --cc tests/test_pipeline.cindex b2ab5fd04,b52513ace..4da054b14--- a/tests/test_pipeline.c+++ b/tests/test_pipeline.c@@@ -15436,12 -23613,20 +23706,21 @@@ SUITE(pipeline)RUN_TEST(pipeline_python_receiver_suppresses_weak_method_edge);RUN_TEST(pipeline_python_receiver_keeps_specific_unique_name_member_call);RUN_TEST(pipeline_html_embedded_member_call_stays_unbound);+ RUN_TEST(pipeline_go_receiver_suppresses_weak_method_edge);RUN_TEST(pipeline_go_rw_usage_never_cross_into_c);RUN_TEST(pipeline_go_rw_usage_never_cross_into_c_parallel);+ RUN_TEST(pipeline_rust_std_receiver_never_binds_project_method);+ RUN_TEST(pipeline_rust_std_receiver_never_binds_project_method_parallel);RUN_TEST(pipeline_go_bare_ref_never_binds_field);RUN_TEST(pipeline_go_bare_ref_never_binds_field_parallel);+ RUN_TEST(pipeline_c_call_reaches_header_function_beside_field);+ RUN_TEST(pipeline_c_call_reaches_header_function_beside_field_parallel);+ RUN_TEST(pipeline_c_member_access_binds_field_by_object_type);+ RUN_TEST(pipeline_c_member_access_binds_field_by_object_type_parallel);RUN_TEST(pipeline_tsjs_receiver_parallel_keeps_service_edges);+ RUN_TEST(pipeline_capitalized_axios_import_is_http_client);+ RUN_TEST(pipeline_capitalized_axios_import_is_http_client_sequential);+ RUN_TEST(pipeline_python_websocket_decorators_register_routes);RUN_TEST(pipeline_python_receiver_parallel_suppresses_weak_method_edges);RUN_TEST(pipeline_python_bare_local_binding_suppresses_weak_edge);RUN_TEST(pipeline_python_bare_local_binding_parallel_suppresses_weak_edge);diff --cc tests/test_registry.cindex 1ff49d84b,45fd6db14..e25ba369e--- a/tests/test_registry.c+++ b/tests/test_registry.c@@@ -1290,7 -2065,8 +2105,10 @@@ SUITE(registry)RUN_TEST(weak_member_unique_name_exempt_is_python_self_rooted_unique_and_specific_only);RUN_TEST(local_binding_suppress_drops_weak_shadowed_bare_calls);RUN_TEST(local_binding_suppress_keeps_unshadowed_and_strong_strategies);+ RUN_TEST(import_binding_suppress_drops_only_weak_contradicted_calls);+ RUN_TEST(python_import_binding_contradicts_only_foreign_chains);+ RUN_TEST(python_external_base_contradicts_django_shapes);RUN_TEST(weak_call_guards_share_one_drop_list);+ RUN_TEST(go_suppress_drops_weak_selector_matches);+ RUN_TEST(go_suppress_keeps_typed_and_import_aware_matches);}