MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / add_snippet_coverage_note

Function add_snippet_coverage_note

src/mcp/mcp.c:8451–8477  ·  view source on GitHub ↗

get_code_snippet coverage note (#963): if the resolved node's file is * flagged parse_partial, warn that the graph may under-report this file. * Correlated by construction — the result names its file. (An entirely- * skipped file cannot appear here: it has no nodes to resolve a snippet * from.) */

Source from the content-addressed store, hash-verified

8449 * skipped file cannot appear here: it has no nodes to resolve a snippet
8450 * from.) */
8451static void add_snippet_coverage_note(yyjson_mut_doc *doc, yyjson_mut_val *root_obj,
8452 cbm_store_t *store, const cbm_node_t *node) {
8453 if (!node->file_path || !node->file_path[0] || !node->project) {
8454 return;
8455 }
8456 cbm_coverage_row_t *rows = NULL;
8457 int count = 0;
8458 if (cbm_store_coverage_get_path(store, node->project, node->file_path, &rows, &count) !=
8459 CBM_STORE_OK) {
8460 return;
8461 }
8462 for (int i = 0; i < count; i++) {
8463 if (rows[i].rel_path && strcmp(rows[i].rel_path, node->file_path) == 0 && rows[i].kind &&
8464 strcmp(rows[i].kind, "parse_partial") == 0) {
8465 char note[CBM_SZ_1K];
8466 snprintf(note, sizeof(note),
8467 "This file was only PARTIALLY indexed — line range(s) %s could not be "
8468 "parsed, so constructs there may be missing from the graph (callers/callees "
8469 "and search results can under-report this file). The source above is ground "
8470 "truth. (best-effort signal)",
8471 rows[i].detail && rows[i].detail[0] ? rows[i].detail : "?");
8472 yyjson_mut_obj_add_strcpy(doc, root_obj, "coverage_note", note);
8473 break;
8474 }
8475 }
8476 cbm_store_free_coverage(rows, count);
8477}
8478
8479static char *build_snippet_response(cbm_mcp_server_t *srv, cbm_node_t *node,
8480 const char *match_method, bool include_neighbors,

Callers 1

build_snippet_responseFunction · 0.85

Calls 2

cbm_store_free_coverageFunction · 0.85

Tested by

no test coverage detected