@@ -1458,6 +1458,40 @@ TEST(tool_check_index_coverage_reports_paths_scopes_and_ranges) {
14581458 PASS ();
14591459}
14601460
1461+ TEST (tool_check_index_coverage_preserves_multiple_scope_labels ) {
1462+ char tmp [256 ];
1463+ cbm_mcp_server_t * srv = setup_snippet_server (tmp , sizeof (tmp ));
1464+ ASSERT_NOT_NULL (srv );
1465+
1466+ char * coverage = cbm_mcp_handle_tool (srv , "check_index_coverage" ,
1467+ "{\"project\":\"test-project\","
1468+ "\"scopes\":[\"alpha/one\",\"bravo/two\",\"charl/tri\"]}" );
1469+ ASSERT_NOT_NULL (coverage );
1470+ char * inner = extract_text_content (coverage );
1471+ ASSERT_NOT_NULL (inner );
1472+ yyjson_doc * doc = yyjson_read (inner , strlen (inner ), 0 );
1473+ ASSERT_NOT_NULL (doc );
1474+ yyjson_val * scopes = yyjson_obj_get (yyjson_doc_get_root (doc ), "scopes" );
1475+ ASSERT_NOT_NULL (scopes );
1476+ ASSERT_TRUE (yyjson_is_arr (scopes ));
1477+ ASSERT_EQ (yyjson_arr_size (scopes ), 3 );
1478+
1479+ const char * expected [] = {"alpha/one" , "bravo/two" , "charl/tri" };
1480+ for (size_t i = 0 ; i < 3 ; i ++ ) {
1481+ yyjson_val * scope = yyjson_obj_get (yyjson_arr_get (scopes , i ), "scope" );
1482+ ASSERT_NOT_NULL (scope );
1483+ ASSERT_TRUE (yyjson_is_str (scope ));
1484+ ASSERT_STR_EQ (yyjson_get_str (scope ), expected [i ]);
1485+ }
1486+
1487+ yyjson_doc_free (doc );
1488+ free (inner );
1489+ free (coverage );
1490+ cbm_mcp_server_free (srv );
1491+ cleanup_snippet_dir (tmp );
1492+ PASS ();
1493+ }
1494+
14611495static int write_coverage_meta (cbm_store_t * store , const char * generation ,
14621496 const char * recording_status ) {
14631497 cbm_coverage_meta_t meta = {
@@ -6411,6 +6445,7 @@ SUITE(mcp) {
64116445 RUN_TEST (tool_index_status_no_project );
64126446 RUN_TEST (tool_check_index_coverage_finds_path_beyond_status_cap );
64136447 RUN_TEST (tool_check_index_coverage_reports_paths_scopes_and_ranges );
6448+ RUN_TEST (tool_check_index_coverage_preserves_multiple_scope_labels );
64146449 RUN_TEST (tool_check_index_coverage_rejects_stale_generation );
64156450 RUN_TEST (tool_check_index_coverage_requires_source_when_file_metadata_changed );
64166451 RUN_TEST (tool_check_index_coverage_surfaces_lookup_errors );
0 commit comments