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(python): clang-format pkgmap + ghost-module CALLS negative
涂名恩e56e965dd171
diff --git a/src/pipeline/pass_pkgmap.c b/src/pipeline/pass_pkgmap.cindex e79c4e7a8..fbba9709e 100644--- a/src/pipeline/pass_pkgmap.c+++ b/src/pipeline/pass_pkgmap.c@@ -1530,9 +1530,8 @@ const cbm_gbuf_node_t *cbm_pipeline_resolve_import_node(const cbm_pipeline_ctx_tchar symbuf[256];const char *sym = import_candidate_symbol(imp->module_path, symbuf, sizeof(symbuf));if (sym && sym[0] && strcmp(sym, "*") != 0) {- const char *mod_tail = import_last_segment(target->qualified_name- ? target->qualified_name- : "");+ const char *mod_tail =+ import_last_segment(target->qualified_name ? target->qualified_name : "");if (!mod_tail || strcmp(mod_tail, sym) != 0) {char member_qn[CBM_SZ_512];snprintf(member_qn, sizeof(member_qn), "%s.%s", target->qualified_name, sym);diff --git a/tests/test_lang_contract.c b/tests/test_lang_contract.cindex 4b8dac93d..6b3bd36e3 100644--- a/tests/test_lang_contract.c+++ b/tests/test_lang_contract.c@@ -553,6 +553,47 @@ TEST(contract_python_absolute_aliased_from_import_calls) {PASS();}+/* Python: unresolvable module + alias must emit no CALLS (no invented edge). */+TEST(contract_python_ghost_module_aliased_from_import_no_calls) {+ static const LangFile f[] = {+ {"router.py",+ "from ghost_module import nope as alias\n\n\n"+ "def submit_task(y):\n return alias(y)\n"}};+ LangProj lp;+ cbm_store_t *store = lang_index_files(&lp, f, 1);+ ASSERT_TRUE(store != NULL);+ cbm_node_t *nodes = NULL;+ int ncount = 0;+ ASSERT_EQ(cbm_store_find_nodes_by_name(store, lp.project, "submit_task", &nodes, &ncount),+ CBM_STORE_OK);+ ASSERT_TRUE(ncount >= 1);+ char **callers = NULL;+ char **callees = NULL;+ int n_callers = 0;+ int n_callees = 0;+ ASSERT_EQ(cbm_store_node_neighbor_names(store, nodes[0].id, 32, &callers, &n_callers, &callees,+ &n_callees),+ 0);+ int saw_any_callee = 0;+ for (int i = 0; i < n_callees; i++) {+ if (callees[i] && callees[i][0]) {+ saw_any_callee = 1;+ }+ }+ for (int i = 0; i < n_callers; i++) {+ free(callers[i]);+ }+ for (int i = 0; i < n_callees; i++) {+ free(callees[i]);+ }+ free(callers);+ free(callees);+ cbm_store_free_nodes(nodes, ncount);+ lang_cleanup(&lp, store);+ ASSERT_FALSE(saw_any_callee);+ PASS();+}+/* TypeScript: a relative import resolves to a sibling module → IMPORTS edge. */TEST(contract_typescript_relative_import) {static const LangFile f[] = {@@ -1724,6 +1765,7 @@ SUITE(lang_contract) {RUN_TEST(contract_python_relative_import);RUN_TEST(contract_python_aliased_from_import_calls);RUN_TEST(contract_python_absolute_aliased_from_import_calls);+ RUN_TEST(contract_python_ghost_module_aliased_from_import_no_calls);RUN_TEST(contract_typescript_relative_import);/* Graph-level breadth across all grammars (P4). */diff --git a/tests/test_registry.c b/tests/test_registry.cindex 42c6dae60..07dfb71c9 100644--- a/tests/test_registry.c+++ b/tests/test_registry.c@@ -386,9 +386,9 @@ TEST(resolve_import_map_bare_alias) {PASS();}-/* from M import execute as bridge_execute + bridge_execute() — IMPORTS target is- * already the def QN. Must CALLS→execute, not invent …M.bridge_execute.- * Yui G1 shape (alongside resolve_import_map_bare_alias). */+/* Adversarial pin: when import_map already stores the def QN under the alias+ * key, bare alias call must CALLS→def (not invent …M.bridge_execute). Behavior+ * already on main via #875/#979; this locks the Yui G1 shape. */TEST(resolve_import_map_aliased_from_import) {cbm_registry_t *r = cbm_registry_new();cbm_registry_add(r, "execute", "proj.services.satori_bridge.gate.execute", "Function");