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 remote-tracking branch 'origin/main' into fix/data-flows-test-file-scope
Martin Vogel2cda42e8945c
diff --cc tests/test_edge_types_probe.cindex ff6be23f1,a9904001d..4bba54612--- a/tests/test_edge_types_probe.c+++ b/tests/test_edge_types_probe.c@@@ -1088,132 -1208,34 +1208,160 @@@ static int et_handles_exact(const EtFilreturn et_handles_exact_routes(files, nfiles, want, parallel, NULL);}+/* The exact DATA_FLOWS set, caller -> handler by QN tail. route_qns (NULL-terminated) must+ * exist, so a test that expects NO flow on a path cannot pass because the caller's or the+ * handler's Route was never created; handles is the exact HANDLES count. */+typedef struct {+ const char *caller_tail;+ const char *handler_tail;+} EtFlow;++static int et_flow_matches(cbm_store_t *store, const cbm_edge_t *e, const EtFlow *want,+ int wanted, int *found) {+ cbm_node_t src = {0};+ cbm_node_t tgt = {0};+ int have_src = cbm_store_find_node_by_id(store, e->source_id, &src) == CBM_STORE_OK;+ int have_tgt = cbm_store_find_node_by_id(store, e->target_id, &tgt) == CBM_STORE_OK;+ int matched = 0;+ for (int wi = 0; have_src && have_tgt && wi < wanted; wi++) {+ if (!found[wi] && et_qn_has_tail(src.qualified_name, want[wi].caller_tail) &&+ et_qn_has_tail(tgt.qualified_name, want[wi].handler_tail)) {+ found[wi] = matched = 1;+ break;+ }+ }+ if (!matched) {+ fprintf(stderr, " [ET-FLOWS] unexpected %s -> %s\n",+ have_src && src.qualified_name ? src.qualified_name : "<?>",+ have_tgt && tgt.qualified_name ? tgt.qualified_name : "<?>");+ }+ if (have_src) cbm_node_free_fields(&src);+ if (have_tgt) cbm_node_free_fields(&tgt);+ return matched;+}++static int et_data_flows_exact(const EtFile *files, int nfiles, const EtFlow *want, int parallel,+ const char *const *route_qns, int handles) {+ EtProj lp;+ cbm_store_t *store =+ parallel ? et_index_parallel(&lp, files, nfiles) : et_index_files(&lp, files, nfiles);+ int wanted = 0;+ int found[ET_ROUTE_ASSERT_MAX] = {0};+ while (want[wanted].caller_tail && wanted < ET_ROUTE_ASSERT_MAX) {+ wanted++;+ }+ cbm_edge_t *edges = NULL;+ int n = 0;+ int ok = store != NULL &&+ cbm_store_find_edges_by_type(store, lp.project, "DATA_FLOWS", &edges, &n) ==+ CBM_STORE_OK &&+ n == wanted;+ for (int i = 0; store && i < n; i++) {+ if (!et_flow_matches(store, &edges[i], want, wanted, found)) {+ ok = 0;+ }+ }+ for (int wi = 0; wi < wanted; wi++) {+ if (!found[wi]) {+ ok = 0;+ fprintf(stderr, " [ET-FLOWS] missing %s -> %s\n", want[wi].caller_tail,+ want[wi].handler_tail);+ }+ }+ for (int ri = 0; route_qns && route_qns[ri]; ri++) {+ cbm_node_t route = {0};+ if (!store ||+ cbm_store_find_node_by_qn(store, lp.project, route_qns[ri], &route) != CBM_STORE_OK) {+ ok = 0;+ fprintf(stderr, " [ET-FLOWS] missing Route %s\n", route_qns[ri]);+ } else {+ cbm_node_free_fields(&route);+ }+ }+ int got_handles = store ? cbm_store_count_edges_by_type(store, lp.project, "HANDLES") : -1;+ if (got_handles != handles) {+ ok = 0;+ fprintf(stderr, " [ET-FLOWS] HANDLES=%d expected %d\n", got_handles, handles);+ }+ if (!ok) {+ fprintf(stderr, " [ET-FLOWS] FAIL (%s path) expected=%d actual=%d\n",+ parallel ? "parallel" : "sequential", wanted, n);+ }+ if (edges) cbm_store_free_edges(edges, n);+ et_cleanup(&lp, store);+ return ok;+}++/* R1 + R2 (user decision, 2026-10-18): DATA_FLOWS pair a test-file caller only with handlers in its+ * own file, and a test-file handler only with callers in its own file. A Spring controller and a+ * mock controller under src/test/ both answer `@RequestMapping` (any method). A production TS+ * client and a TS test (.test.ts) call them with fetch, which names no method, so every caller and+ * handler meets on the same __route__ANY__ node. Only the production client -> production+ * controller pair is a data flow of the application, on the sequential and the parallel path. */+static const EtFile et_r12_files[] = {+ {"server/OrderController.java",+ "package com.example;\n\n"+ "import org.springframework.web.bind.annotation.RequestMapping;\n"+ "import org.springframework.web.bind.annotation.RestController;\n\n"+ "@RestController\n@RequestMapping(\"/api\")\npublic class OrderController {\n"+ " @RequestMapping(\"/orders\")\n"+ " public String orders() {\n return \"orders\";\n }\n}\n"},+ {"server/src/test/java/com/example/MockPaymentController.java",+ "package com.example;\n\n"+ "import org.springframework.web.bind.annotation.RequestMapping;\n"+ "import org.springframework.web.bind.annotation.RestController;\n\n"+ "@RestController\n@RequestMapping(\"/api\")\npublic class MockPaymentController {\n"+ " @RequestMapping(\"/payments\")\n"+ " public String pay() {\n return \"paid\";\n }\n}\n"},+ {"web/src/api.ts",+ "export async function loadOrders() {\n return fetch(\"/api/orders\");\n}\n\n"+ "export async function loadPayments() {\n return fetch(\"/api/payments\");\n}\n"},+ {"web/src/api.test.ts",+ "export async function testLoadOrders() {\n return fetch(\"/api/orders\");\n}\n"}};++static const EtFlow et_r12_flows[] = {{"api.loadOrders", "OrderController.orders"}, {NULL, NULL}};++static const char *const et_r12_routes[] = {"__route__ANY__/api/orders",+ "__route__ANY__/api/payments", NULL};++TEST(data_flows_test_files_pair_within_their_file_sequential) {+ ASSERT_TRUE(et_data_flows_exact(et_r12_files, 4, et_r12_flows, 0, et_r12_routes, 2));+ PASS();+}++TEST(data_flows_test_files_pair_within_their_file_parallel) {+ ASSERT_TRUE(et_data_flows_exact(et_r12_files, 4, et_r12_flows, 1, et_r12_routes, 2));+ PASS();+}++ /* ASP.NET Core MVC (#1692): a GET form action and its POST submit share one+ * method name, so both overloads collapse into one Method node whose merged+ * properties keep only one route. The parallel resolver emitted each+ * definition's route at node creation and kept both; the sequential one rebuilt+ * routes from the merged properties afterwards and kept only the last (28+ * HANDLES on 6 ASP.NET corpora, 2026-10-18). Both venues keep both. */+ TEST(handles_aspnet_overload_verbs_both_venues_issue1692) {+ static const EtHandles want[] = {{"AccountController.Login", "/Account/login"},+ {"AccountController.Login", "/Account/login"},+ {NULL, NULL}};+ static const char *const route_qns[] = {"__route__GET__/Account/login",+ "__route__POST__/Account/login", NULL};+ static const EtFile f[] = {+ {"Controllers/AccountController.cs",+ "using Microsoft.AspNetCore.Mvc;\n\n"+ "namespace Shop.Web.Controllers\n{\n"+ " [Route(\"[controller]\")]\n"+ " public class AccountController : Controller\n {\n"+ " [HttpGet(\"login\")]\n"+ " public IActionResult Login() { return View(); }\n\n"+ " [HttpPost(\"login\")]\n"+ " public IActionResult Login(LoginModel model) { return Redirect(\"/\"); }\n"+ " }\n}\n"}};+ ASSERT_TRUE(et_handles_exact_routes(f, 1, want, 0, route_qns));+ ASSERT_TRUE(et_handles_exact_routes(f, 1, want, 1, route_qns));+ PASS();+ }+/* #1146: Laravel's two class-based handler forms —* Route::get('/x', [UserController::class, 'show']) (controller method)* Route::get('/x', GetCurrentUserController::class) (invokable: __invoke)