Skip to content

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.

fix(issues): #521 YAML config-URL Route dedup, #523 sequential external HTTP edge, #520 fixture project arg

Martin Vogelad33c9b35976
diff --git a/internal/cbm/extract_unified.c b/internal/cbm/extract_unified.c
index f791da59a..a6685d993 100644
--- a/internal/cbm/extract_unified.c
+++ b/internal/cbm/extract_unified.c
@@ -440,6 +440,16 @@ static void handle_string_refs(CBMExtractCtx *ctx, TSNode node, const WalkState
return;
}
+ /* YAML leaf values are emitted by walk_yaml_mapping (handle_yaml_nested),
+ * which carries the dotted key_path needed by the #521 upstream/config-URL
+ * deny check in try_upsert_infra_route. Emitting them here too would create a
+ * duplicate string_ref with key_path == NULL that bypasses that deny check and
+ * mints a spurious Route node for config/upstream/healthcheck URLs. Skip YAML
+ * here so the key_path-aware walk remains the single authority. */
+ if (ctx->language == CBM_LANG_YAML) {
+ return;
+ }
+
/* Extract string content */
char *text = cbm_node_text(ctx->arena, node, ctx->source);
if (!text || !text[0]) {
diff --git a/src/pipeline/pass_calls.c b/src/pipeline/pass_calls.c
index 776725c5d..61f5ac5df 100644
--- a/src/pipeline/pass_calls.c
+++ b/src/pipeline/pass_calls.c
@@ -12,6 +12,9 @@
#include "foundation/constants.h"
enum { PC_RING = 4, PC_RING_MASK = 3, PC_SIG_SCAN = 15, PC_REGEX_GRP = 2 };
+/* Confidence for a service-pattern HTTP/ASYNC edge emitted when registry
+ * resolution is empty (external, unindexed client library) — see #523. */
+#define PC_SVC_PATTERN_CONF 0.5
#include "pipeline/pipeline.h"
#include <stdint.h>
#include "pipeline/pipeline_internal.h"
@@ -437,6 +440,31 @@ static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call,
cbm_resolution_t res = cbm_registry_resolve(ctx->registry, call->callee_name, module_qn,
imp_keys, imp_vals, imp_count);
if (!res.qualified_name || res.qualified_name[0] == '\0') {
+ /* Resolution is empty when the callee belongs to an EXTERNAL client
+ * library whose source is not in the indexed tree (e.g. `requests.get`,
+ * `httpx.post`) — the import map skips it (no node) and no project symbol
+ * matches. The service-pattern signal lives in the RAW callee_name
+ * ("requests.get" contains "requests"), so classify on that and emit the
+ * HTTP_CALLS/ASYNC_CALLS edge directly (target is a synthesized route
+ * node, not the absent library). Without this the call is dropped and
+ * cross-repo matching finds no edge to match (#523). The parallel path
+ * has the equivalent empty-resolution fallback in resolve_file_calls. */
+ cbm_svc_kind_t esvc = cbm_service_pattern_match(call->callee_name);
+ if (esvc == CBM_SVC_HTTP || esvc == CBM_SVC_ASYNC) {
+ const char *u = call->first_string_arg;
+ bool has_url_or_topic =
+ u && u[0] != '\0' &&
+ (u[0] == '/' || strstr(u, "://") != NULL ||
+ (esvc == CBM_SVC_ASYNC && strlen(u) > PAIR_LEN));
+ if (has_url_or_topic) {
+ cbm_resolution_t svc_res = {.qualified_name = call->callee_name,
+ .confidence = PC_SVC_PATTERN_CONF,
+ .strategy = "service_pattern",
+ .candidate_count = 0};
+ emit_http_async_edge(ctx, call, source_node, NULL, &svc_res, esvc);
+ return SKIP_ONE;
+ }
+ }
return 0;
}
diff --git a/tests/repro/repro_issue520.c b/tests/repro/repro_issue520.c
index db8a25f25..6cf2baeb5 100644
--- a/tests/repro/repro_issue520.c
+++ b/tests/repro/repro_issue520.c
@@ -44,6 +44,7 @@
#include "test_framework.h"
#include "test_helpers.h"
#include <mcp/mcp.h>
+#include <pipeline/pipeline.h> /* cbm_project_name_from_path */
#include <string.h>
#include <stdlib.h>
@@ -137,10 +138,23 @@ TEST(repro_issue520_detect_changes_includes_new_untracked_file) {
* no committed change) + git diff (no staged change), so on current
* code the result is always {"changed_files":[],"changed_count":0}.
* After the fix, git status --porcelain would also be consulted and
- * new_func.py (marked "??") would appear in the output. */
- char dc_args[512];
+ * new_func.py (marked "??") would appear in the output.
+ *
+ * The `project` argument is REQUIRED: detect_changes (like every other
+ * MCP tool) resolves the project DB via resolve_store(), which has no
+ * implicit fallback for a NULL project. The real issue #520 reproduction
+ * calls detect_changes(project="...") explicitly; the project name is
+ * derived from the indexed repo path exactly as the pipeline derives it. */
+ char *dc_project = cbm_project_name_from_path(tmpdir);
+ if (!dc_project) {
+ cbm_mcp_server_free(srv);
+ th_rmtree(tmpdir);
+ FAIL("cbm_project_name_from_path failed");
+ }
+ char dc_args[640];
snprintf(dc_args, sizeof(dc_args),
- "{\"base_branch\":\"main\"}");
+ "{\"base_branch\":\"main\",\"project\":\"%s\"}", dc_project);
+ free(dc_project);
char *dc_resp = cbm_mcp_handle_tool(srv, "detect_changes", dc_args);
/* --- assert the new file is reported ---------------------------- */