@@ -2306,6 +2306,40 @@ TEST(tool_check_index_coverage_reports_paths_scopes_and_ranges) {
23062306 PASS ();
23072307}
23082308
2309+ TEST (tool_check_index_coverage_preserves_multiple_scope_labels ) {
2310+ char tmp [256 ];
2311+ cbm_mcp_server_t * srv = setup_snippet_server (tmp , sizeof (tmp ));
2312+ ASSERT_NOT_NULL (srv );
2313+
2314+ char * coverage = cbm_mcp_handle_tool (srv , "check_index_coverage" ,
2315+ "{\"project\":\"test-project\","
2316+ "\"scopes\":[\"alpha/one\",\"bravo/two\",\"charl/tri\"]}" );
2317+ ASSERT_NOT_NULL (coverage );
2318+ char * inner = extract_text_content (coverage );
2319+ ASSERT_NOT_NULL (inner );
2320+ yyjson_doc * doc = yyjson_read (inner , strlen (inner ), 0 );
2321+ ASSERT_NOT_NULL (doc );
2322+ yyjson_val * scopes = yyjson_obj_get (yyjson_doc_get_root (doc ), "scopes" );
2323+ ASSERT_NOT_NULL (scopes );
2324+ ASSERT_TRUE (yyjson_is_arr (scopes ));
2325+ ASSERT_EQ (yyjson_arr_size (scopes ), 3 );
2326+
2327+ const char * expected [] = {"alpha/one" , "bravo/two" , "charl/tri" };
2328+ for (size_t i = 0 ; i < 3 ; i ++ ) {
2329+ yyjson_val * scope = yyjson_obj_get (yyjson_arr_get (scopes , i ), "scope" );
2330+ ASSERT_NOT_NULL (scope );
2331+ ASSERT_TRUE (yyjson_is_str (scope ));
2332+ ASSERT_STR_EQ (yyjson_get_str (scope ), expected [i ]);
2333+ }
2334+
2335+ yyjson_doc_free (doc );
2336+ free (inner );
2337+ free (coverage );
2338+ cbm_mcp_server_free (srv );
2339+ cleanup_snippet_dir (tmp );
2340+ PASS ();
2341+ }
2342+
23092343static int write_coverage_meta (cbm_store_t * store , const char * generation ,
23102344 const char * recording_status ) {
23112345 cbm_coverage_meta_t meta = {
@@ -9680,6 +9714,7 @@ SUITE(mcp) {
96809714 RUN_TEST (tool_index_status_no_project );
96819715 RUN_TEST (tool_check_index_coverage_finds_path_beyond_status_cap );
96829716 RUN_TEST (tool_check_index_coverage_reports_paths_scopes_and_ranges );
9717+ RUN_TEST (tool_check_index_coverage_preserves_multiple_scope_labels );
96839718 RUN_TEST (tool_check_index_coverage_rejects_stale_generation );
96849719 RUN_TEST (tool_check_index_coverage_requires_source_when_file_metadata_changed );
96859720 RUN_TEST (tool_check_index_coverage_surfaces_lookup_errors );
0 commit comments