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

Function add_parse_partial_summary

src/mcp/mcp.c:7315–7348  ·  view source on GitHub ↗

Attach the best-effort parse-coverage summary (#963). Always emits a * top-level "parse_partial_count" (0 on clean runs). When files were flagged: * "parse_partial": {"files":[{path,error_ranges}..(<=50)], "count":N, * "truncated":bool, "note":"..."} * These files WERE indexed — constructs inside the listed 1-based line ranges * are missing from the graph because tree-si

Source from the content-addressed store, hash-verified

7313 * note spells out the best-effort framing: absence from this list is NOT a
7314 * completeness guarantee. */
7315static void add_parse_partial_summary(yyjson_mut_doc *doc, yyjson_mut_val *root,
7316 const cbm_file_error_t *errs, int count) {
7317 int partials = 0;
7318 for (int i = 0; i < count; i++) {
7319 if (is_parse_partial(&errs[i])) {
7320 partials++;
7321 }
7322 }
7323 yyjson_mut_obj_add_int(doc, root, "parse_partial_count", partials);
7324 if (!errs || partials <= 0) {
7325 return;
7326 }
7327 yyjson_mut_val *pp = yyjson_mut_obj(doc);
7328 yyjson_mut_val *files = yyjson_mut_arr(doc);
7329 int shown = 0;
7330 for (int i = 0; i < count && shown < INDEX_SKIPPED_FILE_CAP; i++) {
7331 if (!is_parse_partial(&errs[i])) {
7332 continue;
7333 }
7334 yyjson_mut_val *fe = yyjson_mut_obj(doc);
7335 yyjson_mut_obj_add_strcpy(doc, fe, "path", errs[i].path ? errs[i].path : "");
7336 yyjson_mut_obj_add_strcpy(doc, fe, "error_ranges", errs[i].reason ? errs[i].reason : "");
7337 yyjson_mut_arr_add_val(files, fe);
7338 shown++;
7339 }
7340 yyjson_mut_obj_add_val(doc, pp, "files", files);
7341 yyjson_mut_obj_add_int(doc, pp, "count", partials);
7342 yyjson_mut_obj_add_bool(doc, pp, "truncated", partials > INDEX_SKIPPED_FILE_CAP);
7343 yyjson_mut_obj_add_str(doc, pp, "note",
7344 "Indexed, but constructs in these line ranges may be missing (best-"
7345 "effort signal); examples only — full list via index_status or "
7346 "'logfile'.");
7347 yyjson_mut_obj_add_val(doc, root, "parse_partial", pp);
7348}
7349
7350/* The pipeline persists the complete current coverage set before this
7351 * response is built. Prefer that set over the per-run errors so incremental

Callers 2

Calls 1

is_parse_partialFunction · 0.85

Tested by

no test coverage detected