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(registry): resolve aliased direct-symbol imports in import_map
LA-1089e1c47fd16a
diff --git a/src/pipeline/registry.c b/src/pipeline/registry.cindex 4b70f67d4..ee9cd2253 100644--- a/src/pipeline/registry.c+++ b/src/pipeline/registry.c@@ -618,6 +618,10 @@ static cbm_resolution_t resolve_import_map(const cbm_registry_t *r, const char ** function name and suffix is NULL, so the target QN must be* resolved.requireAdmin — not just resolved, which would point at the* module node and miss the function entirely. */+ const char *direct = cbm_ht_get_key(r->exact, resolved);+ if (direct) {+ return (cbm_resolution_t){direct, "import_map", CONF_IMPORT_MAP, REG_RESOLVED};+ }char candidate[CBM_SZ_512];if (suffix && suffix[0]) {snprintf(candidate, sizeof(candidate), "%s.%s", resolved, suffix);diff --git a/tests/test_registry.c b/tests/test_registry.cindex a79aaffd5..611766127 100644--- a/tests/test_registry.c+++ b/tests/test_registry.c@@ -367,6 +367,25 @@ TEST(resolve_import_map_bare_function) {PASS();}+/* Aliased bare import (`from m import f as g`, called as g()). The import-map+ * value is the full symbol QN (IMPORTS edge targets the function node), and+ * the callee at the site is the alias g — NOT f. Resolution must return the+ * symbol directly instead of appending the alias (which yields m.f.g → miss).+ * Regression for #875. */+TEST(resolve_import_map_bare_alias) {+ cbm_registry_t *r = cbm_registry_new();+ cbm_registry_add(r, "scan_bash", "proj.security_scan.scan_bash", "Function");+ /* Import map: alias "_scan_bash" → FULL SYMBOL QN (not the module). */+ const char *keys[] = {"_scan_bash"};+ const char *vals[] = {"proj.security_scan.scan_bash"};+ cbm_resolution_t res =+ cbm_registry_resolve(r, "_scan_bash", "proj.hooks.pre_tool", keys, vals, 1);+ ASSERT_STR_EQ(res.qualified_name, "proj.security_scan.scan_bash");+ ASSERT_STR_EQ(res.strategy, "import_map");+ cbm_registry_free(r);+ PASS();+}+TEST(resolve_unique_name) {cbm_registry_t *r = cbm_registry_new();cbm_registry_add(r, "UniqueFunc", "proj.deep.path.UniqueFunc", "Function");@@ -818,6 +837,7 @@ SUITE(registry) {RUN_TEST(resolve_qualified_ambiguous_tail_falls_through);RUN_TEST(resolve_import_map);RUN_TEST(resolve_import_map_bare_function);+ RUN_TEST(resolve_import_map_bare_alias);RUN_TEST(resolve_unique_name);RUN_TEST(resolve_unresolved);RUN_TEST(resolve_many_nodes);