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

Function tp_parse_coverage

src/mcp/test_impact_policy.c:748–774  ·  view source on GitHub ↗

`coverage`: what a recorded coverage map depends on beyond the code it * measures. Strict on keys: an ignored misspelling would make admitting a map * easier, never harder. */

Source from the content-addressed store, hash-verified

746 * measures. Strict on keys: an ignored misspelling would make admitting a map
747 * easier, never harder. */
748static bool tp_parse_coverage(cbm_test_policy_t *policy, yyjson_val *coverage) {
749 bool valid = true;
750 yyjson_val *paths = tp_field(coverage, "compatibility_paths", &valid);
751 if (!valid || yyjson_obj_size(coverage) != (paths ? 1U : 0U) ||
752 (paths && !yyjson_is_arr(paths)))
753 return false;
754 size_t count = paths ? yyjson_arr_size(paths) : 0;
755 if (count > TP_MAX_COMPAT_PATHS)
756 return false;
757 policy->compat_paths =
758 cbm_arena_calloc(&policy->arena, (count ? count : 1) * sizeof(*policy->compat_paths));
759 if (!policy->compat_paths)
760 return false;
761 size_t index, maximum;
762 yyjson_val *path;
763 yyjson_arr_foreach(paths, index, maximum, path) {
764 size_t len = 0;
765 const char *text = tp_string(path, &len);
766 if (!tp_relative_path(text, len))
767 return false;
768 policy->compat_paths[index] = cbm_arena_strdup(&policy->arena, text);
769 if (!policy->compat_paths[index])
770 return false;
771 }
772 policy->compat_count = (int)count;
773 return true;
774}
775
776static bool tp_parse_policy(cbm_test_policy_t *policy, yyjson_val *impact) {
777 bool valid = true;

Callers 1

tp_parse_policyFunction · 0.85

Calls 5

tp_fieldFunction · 0.85
cbm_arena_callocFunction · 0.85
tp_stringFunction · 0.85
tp_relative_pathFunction · 0.85
cbm_arena_strdupFunction · 0.50

Tested by

no test coverage detected