Skip to content

Commit 2235af4

Browse files
committed
fix(mcp): preserve exact-path coverage when ignored records truncate
Signed-off-by: SunneeYang <sunnee.yang@gmail.com>
1 parent c0bd4bb commit 2235af4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎src/mcp/mcp.c‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,7 +4213,8 @@ static void coverage_add_row_json(yyjson_mut_doc *doc, yyjson_mut_val *array,
42134213

42144214
static const char *coverage_status(const cbm_coverage_row_t *rows, int count,
42154215
const char *requested_path, const char *recording_status,
4216-
bool generation_matches, bool lookup_ok) {
4216+
bool generation_matches, bool lookup_ok,
4217+
bool exact_path_verified) {
42174218
if (!lookup_ok) {
42184219
return "coverage_unavailable";
42194220
}
@@ -4241,7 +4242,11 @@ static const char *coverage_status(const cbm_coverage_row_t *rows, int count,
42414242
}
42424243
}
42434244
}
4244-
if (!generation_matches || !recording_status || strcmp(recording_status, "complete") != 0) {
4245+
bool recording_complete =
4246+
recording_status && strcmp(recording_status, "complete") == 0;
4247+
bool truncated_exact_path_verified = exact_path_verified && recording_status &&
4248+
strcmp(recording_status, "truncated") == 0;
4249+
if (!generation_matches || (!recording_complete && !truncated_exact_path_verified)) {
42454250
return "coverage_unavailable";
42464251
}
42474252
return "no_recorded_issue";
@@ -4358,9 +4363,12 @@ static char *handle_check_index_coverage(cbm_mcp_server_t *srv, const char *args
43584363
bool outside = false;
43594364
const char *freshness = coverage_path_freshness(
43604365
store, project, have_project ? proj.root_path : NULL, rel, &outside);
4366+
bool exact_path_verified = have_meta && meta.hash_records_complete &&
4367+
strcmp(freshness, "metadata_match") == 0;
43614368
const char *status = outside ? "outside_project"
43624369
: coverage_status(rows, row_count, rel, recording_status,
4363-
generation_matches, lookup_ok);
4370+
generation_matches, lookup_ok,
4371+
exact_path_verified);
43644372
yyjson_mut_obj_add_strcpy(doc, item, "status", status);
43654373
yyjson_mut_obj_add_strcpy(doc, item, "freshness", freshness);
43664374
yyjson_mut_obj_add_strcpy(doc, item, "recommended_action",

0 commit comments

Comments
 (0)