| 4288 | } |
| 4289 | |
| 4290 | static const char *coverage_status(const cbm_coverage_row_t *rows, int count, |
| 4291 | const char *requested_path, const char *recording_status, |
| 4292 | bool generation_matches, bool lookup_ok, |
| 4293 | bool exact_path_verified) { |
| 4294 | if (!lookup_ok) { |
| 4295 | return "coverage_unavailable"; |
| 4296 | } |
| 4297 | bool exact = false; |
| 4298 | for (int i = 0; i < count; i++) { |
| 4299 | if (rows[i].rel_path && strcmp(rows[i].rel_path, requested_path) == 0) { |
| 4300 | exact = true; |
| 4301 | break; |
| 4302 | } |
| 4303 | } |
| 4304 | for (int pass = 0; pass < 3; pass++) { |
| 4305 | for (int i = 0; i < count; i++) { |
| 4306 | if (exact && (!rows[i].rel_path || strcmp(rows[i].rel_path, requested_path) != 0)) { |
| 4307 | continue; |
| 4308 | } |
| 4309 | const char *kind = rows[i].kind ? rows[i].kind : ""; |
| 4310 | if (pass == 0 && strcmp(kind, "parse_partial") == 0) { |
| 4311 | return "partial"; |
| 4312 | } |
| 4313 | if (pass == 1 && strncmp(kind, "not_indexed", 11) == 0) { |
| 4314 | return "excluded"; |
| 4315 | } |
| 4316 | if (pass == 2 && kind[0]) { |
| 4317 | return "skipped"; |
| 4318 | } |
| 4319 | } |
| 4320 | } |
| 4321 | bool recording_complete = recording_status && strcmp(recording_status, "complete") == 0; |
| 4322 | bool truncated_exact_path_verified = |
| 4323 | exact_path_verified && recording_status && strcmp(recording_status, "truncated") == 0; |
| 4324 | if (!generation_matches || (!recording_complete && !truncated_exact_path_verified)) { |
| 4325 | return "coverage_unavailable"; |
| 4326 | } |
| 4327 | return "no_recorded_issue"; |
| 4328 | } |
| 4329 | |
| 4330 | static const char *coverage_recommended_action(const char *status, const char *freshness) { |
| 4331 | if (!freshness || strcmp(freshness, "metadata_match") != 0) { |
no outgoing calls
no test coverage detected