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 origin/main into fix/2537-go-net-http-servemux-patterns-with-a-met
Martin Vogelf33f976458d0
diff --cc src/pipeline/pass_calls.cindex f88294464,b9cc89c5b..c94994cc3--- a/src/pipeline/pass_calls.c+++ b/src/pipeline/pass_calls.c@@@ -832,14 -824,12 +841,12 @@@ static bool emit_classified_edge(cbm_pibool suppress_plain_calls, const char *route_mount,CBMLanguage lang) {cbm_svc_kind_t svc = cbm_service_pattern_match(res->qualified_name);- if (svc == CBM_SVC_ROUTE_REG && call->first_string_arg && call->first_string_arg[0] == '/') {+ if (svc == CBM_SVC_ROUTE_REG && route_reg_path(call, lang) != NULL) {- handle_route_registration(ctx, call, source, module_qn, imp_keys, imp_vals, imp_count,- route_mount, lang);- return;+ return handle_route_registration(ctx, call, source, module_qn, imp_keys, imp_vals,+ imp_count, route_mount, lang);}if (svc == CBM_SVC_HTTP || svc == CBM_SVC_ASYNC) {- emit_http_async_edge(ctx, call, source, target, res, svc, suppress_plain_calls);- return;+ return emit_http_async_edge(ctx, call, source, target, res, svc, suppress_plain_calls);}if (svc == CBM_SVC_CONFIG) {char esc_c[CBM_SZ_256];@@@ -885,6 -875,198 +892,198 @@@ static const cbm_gbuf_node_t *calls_finreturn src;}+ static CBMCallEvidence *calls_evidence_at(CBMCallEvidence *evidence, int index,+ CBMCallEvidence *fallback) {+ if (evidence) {+ return &evidence[index];+ }+ return fallback;+ }++ static CBMCallEvidence *calls_evidence_new(cbm_pipeline_t *pipeline, const CBMFileResult *result) {+ CBMCallEvidence *evidence =+ cbm_calloc(CBM_MEM_CLASS_RESOLVE, (size_t)result->calls.count * sizeof(*evidence));+ if (!evidence) {+ cbm_pipeline_mark_unresolved_capture_failed(pipeline);+ }+ return evidence;+ }++ /* Report whether a service spelling handled this call, independently of+ * whether its classified edge is CALLS and therefore covers the occurrence. */+ static bool calls_emit_service_call(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+ const cbm_gbuf_node_t *source_node, cbm_svc_kind_t svc,+ const cbm_resolution_t *resolved, CBMCallEvidence *evidence) {+ if (svc != CBM_SVC_HTTP && svc != CBM_SVC_ASYNC) {+ return false;+ }+ const char *url = call->first_string_arg;+ if (!url || !url[0]) {+ return false;+ }+ bool has_url_or_topic = url[0] == '/' || strstr(url, "://") != NULL ||+ (svc == CBM_SVC_ASYNC && strlen(url) > PAIR_LEN);+ if (!has_url_or_topic) {+ return false;+ }+ cbm_resolution_t fallback = {.qualified_name = call->callee_name,+ .confidence = PC_SVC_PATTERN_CONF,+ .strategy = "service_pattern",+ .candidate_count = 0};+ const cbm_resolution_t *res = resolved ? resolved : &fallback;+ evidence->calls_emitted |= emit_http_async_edge(ctx, call, source_node, NULL, res, svc, false);+ return true;+ }++ /* Route registration counts as handled even when its edge is not CALLS. */+ static bool calls_emit_route_call(cbm_pipeline_ctx_t *ctx, const 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 *route_mount, CBMLanguage lang,+ CBMCallEvidence *evidence) {- if (cbm_service_pattern_route_method(call->callee_name) == NULL || !call->first_string_arg ||- call->first_string_arg[0] != '/') {++ if (cbm_service_pattern_route_method(call->callee_name) == NULL ||++ route_reg_path(call, lang) == NULL) {+ return false;+ }+ evidence->calls_emitted |= handle_route_registration(+ ctx, call, source_node, module_qn, imp_keys, imp_vals, imp_count, route_mount, lang);+ return true;+ }++ /* An external callee can still register a route or address an HTTP/async service. */+ static int calls_emit_unresolved_service(cbm_pipeline_ctx_t *ctx, const 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 *route_mount, CBMLanguage lang,+ CBMCallEvidence *evidence) {+ if (calls_emit_route_call(ctx, call, source_node, module_qn, imp_keys, imp_vals, imp_count,+ route_mount, lang, evidence)) {+ return SKIP_ONE;+ }+ cbm_svc_kind_t svc = cbm_service_pattern_match(call->callee_name);+ if (svc == CBM_SVC_NONE && cbm_service_pattern_is_global_fetch(call->callee_name)) {+ svc = CBM_SVC_HTTP;+ }+ return calls_emit_service_call(ctx, call, source_node, svc, NULL, evidence);+ }++ /* Apply the field-call policy after a registry target has been found. */+ static const cbm_gbuf_node_t *calls_field_target(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+ const CBMResolvedCallArray *lsp_calls,+ CBMLanguage lang, const char *rel,+ const cbm_gbuf_node_t *source_node,+ const cbm_gbuf_node_t *target_node,+ bool arrow_bound, cbm_resolution_t *res) {+ switch (cbm_call_onto_field_policy(lang, call->callee_name, target_node->label,+ target_node->file_path)) {+ case CBM_FIELD_CALL_DROP:+ return NULL;+ case CBM_FIELD_CALL_BY_OWNER:+ /* An arrow call was already bound this way by registry resolution. */+ if (!arrow_bound) {+ target_node = cbm_pipeline_c_member_call_resolve(+ lsp_calls, NULL, ctx->gbuf, ctx->registry, ctx->project_name,+ call->enclosing_func_qn, call->callee_name, cbm_c_member_rule_file(lang, rel), res);+ }+ if (!target_node || source_node->id == target_node->id) {+ return NULL;+ }+ break;+ case CBM_FIELD_CALL_KEEP:+ break;+ }+ return target_node;+ }++ static bool calls_emit_lsp_target(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+ const CBMResolvedCall *lsp, bool allow_tail, CBMLanguage lang,+ const CBMImportArray *imports, const cbm_gbuf_node_t *source_node,+ const char *module_qn, const char **imp_keys,+ const char **imp_vals, int imp_count, const char *route_mount,+ CBMCallEvidence *evidence) {+ if (!lsp) {+ return false;+ }+ bool exact_external_target =+ call->requires_lsp_resolution && cbm_pipeline_kotlin_external_target(lang, lsp->callee_qn);+ const cbm_gbuf_node_t *target_node =+ exact_external_target ? cbm_pipeline_lsp_target_node_strict(ctx->gbuf, ctx->project_name,+ lsp->callee_qn, allow_tail)+ : cbm_pipeline_lsp_target_node(ctx->gbuf, ctx->project_name,+ lsp->callee_qn, allow_tail);+ if (!target_node || source_node->id == target_node->id) {+ return false;+ }+ cbm_resolution_t res = {0};+ /* Keep the canonical graph QN, including project prefixes added by fallback. */+ res.qualified_name = target_node->qualified_name;+ res.confidence = lsp->confidence;+ res.strategy = lsp->strategy;+ res.candidate_count = PC_SINGLE_CANDIDATE_COUNT;+ evidence->candidate_qn = target_node->qualified_name;+ /* Synthetic builtins can still denote a spawn; keep the parallel pass policy. */+ cbm_pipeline_spawn_t spawn;+ if (cbm_pipeline_spawn_site(ctx->gbuf, lang, call, imports, &res, &spawn)) {+ cbm_pipeline_emit_spawn(ctx->gbuf, source_node, call, &spawn);+ return true;+ }+ evidence->calls_emitted |=+ emit_classified_edge(ctx, call, source_node, target_node, &res, module_qn, imp_keys,+ imp_vals, imp_count, false, route_mount, lang);+ return true;+ }++ /* Vendor receivers and cross-language name guesses cannot bind project calls.+ * Keep the registry policy shared with the parallel resolver. */+ static cbm_resolution_t calls_registry_resolution(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+ const char *module_qn, const char **imp_keys,+ const char **imp_vals, int imp_count,+ CBMLanguage lang, bool rust_external,+ bool php_vendor_call) {+ cbm_resolution_t res = {0};+ if (!rust_external && !php_vendor_call) {+ /* Python LEGB fallback first (MUST match pass_parallel.c). */+ res =+ cbm_registry_resolve_call_scoped(ctx->registry, call->callee_name, module_qn, imp_keys,+ imp_vals, imp_count, lang, call->enclosing_func_qn);+ /* Cross-language veto: a name-only guess never binds another+ * language's symbol (a JS app.get must not become Python's+ * builtins.dict.get). The vetoed answer becomes EMPTY here, before+ * the fallbacks below, so the route/HTTP classification still runs.+ * MUST match pass_parallel.c. */+ if (cbm_registry_name_guess_vetoed(ctx->registry, lang, &res)) {+ res = (cbm_resolution_t){0};+ }+ }+ return res;+ }++ static int calls_emit_import_service(cbm_pipeline_ctx_t *ctx, const CBMCall *call,+ const cbm_gbuf_node_t *source_node, const char *rel,+ CBMLanguage lang, const CBMImportArray *imports,+ cbm_external_import_index_t *ext_imports,+ CBMCallEvidence *evidence) {+ /* A callee an import binds to an external client library+ * (`send` under `from paho.mqtt import publish as send`): spelled+ * through its import, then classified. MUST match pass_parallel.c. */+ char spelled[CBM_SZ_512];+ cbm_svc_kind_t isvc =+ cbm_pipeline_external_import_service(ext_imports, ctx->gbuf, ctx->project_name, rel, lang,+ imports, call, spelled, sizeof(spelled));+ if (isvc != CBM_SVC_NONE) {+ CBMCall through = *call;+ through.callee_name = spelled;+ cbm_resolution_t imp_res = {.qualified_name = spelled,+ .confidence = PC_SVC_PATTERN_CONF,+ .strategy = "import_binding",+ .candidate_count = 0};+ evidence->calls_emitted |=+ emit_http_async_edge(ctx, &through, source_node, NULL, &imp_res, isvc, false);+ return SKIP_ONE;+ }+ return 0;+ }+/* Resolve one call and emit the appropriate edge. Returns 1 if resolved, 0 if not. */static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call, const CBMFileResult *result,const char *rel, const char *module_qn, const char **imp_keys,diff --cc src/pipeline/pass_parallel.cindex dfaafd2ac,cc37e7d9b..01f94f59e--- a/src/pipeline/pass_parallel.c+++ b/src/pipeline/pass_parallel.c@@@ -2847,12 -2819,11 +2849,11 @@@ static bool emit_service_edge(cbm_gbuf_if (svc == CBM_SVC_ROUTE_REG) {const char *handler_ref = NULL;- const char *route_path = find_route_path_in_args(call, &handler_ref);+ const char *route_path = find_route_path_in_args(call, &handler_ref, lang);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,- lang);- return;+ return emit_route_registration(gbuf, source, call, route_path, handler_ref, module_qn,+ registry, main_gbuf, imp_keys, imp_vals, imp_count,+ route_mount, lang);}/* No path found — fall through to normal CALLS edge */}@@@ -2907,14 -2880,16 +2910,16 @@@ static bool emit_xlang_refused_route(cb}cbm_svc_kind_t svc = cbm_service_pattern_match(call->callee_name);if (svc != CBM_SVC_NONE && svc != CBM_SVC_ROUTE_REG) {- return;+ return false;}const char *handler_ref = NULL;- const char *route_path = find_route_path_in_args(call, &handler_ref);+ const char *route_path = find_route_path_in_args(call, &handler_ref, lang);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, lang);+ return emit_route_registration(gbuf, source, call, route_path, handler_ref, module_qn,+ registry, main_gbuf, imp_keys, imp_vals, imp_count,+ route_mount, lang);}+ return false;}/* Find the source node for an edge: enclosing function or file node. */