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
chore: merge upstream main into issue 2265 branch
Pcristine489badf4d90
diff --cc internal/cbm/cbm.hindex 5e3bc6d98,dc89a6b2d..bb945be6b--- a/internal/cbm/cbm.h+++ b/internal/cbm/cbm.h@@@ -302,12 -306,17 +306,21 @@@ typedef struct// (self.compiler.apply_converters()). An object the// class owns, not a parameter: read by the weak-member// guard's unique-name exemption. Default false.+ /* Ephemeral coverage evidence, set only while resolving this file. Capture+ * it before releasing a spilled result; never retain registry pointers. */+ bool coverage_calls_emitted;+ const char *coverage_candidate_qn;} CBMCall;+ // What an import statement names, when the syntax says so. Only PHP's+ // `use function` / `use const` set a non-default kind today: they name a+ // namespace MEMBER, so they must never be mapped to a class file (#1186).+ typedef enum {+ CBM_IMPORT_KIND_DEFAULT = 0, // module / class / namespace (language default)+ CBM_IMPORT_KIND_FUNCTION, // PHP `use function A\b`+ CBM_IMPORT_KIND_CONST, // PHP `use const A\B`+ } CBMImportKind;+typedef struct {const char *local_name; // local alias or nameconst char *module_path; // resolved module path / QNdiff --cc src/pipeline/pass_calls.cindex b04f4e1ad,668919682..7882a2307--- a/src/pipeline/pass_calls.c+++ b/src/pipeline/pass_calls.c@@@ -374,11 -375,17 +375,17 @@@ bool cbm_pipeline_http_client_call_url(return n > 0 && (size_t)n < out_sz;}- /* Handle a route registration call: create Route node + HANDLES edge. */+ /* Handle a route registration call: create Route node + HANDLES edge.+ * route_mount is the framework mount of the registering file ("/api" for a+ * Laravel 11+ `withRouting(api: ...)` file, #1146) or "". */-static void handle_route_registration(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+static void handle_route_registration(cbm_pipeline_ctx_t *ctx, CBMCall *call,const cbm_gbuf_node_t *source_node, const char *module_qn,- const char **imp_keys, const char **imp_vals, int imp_count) {+ const char **imp_keys, const char **imp_vals, int imp_count,+ const char *route_mount) {const char *method = cbm_service_pattern_route_method(call->callee_name);+ char mounted[CBM_SZ_256];+ const char *path =+ cbm_laravel_mount_route(route_mount, call->first_string_arg, mounted, sizeof(mounted));char route_qn[CBM_ROUTE_QN_SIZE];char cpath[CBM_SZ_256];snprintf(route_qn, sizeof(route_qn), "__route__%s__%s", method ? method : "ANY",@@@ -678,10 -681,9 +686,10 @@@ static int resolve_single_call(cbm_piperes.qualified_name = target_node->qualified_name;res.confidence = lsp->confidence;res.strategy = lsp->strategy;- res.candidate_count = 1;+ res.candidate_count = CBM_ALLOC_ONE;+ call->coverage_candidate_qn = target_node->qualified_name;emit_classified_edge(ctx, call, source_node, target_node, &res, module_qn, imp_keys,- imp_vals, imp_count, false);+ imp_vals, imp_count, false, route_mount);return SKIP_ONE;}}@@@ -891,11 -893,23 +899,24 @@@* Store.commit() call to a JS function named commit (or a Bash main* to a Python main). Drop that weak cross-language edge. */if (cbm_suppress_cross_language_suffix_match(lang, target_node->file_path, res.strategy)) {+ /* Refusing the binding leaves the callee unresolved, and an+ * unresolved route-registration callee is still a registration:+ * `Route::get('/x', ...)` beside a JS `get`, `app.get('/x', h)`+ * beside a Python `get`. Give it the same Route the #952+ * unresolved-callee fallback above mints, and nothing else. Dropping+ * the whole call lost every GET registration in a mixed-language repo+ * while POST (no `post` to collide with) survived. */+ if (cbm_service_pattern_route_method(call->callee_name) != NULL && call->first_string_arg &&+ call->first_string_arg[0] == '/') {+ handle_route_registration(ctx, call, source_node, module_qn, imp_keys, imp_vals,+ imp_count, route_mount);+ return SKIP_ONE;+ }return 0;}+ call->coverage_candidate_qn = target_node->qualified_name;emit_classified_edge(ctx, call, source_node, target_node, &res, module_qn, imp_keys, imp_vals,- imp_count, drop_plain_call);+ imp_count, drop_plain_call, route_mount);return SKIP_ONE;}diff --cc src/pipeline/pass_parallel.cindex 55cfe0ae1,a8a9f3693..0073e2a5d--- a/src/pipeline/pass_parallel.c+++ b/src/pipeline/pass_parallel.c@@@ -2212,13 -2266,18 +2269,17 @@@ static void emit_normal_calls_edge(cbm_}/* Classify a resolved call by library identity and emit the appropriate edge. */- /* Create Route node + CALLS + HANDLES edges for a route registration call. */+ /* Create Route node + CALLS + HANDLES edges for a route registration call.+ * route_mount is the framework mount of the registering file ("/api" for a+ * Laravel 11+ `withRouting(api: ...)` file, #1146) or "". */-static void emit_route_registration(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source,- const CBMCall *call, const char *route_path,- const char *handler_ref, const char *module_qn,- const cbm_registry_t *registry, const cbm_gbuf_t *main_gbuf,- const char **ik, const char **iv, int ic,- const char *route_mount) {+static void emit_route_registration(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source, CBMCall *call,+ const char *route_path, const char *handler_ref,+ const char *module_qn, const cbm_registry_t *registry,+ const cbm_gbuf_t *main_gbuf, const char **ik, const char **iv,- int ic) {++ int ic, const char *route_mount) {const char *method = cbm_service_pattern_route_method(call->callee_name);+ char mounted[CBM_SZ_256];+ route_path = cbm_laravel_mount_route(route_mount, route_path, mounted, sizeof(mounted));char rqn[CBM_ROUTE_QN_SIZE];char cpath[CBM_SZ_256];snprintf(rqn, sizeof(rqn), "__route__%s__%s", method ? method : "ANY",@@@ -2580,7 -2646,43 +2649,43 @@@ static void emit_service_edge(cbm_gbuf_emit_normal_calls_edge(gbuf, source, target, call, res);}- detect_url_in_args(gbuf, source, call);+ /* The arg-URL heuristic is for calls no service pattern knows (a local+ * fetch wrapper). On a classified HTTP call it only minted a method-less+ * __route__ANY__ twin of the typed edge, which cross-repo matching then+ * bound to server handlers of any method. */+ if (!http_edge_emitted) {+ detect_url_in_args(gbuf, source, call);+ }+ }++ /* The #725 guard refuses a suffix_match binding across a language boundary,+ * which leaves the callee unresolved. An unresolved callee the route+ * classifier recognises is still a registration: `Route::get('/x', ...)`+ * beside a JS `get`, `app.get('/x', h)` beside a Python `get`. Emit exactly+ * the Route + CALLS + HANDLES that the unresolved-callee (callee_suffix)+ * fallback in resolve_file_calls emits for it, classified by callee name the+ * same way emit_service_edge classifies that fallback, and nothing else: no+ * CALLS edge to the refused target and no URL-argument scan. Dropping the+ * whole call lost every GET registration in a mixed-language repo while POST+ * (no `post` to collide with) survived. Mirrors pass_calls.c. */-static void emit_xlang_refused_route(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source,- const CBMCall *call, const char *module_qn,- const cbm_registry_t *registry, const cbm_gbuf_t *main_gbuf,- const char **imp_keys, const char **imp_vals, int imp_count,++static void emit_xlang_refused_route(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source, CBMCall *call,++ const char *module_qn, const cbm_registry_t *registry,++ const cbm_gbuf_t *main_gbuf, const char **imp_keys,++ const char **imp_vals, int imp_count,+ const char *route_mount) {+ if (cbm_service_pattern_route_method(call->callee_name) == NULL) {+ return;+ }+ cbm_svc_kind_t svc = cbm_service_pattern_match(call->callee_name);+ if (svc != CBM_SVC_NONE && svc != CBM_SVC_ROUTE_REG) {+ return;+ }+ const char *handler_ref = NULL;+ const char *route_path = find_route_path_in_args(call, &handler_ref);+ if (route_path) {+ emit_route_registration(gbuf, source, call, route_path, handler_ref, module_qn, registry,+ main_gbuf, imp_keys, imp_vals, imp_count, route_mount);+ }}/* Find the source node for an edge: enclosing function or file node. */