On a breadth failure, explain WHY: does direct extraction (no pipeline, no * timeout) yield defs, and what node labels did the pipeline actually create for * the file? Distinguishes "extraction itself broke" from "extraction works but * the def didn't reach the graph / got an unexpected label". */
| 523 | * the file? Distinguishes "extraction itself broke" from "extraction works but |
| 524 | * the def didn't reach the graph / got an unexpected label". */ |
| 525 | static void breadth_diag(cbm_store_t *store, const char *project, const char *rel, |
| 526 | const GrammarCase *c) { |
| 527 | CBMFileResult *dr = |
| 528 | cbm_extract_file(c->src, (int)strlen(c->src), c->lang, "lc", c->path, 0, NULL, NULL); |
| 529 | int direct = dr ? dr->defs.count : -1; |
| 530 | const char *direct_label = (dr && dr->defs.count > 0) ? dr->defs.items[0].label : "-"; |
| 531 | char labels[256] = {0}; |
| 532 | cbm_node_t *nodes = NULL; |
| 533 | int count = 0; |
| 534 | if (cbm_store_find_nodes_by_file(store, project, rel, &nodes, &count) == CBM_STORE_OK) { |
| 535 | for (int i = 0; i < count && strlen(labels) < sizeof(labels) - 40; i++) { |
| 536 | char one[48]; |
| 537 | snprintf(one, sizeof(one), "%s ", nodes[i].label ? nodes[i].label : "?"); |
| 538 | strncat(labels, one, sizeof(labels) - strlen(labels) - 1); |
| 539 | } |
| 540 | } |
| 541 | cbm_store_free_nodes(nodes, count); |
| 542 | fprintf(stderr, " └─ direct_extract_defs=%d (label0=%s) graph_labels=[%s]\n", direct, |
| 543 | direct_label ? direct_label : "(null)", labels); |
| 544 | if (dr) { |
| 545 | cbm_free_result(dr); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | TEST(contract_all_grammars_in_graph) { |
| 550 | int n = (int)CBM_GRAMMAR_CASES_COUNT; |
no test coverage detected