Count INBOUND edges (any of the reporter's connection types) landing on the * File node named `name` — the exact disconnection metric from the issue's * query `NOT EXISTS { (f)<-[:IMPORTS|CALLS|CONTAINS_FILE|DEFINES|USAGE]-() }`. * A header that used to have no node at all (extension-stripped QN collision) * now has its own File node AND is connected (CONTAINS_FILE from its folder, * plus DEF
| 68 | * plus DEFINES of the class it declares); `#include` itself resolves to the |
| 69 | * declared Class node via #983, not to the header File. */ |
| 70 | static int r964_file_inbound(cbm_store_t *store, const char *project, const char *name) { |
| 71 | static const char *const types[] = {"IMPORTS", "CALLS", "CONTAINS_FILE", |
| 72 | "DEFINES", "USAGE", NULL}; |
| 73 | int total = 0; |
| 74 | for (int t = 0; types[t]; t++) { |
| 75 | cbm_edge_t *edges = NULL; |
| 76 | int n = 0; |
| 77 | if (cbm_store_find_edges_by_type(store, project, types[t], &edges, &n) != CBM_STORE_OK) |
| 78 | continue; |
| 79 | for (int i = 0; i < n; i++) { |
| 80 | cbm_node_t tgt; |
| 81 | if (cbm_store_find_node_by_id(store, edges[i].target_id, &tgt) != CBM_STORE_OK) |
| 82 | continue; |
| 83 | if (tgt.name && strcmp(tgt.name, name) == 0) |
| 84 | total++; |
| 85 | cbm_node_free_fields(&tgt); |
| 86 | } |
| 87 | cbm_store_free_edges(edges, n); |
| 88 | } |
| 89 | return total; |
| 90 | } |
| 91 | |
| 92 | TEST(repro_issue964_header_has_node_and_is_connected) { |
| 93 | static const RFile files[] = { |
no test coverage detected