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
fix(php): classify proven vendor calls by their vendor class
Martin Vogel8815b5db9a78
diff --git a/internal/cbm/lsp/php_lsp.c b/internal/cbm/lsp/php_lsp.cindex 13755608d..f08aa3908 100644--- a/internal/cbm/lsp/php_lsp.c+++ b/internal/cbm/lsp/php_lsp.c@@ -1448,6 +1448,16 @@ static void emit_external_or_unindexed(PHPLSPContext *ctx, const char *class_qn,emit_resolved_kind(ctx, target, unindexed_strategy, 0.55f, kind);}+/* A method the registry DOES hold on a class reached through a vendor `use`+ * (a seeded library type such as GuzzleHttp.Client) is just as far outside+ * the project: the graph has no node for it either, so its row must carry the+ * same php_external_receiver proof, or the pipeline falls through to a+ * name-only binding of the call to a same-named project method (#1186). */+static const char *php_receiver_strategy(const PHPLSPContext *ctx, const char *class_qn,+ const char *strategy) {+ return php_external_qn(ctx, class_qn) ? "php_external_receiver" : strategy;+}+static void emit_unresolved(PHPLSPContext *ctx, const char *expr_text, const char *reason) {if (!ctx->resolved_calls || !ctx->enclosing_func_qn)return;@@ -1747,7 +1757,8 @@ static void resolve_member_call(PHPLSPContext *ctx, TSNode call, CBMResolvedKindconst char *strategy = (f->receiver_type && strcmp(f->receiver_type, class_qn) == 0)? "php_method_typed": "php_method_inherited";- emit_resolved_kind(ctx, f->qualified_name, strategy, 0.95f, kind);+ emit_resolved_kind(ctx, f->qualified_name, php_receiver_strategy(ctx, class_qn, strategy),+ 0.95f, kind);return;}/* Receiver known but method missing — magic __call? The call dispatches to@@ -1794,6 +1805,7 @@ static void resolve_static_call(PHPLSPContext *ctx, TSNode call, CBMResolvedKindstrategy = "php_self_static";} else {class_qn = php_resolve_class_name(ctx, cls);+ strategy = php_receiver_strategy(ctx, class_qn, strategy);}}}diff --git a/src/pipeline/lsp_resolve.h b/src/pipeline/lsp_resolve.hindex 4d91dbae8..d67918735 100644--- a/src/pipeline/lsp_resolve.h+++ b/src/pipeline/lsp_resolve.h@@ -27,6 +27,7 @@#include "graph_buffer/graph_buffer.h"#include "foundation/constants.h"#include "pipeline/pipeline.h" /* cbm_registry_unique_field_qn, cbm_resolution_t */+#include "service_patterns.h" /* cbm_service_pattern_match for cbm_pipeline_service_name */#include <ctype.h>#include <stdio.h>@@ -342,6 +343,25 @@ static inline bool cbm_pipeline_lsp_external_receiver(const CBMResolvedCall *resstrcmp(resolved->strategy, "php_external_receiver") == 0;}+/* The service-pattern name of a call: its callee text, or, when that names no+ * service and the LSP proved the receiver a vendor class, the vendor method+ * (`GuzzleClient::get` -> `GuzzleHttp.Client.get`). The extractor names a+ * scoped call by its method alone, and such a call never reaches the+ * registry, so the vendor class is its only service evidence (#1186). */+static inline const char *cbm_pipeline_service_name(const CBMCall *call,+ const CBMResolvedCall *external,+ cbm_svc_kind_t *kind) {+ *kind = cbm_service_pattern_match(call->callee_name);+ if (*kind == CBM_SVC_NONE && cbm_pipeline_lsp_external_receiver(external) &&+ external->callee_qn && external->callee_qn[0]) {+ *kind = cbm_service_pattern_match(external->callee_qn);+ if (*kind != CBM_SVC_NONE) {+ return external->callee_qn;+ }+ }+ return call->callee_name;+}+static inline bool cbm_pipeline_invocation_reason_join_strategy(const char *strategy) {return strategy &&(strcmp(strategy, "lsp_func_ptr") == 0 || strcmp(strategy, "lsp_callable_alias") == 0 ||diff --git a/src/pipeline/pass_calls.c b/src/pipeline/pass_calls.cindex 0398a5443..0675e9420 100644--- a/src/pipeline/pass_calls.c+++ b/src/pipeline/pass_calls.c@@ -757,14 +757,19 @@ static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call, const CBMemit_http_async_edge(ctx, &routed, source_node, NULL, &svc_res, CBM_SVC_HTTP, false);return SKIP_ONE;}- cbm_svc_kind_t csvc = cbm_service_pattern_match(call->callee_name);+ /* A PHP call on a proven vendor class is classified by that class+ * (#1186): it skips the registry below, so the route-verb fallback would+ * otherwise mint a route registration for `GuzzleClient::get('/x')`. An+ * LSP row with a graph target returned above. MUST match pass_parallel.c. */+ cbm_svc_kind_t csvc;+ const char *svc_name = cbm_pipeline_service_name(call, lsp, &csvc);if (csvc == CBM_SVC_HTTP || csvc == CBM_SVC_ASYNC) {const char *cu = call->first_string_arg;bool chas_url = cu && cu[0] != '\0' &&(cu[0] == '/' || strstr(cu, "://") != NULL ||(csvc == CBM_SVC_ASYNC && strlen(cu) > PAIR_LEN));if (chas_url) {- cbm_resolution_t svc_res = {.qualified_name = call->callee_name,+ cbm_resolution_t svc_res = {.qualified_name = svc_name,.confidence = PC_SVC_PATTERN_CONF,.strategy = "service_pattern",.candidate_count = 0};diff --git a/src/pipeline/pass_parallel.c b/src/pipeline/pass_parallel.cindex bbd8456b6..ec4845cc6 100644--- a/src/pipeline/pass_parallel.c+++ b/src/pipeline/pass_parallel.c@@ -3327,14 +3327,19 @@ static void resolve_file_calls(resolve_ctx_t *rc, resolve_worker_state_t *ws, CBCBM_SVC_HTTP, client_url);continue;}- cbm_svc_kind_t csvc = cbm_service_pattern_match(call->callee_name);+ /* A PHP call on a proven vendor class is classified by that class+ * (#1186): it skipped the registry above, so the route-verb fallback+ * would otherwise mint a route registration for+ * `GuzzleClient::get('/x')`. MUST match pass_calls.c. */+ cbm_svc_kind_t csvc;+ const char *svc_name = cbm_pipeline_service_name(call, lsp_target ? NULL : lsp, &csvc);if (csvc == CBM_SVC_HTTP || csvc == CBM_SVC_ASYNC) {const char *cu = call->first_string_arg;bool chas_url = cu && cu[0] != '\0' &&(cu[0] == '/' || strstr(cu, "://") != NULL ||(csvc == CBM_SVC_ASYNC && strlen(cu) > PP_ESC_SPACE));if (chas_url) {- cbm_resolution_t svc_res = {.qualified_name = call->callee_name,+ cbm_resolution_t svc_res = {.qualified_name = svc_name,.confidence = PP_HALF_CONF,.strategy = "service_pattern"};emit_service_edge(ws->local_edge_buf, source_node, source_node, call, &svc_res,