Skip to content

Commit 219b348

Browse files
test(coverage): pin the truncation marker, the partial ceiling and the grammar limit (DeusData#963)
Phase 5. Four test groups, each checked RED before it was kept. - The Studio Export range join puts ONE ",+<N>" marker at the end with the summed drop count. A marker left mid-string makes every reader stop there and silently lose the ranges after it. Reaching the join through the pipeline needs an export file with 256+ error regions across two <Class> elements, so it goes through a test seam, following the pattern already in this repo (CBM_COVERAGE_MARKER_TEST_API). - check_index_coverage emits every range in front of a marker, never turns the marker's digits into a range, and reports "truncated" from BOTH caps — the producer's and its own 256 limit. - test_index_resilience now has a ceiling beside its floor: exactly one of the two fixture files is flagged, the clean neighbour is absent, and the range does not cover the whole file. - The three _Thread_local forms are pinned as measured. Only the array form fails today; the plan's Phase 0 also listed the pointer form, and that is wrong on the grammar shipped now. Also fixes 13 clang-format violations the earlier commits on this branch left in cbm.c, mcp.c and pass_definitions.c. `make -f Makefile.cbm lint-format` would have failed CI. The changes are whitespace only — the two reflowed tool descriptions concatenate byte-identically, so no output moved. Full suite: 7735 passed, 28 failed, 7 skipped. The 28 are the pre-existing cli install/uninstall failures, identical at clean HEAD. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Joshua Richter <jrichter5781@gmail.com>
1 parent a953509 commit 219b348

8 files changed

Lines changed: 254 additions & 15 deletions

File tree

‎Makefile.cbm‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ endif
9898
KOTLIN_DEDUP_TEST_DEFINE = -DCBM_KOTLIN_DEDUP_TEST_API=1
9999
CALL_REFERENCE_LOOKUP_TEST_DEFINE = -DCBM_CALL_REFERENCE_LOOKUP_TEST_API=1
100100
INCREMENTAL_TEST_DEFINE = -DCBM_INCREMENTAL_TEST_API=1
101+
COVERAGE_MARKER_TEST_DEFINE = -DCBM_COVERAGE_MARKER_TEST_API=1
101102
CFLAGS_TEST = $(CFLAGS_COMMON) $(EDITOR_TEST_DEFINES) $(SANITIZED_DEFINE) \
102103
$(KOTLIN_DEDUP_TEST_DEFINE) $(CALL_REFERENCE_LOOKUP_TEST_DEFINE) \
103-
$(INCREMENTAL_TEST_DEFINE) -g -O1 $(SANITIZE)
104+
$(INCREMENTAL_TEST_DEFINE) $(COVERAGE_MARKER_TEST_DEFINE) -g -O1 $(SANITIZE)
104105
CXXFLAGS_TEST = $(CXXFLAGS_COMMON) $(SANITIZED_DEFINE) -g -O1 $(SANITIZE) $(CXX_STDLIB_FLAGS)
105106

106107
# TSan (can't combine with ASan)
@@ -118,6 +119,7 @@ TSAN_SANITIZE = -fsanitize=thread -fno-omit-frame-pointer
118119
# macro of ours.
119120
CFLAGS_TSAN = $(CFLAGS_COMMON) $(EDITOR_TEST_DEFINES) $(KOTLIN_DEDUP_TEST_DEFINE) \
120121
$(CALL_REFERENCE_LOOKUP_TEST_DEFINE) $(INCREMENTAL_TEST_DEFINE) \
122+
$(COVERAGE_MARKER_TEST_DEFINE) \
121123
-DCBM_SANITIZED_BUILD=1 -g -O1 $(TSAN_SANITIZE)
122124
CXXFLAGS_TSAN = $(CXXFLAGS_COMMON) -DCBM_SANITIZED_BUILD=1 -g -O1 \
123125
$(TSAN_SANITIZE)

‎internal/cbm/cbm.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,16 +1801,15 @@ static CBMFileResult *extract_file_ex_body(const char *source, int source_len, C
18011801
orig_lines++;
18021802
}
18031803
}
1804-
uint8_t *map =
1805-
(uint8_t *)cbm_arena_alloc(a, (size_t)orig_lines + 2);
1804+
uint8_t *map = (uint8_t *)cbm_arena_alloc(a, (size_t)orig_lines + 2);
18061805
int exp_lines = preprocessed->expanded_line_count;
18071806
uint8_t *bad_rows =
18081807
exp_lines > 0 ? (uint8_t *)calloc((size_t)exp_lines + 2, 1) : NULL;
18091808
if (map && bad_rows) {
18101809
memset(map, 0, (size_t)orig_lines + 2);
18111810
cbm_mark_no_code_lines(source, source_len, map, orig_lines);
1812-
cbm_mark_pp_error_rows(pp_root, bad_rows, (uint32_t)exp_lines,
1813-
expanded, expanded_len);
1811+
cbm_mark_pp_error_rows(pp_root, bad_rows, (uint32_t)exp_lines, expanded,
1812+
expanded_len);
18141813
/* Walk the expanded text once. An expanded line
18151814
* only vouches for its original line when it
18161815
* actually HAS content: the preprocessor emits a

‎src/pipeline/pass_definitions.c‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,9 @@ static int objectscript_export_split_range_marker(const char *ranges, size_t *bo
561561
if (i == len || i == 0 || ranges[i - 1] != '+') {
562562
return 0;
563563
}
564-
size_t marker = i - 1; /* index of '+' */
564+
size_t marker = i - 1; /* index of '+' */
565565
if (marker > 0 && ranges[marker - 1] == ',') {
566-
marker--; /* drop the separator too */
566+
marker--; /* drop the separator too */
567567
}
568568
*body_len = marker;
569569
return atoi(ranges + i);
@@ -612,8 +612,8 @@ static bool objectscript_export_append_error_ranges(CBMFileResult *aggregate,
612612
return false;
613613
}
614614
if (dropped > 0) {
615-
combined = cbm_arena_sprintf(&aggregate->arena, "%s%s+%d", combined,
616-
combined[0] ? "," : "", dropped);
615+
combined = cbm_arena_sprintf(&aggregate->arena, "%s%s+%d", combined, combined[0] ? "," : "",
616+
dropped);
617617
if (!combined) {
618618
return false;
619619
}
@@ -622,6 +622,16 @@ static bool objectscript_export_append_error_ranges(CBMFileResult *aggregate,
622622
return true;
623623
}
624624

625+
#if defined(CBM_COVERAGE_MARKER_TEST_API) && CBM_COVERAGE_MARKER_TEST_API
626+
/* Test seam. This join only fires for a Studio Export file holding several
627+
* <Class> elements where a class overruns the 256-region cap — hard to reach
628+
* through the pipeline, easy to get wrong, and a wrong result hides ranges
629+
* without saying so. Expose the join so the marker rules can be pinned. */
630+
bool cbm_pipeline_coverage_marker_test_join(CBMFileResult *aggregate, const CBMFileResult *part) {
631+
return objectscript_export_append_error_ranges(aggregate, part);
632+
}
633+
#endif
634+
625635
/* Studio Export files may contain multiple <Class> elements, while the
626636
* pipeline cache has one slot per physical file. Extract each generated UDL
627637
* class independently (preserving the upstream parser behavior), then compose
@@ -842,10 +852,9 @@ int cbm_pipeline_pass_definitions(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t
842852
} else if (result->parse_incomplete) {
843853
/* Best-effort parse-coverage signal (#963): indexed, but with
844854
* ERROR/MISSING regions — see pass_parallel.c (keep in sync). */
845-
cbm_pipeline_add_file_error(ctx->pipeline, rel,
846-
result->error_ranges ? result->error_ranges : "unknown",
847-
result->parse_unusable ? "parse_unusable"
848-
: "parse_partial");
855+
cbm_pipeline_add_file_error(
856+
ctx->pipeline, rel, result->error_ranges ? result->error_ranges : "unknown",
857+
result->parse_unusable ? "parse_unusable" : "parse_partial");
849858
}
850859

851860
/* Create nodes for each definition */

‎src/pipeline/pipeline_internal.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,12 @@ void cbm_pp_bp_nap_cycles_reset(void);
864864
uint64_t cbm_pp_lsp_linear_fallback_rows(void);
865865
void cbm_pp_lsp_linear_fallback_rows_reset(void);
866866

867+
#if defined(CBM_COVERAGE_MARKER_TEST_API) && CBM_COVERAGE_MARKER_TEST_API
868+
/* Test-only view of the Studio Export range join, so the ",+<N>" truncation
869+
* marker rules can be checked without building a 256-region export file. */
870+
bool cbm_pipeline_coverage_marker_test_join(CBMFileResult *aggregate, const CBMFileResult *part);
871+
#endif
872+
867873
#if defined(CBM_CALL_REFERENCE_LOOKUP_TEST_API) && CBM_CALL_REFERENCE_LOOKUP_TEST_API
868874
/* Deterministic test-only operation count for the shared semantic-reference
869875
* matcher used by both sequential and fused-parallel usage materialization. */

‎tests/test_index_resilience.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,16 @@ TEST(index_parse_partial_reported) {
337337
ASSERT_STR_EQ("indexed", status);
338338
ASSERT_EQ(yyjson_get_int(yyjson_obj_get(sc, "skipped_count")), 0);
339339

340-
/* The coverage signal is surfaced with ranges + the best-effort note. */
340+
/* The coverage signal is surfaced with ranges + the best-effort note.
341+
* Both bounds matter. The floor catches the signal going missing. The
342+
* ceiling catches the opposite failure: exactly one of the two files has
343+
* a gap, so a count above 1 means the clean Python neighbour got flagged
344+
* as well, which is how over-flagging looks from the outside. */
341345
ASSERT_GTE(yyjson_get_int(yyjson_obj_get(sc, "parse_partial_count")), 1);
346+
ASSERT_EQ(yyjson_get_int(yyjson_obj_get(sc, "parse_partial_count")), 1);
347+
/* A local gap is not a whole-file failure, so the other coverage kind
348+
* must stay empty here. */
349+
ASSERT_EQ(yyjson_get_int(yyjson_obj_get(sc, "parse_unusable_count")), 0);
342350
yyjson_val *pp = yyjson_obj_get(sc, "parse_partial");
343351
ASSERT_NOT_NULL(pp);
344352
yyjson_val *files = yyjson_obj_get(pp, "files");
@@ -354,7 +362,13 @@ TEST(index_parse_partial_reported) {
354362
found_split = 1;
355363
ASSERT_NOT_NULL(ranges);
356364
ASSERT_GT((int)strlen(ranges), 0);
365+
/* The gap is the two-header block, not the whole file. An
366+
* 8-line file reported as 1-8 would be the old whole-file
367+
* blame coming back. */
368+
ASSERT_NULL(strstr(ranges, "1-8"));
357369
}
370+
/* The clean file must not appear in the list at all. */
371+
ASSERT_NULL(fp ? strstr(fp, "good.py") : NULL);
358372
}
359373
ASSERT_TRUE(found_split);
360374
const char *note = yyjson_get_str(yyjson_obj_get(pp, "note"));

‎tests/test_mcp.c‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5425,6 +5425,86 @@ TEST(tool_check_index_coverage_pages_exact_paths_and_restores_raw_diagnostics) {
54255425
PASS();
54265426
}
54275427

5428+
/* The range string can carry a trailing ",+<N>" marker saying the producer hit
5429+
* its own cap and threw ranges away. The reader must emit every range in front
5430+
* of the marker, must not turn the marker itself into a range, and must say
5431+
* "ranges_truncated" so nobody reads a short list as a complete one. The reader has a
5432+
* second cap of its own, and that one must report itself the same way. */
5433+
TEST(tool_check_index_coverage_reports_truncation_marker_issue963) {
5434+
enum { WIDE_RANGE_COUNT = 300 };
5435+
cbm_mcp_server_t *srv = cbm_mcp_server_new(NULL);
5436+
ASSERT_NOT_NULL(srv);
5437+
cbm_store_t *st = cbm_mcp_server_store(srv);
5438+
ASSERT_NOT_NULL(st);
5439+
5440+
const char *project = "coverage-marker";
5441+
ASSERT_EQ(cbm_store_upsert_project(st, project, "/tmp/coverage-marker"), CBM_STORE_OK);
5442+
cbm_mcp_server_set_project(srv, project);
5443+
5444+
/* 300 one-line ranges — past the reader's own 256 limit. */
5445+
char *wide = calloc(1, WIDE_RANGE_COUNT * 12 + 1);
5446+
ASSERT_NOT_NULL(wide);
5447+
size_t off = 0;
5448+
for (int i = 0; i < WIDE_RANGE_COUNT; i++) {
5449+
off += (size_t)snprintf(wide + off, WIDE_RANGE_COUNT * 12 + 1 - off, "%s%d-%d",
5450+
i ? "," : "", i * 3 + 1, i * 3 + 1);
5451+
}
5452+
5453+
cbm_coverage_row_t rows[3] = {
5454+
{.rel_path = "src/marked.c", .kind = "parse_partial", .detail = "3-4,9-9,+12"},
5455+
{.rel_path = "src/plain.c", .kind = "parse_partial", .detail = "3-4,9-9"},
5456+
{.rel_path = "src/wide.c", .kind = "parse_partial", .detail = wide},
5457+
};
5458+
for (int i = 0; i < 3; i++) {
5459+
ASSERT_EQ(cbm_store_upsert_file_hash(st, project, rows[i].rel_path, "fixture", i + 1, 10),
5460+
CBM_STORE_OK);
5461+
}
5462+
ASSERT_EQ(cbm_store_coverage_replace(st, project, rows, 3), CBM_STORE_OK);
5463+
5464+
/* The marked file: both real ranges survive, the marker is flagged, and the
5465+
* "12" from the marker never becomes a range of its own. */
5466+
char *marked =
5467+
cbm_mcp_handle_tool(srv, "check_index_coverage",
5468+
"{\"project\":\"coverage-marker\",\"paths\":[\"src/marked.c\"],\"format\":\"json\"}");
5469+
ASSERT_NOT_NULL(marked);
5470+
char *marked_inner = extract_text_content(marked);
5471+
ASSERT_NOT_NULL(marked_inner);
5472+
ASSERT_NOT_NULL(strstr(marked_inner, "\"start\":3"));
5473+
ASSERT_NOT_NULL(strstr(marked_inner, "\"start\":9"));
5474+
ASSERT_NULL(strstr(marked_inner, "\"start\":12"));
5475+
ASSERT_NOT_NULL(strstr(marked_inner, "\"ranges_truncated\":true"));
5476+
free(marked_inner);
5477+
free(marked);
5478+
5479+
/* The same ranges without a marker must NOT be reported as truncated. */
5480+
char *plain =
5481+
cbm_mcp_handle_tool(srv, "check_index_coverage",
5482+
"{\"project\":\"coverage-marker\",\"paths\":[\"src/plain.c\"],\"format\":\"json\"}");
5483+
ASSERT_NOT_NULL(plain);
5484+
char *plain_inner = extract_text_content(plain);
5485+
ASSERT_NOT_NULL(plain_inner);
5486+
ASSERT_NOT_NULL(strstr(plain_inner, "\"start\":3"));
5487+
ASSERT_NULL(strstr(plain_inner, "\"ranges_truncated\":true"));
5488+
free(plain_inner);
5489+
free(plain);
5490+
5491+
/* The reader's own limit stops the list early, so it must say so even
5492+
* though the producer sent no marker. */
5493+
char *widest =
5494+
cbm_mcp_handle_tool(srv, "check_index_coverage",
5495+
"{\"project\":\"coverage-marker\",\"paths\":[\"src/wide.c\"],\"format\":\"json\"}");
5496+
ASSERT_NOT_NULL(widest);
5497+
char *wide_inner = extract_text_content(widest);
5498+
ASSERT_NOT_NULL(wide_inner);
5499+
ASSERT_NOT_NULL(strstr(wide_inner, "\"ranges_truncated\":true"));
5500+
free(wide_inner);
5501+
free(widest);
5502+
5503+
free(wide);
5504+
cbm_mcp_server_free(srv);
5505+
PASS();
5506+
}
5507+
54285508
TEST(tool_check_index_coverage_reports_paths_scopes_and_ranges) {
54295509
char tmp[256];
54305510
cbm_mcp_server_t *srv = setup_snippet_server(tmp, sizeof(tmp));
@@ -19846,6 +19926,7 @@ SUITE(mcp) {
1984619926
RUN_TEST(tool_list_projects_preserves_root_beyond_one_kib);
1984719927
RUN_TEST(tool_index_status_no_project);
1984819928
RUN_TEST(tool_check_index_coverage_finds_path_beyond_status_cap);
19929+
RUN_TEST(tool_check_index_coverage_reports_truncation_marker_issue963);
1984919930
RUN_TEST(tool_check_index_coverage_reports_paths_scopes_and_ranges);
1985019931
RUN_TEST(tool_check_index_coverage_pages_exact_paths_and_restores_raw_diagnostics);
1985119932
RUN_TEST(tool_check_index_coverage_preserves_multiple_scope_labels);

‎tests/test_parse_coverage.c‎

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* GREEN (fixed): cbm_extract_file sets parse_incomplete=true iff the tree
2121
* contains ERROR/MISSING nodes, records the 1-based line
2222
* ranges of the TOP-MOST error regions ("start-end,..."),
23-
* bounded by the 64-region cap, and clean files stay
23+
* bounded by the 256-region cap, and clean files stay
2424
* completely unflagged (no false positives).
2525
*
2626
* BEST-EFFORT framing (must never be weakened the other way): a flag means
@@ -791,6 +791,49 @@ TEST(c_ifdef_split_is_partial_never_unusable) {
791791
PASS();
792792
}
793793

794+
/* Phase 0 finding 2, pinned so a tree-sitter bump cannot change it quietly.
795+
*
796+
* The C grammar handles `_Thread_local` unevenly, and these are the three
797+
* forms measured on the grammar shipped today:
798+
*
799+
* static _Thread_local int x = 0; parses clean
800+
* static _Thread_local int *p; parses clean
801+
* static _Thread_local char b[8]; fails — flagged as range 1-1
802+
*
803+
* The array line really is missing from the graph, so flagging it is the
804+
* honest answer, not a false positive. This test exists to make a grammar
805+
* bump visible: if a newer grammar fixes the array form, this goes red and
806+
* says so, instead of leaving a wrong note in the plan. (The plan's Phase 0
807+
* also listed the pointer form as failing. It does not fail today.) */
808+
TEST(c_thread_local_grammar_limit_is_pinned_issue963) {
809+
CBMFileResult *ok = do_extract("static _Thread_local int x = 0;\n"
810+
"void f(void) { x = 1; }\n",
811+
CBM_LANG_C, "tls_init.c");
812+
ASSERT_NOT_NULL(ok);
813+
ASSERT_FALSE(ok->parse_incomplete);
814+
cbm_free_result(ok);
815+
816+
CBMFileResult *ptr = do_extract("static _Thread_local int *p;\n"
817+
"void f(void) { p = 0; }\n",
818+
CBM_LANG_C, "tls_ptr.c");
819+
ASSERT_NOT_NULL(ptr);
820+
ASSERT_FALSE(ptr->parse_incomplete);
821+
cbm_free_result(ptr);
822+
823+
CBMFileResult *arr = do_extract("static _Thread_local char b[8];\n"
824+
"void f(void) { b[0] = 0; }\n",
825+
CBM_LANG_C, "tls_arr.c");
826+
ASSERT_NOT_NULL(arr);
827+
ASSERT_TRUE(arr->parse_incomplete);
828+
ASSERT_NOT_NULL(arr->error_ranges);
829+
/* The range names the one broken line, not the whole file. */
830+
ASSERT_STR_EQ("1-1", arr->error_ranges);
831+
/* The clean function below it still reaches the graph. */
832+
ASSERT_TRUE(has_def(arr, "f"));
833+
cbm_free_result(arr);
834+
PASS();
835+
}
836+
794837
SUITE(parse_coverage) {
795838
RUN_TEST(c_ifdef_split_brace_sets_parse_incomplete);
796839
RUN_TEST(c_ifdef_split_brace_neighbors_still_extracted);
@@ -826,4 +869,5 @@ SUITE(parse_coverage) {
826869
RUN_TEST(dockerfile_trailing_blank_at_eof_not_flagged_issue1746);
827870
RUN_TEST(real_error_before_eof_still_flagged_with_trailing_blank_issue1746);
828871
RUN_TEST(width_bearing_error_at_eof_still_flagged_with_trailing_blank_issue1746);
872+
RUN_TEST(c_thread_local_grammar_limit_is_pinned_issue963);
829873
}

‎tests/test_pipeline.c‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13409,6 +13409,87 @@ TEST(pipeline_markdown_and_config_prose_reaches_fts_body) {
1340913409
PASS();
1341013410
}
1341113411

13412+
#if defined(CBM_COVERAGE_MARKER_TEST_API) && CBM_COVERAGE_MARKER_TEST_API
13413+
/* Join two Studio Export range strings and hand back the result. The caller
13414+
* owns nothing: the string lives in the aggregate's arena, so copy it out
13415+
* before the arena goes away. */
13416+
static void join_export_ranges(const char *agg_ranges, int agg_regions, const char *part_ranges,
13417+
int part_regions, char *out, size_t out_size, int *out_regions) {
13418+
CBMFileResult aggregate;
13419+
CBMFileResult part;
13420+
memset(&aggregate, 0, sizeof(aggregate));
13421+
memset(&part, 0, sizeof(part));
13422+
cbm_arena_init(&aggregate.arena);
13423+
cbm_arena_init(&part.arena);
13424+
aggregate.error_ranges = agg_ranges;
13425+
aggregate.error_region_count = agg_regions;
13426+
aggregate.parse_incomplete = true;
13427+
part.error_ranges = part_ranges;
13428+
part.error_region_count = part_regions;
13429+
part.parse_incomplete = true;
13430+
13431+
out[0] = '\0';
13432+
*out_regions = 0;
13433+
if (cbm_pipeline_coverage_marker_test_join(&aggregate, &part)) {
13434+
snprintf(out, out_size, "%s", aggregate.error_ranges ? aggregate.error_ranges : "");
13435+
*out_regions = aggregate.error_region_count;
13436+
}
13437+
cbm_arena_destroy(&aggregate.arena);
13438+
cbm_arena_destroy(&part.arena);
13439+
}
13440+
13441+
/* Count the "+" characters in a range string. A truncation marker must appear
13442+
* once and only at the end: every reader stops at the first token that is not
13443+
* a range, so a marker in the middle silently hides every range after it. */
13444+
static int count_plus(const char *s) {
13445+
int n = 0;
13446+
for (const char *p = s; *p; p++) {
13447+
if (*p == '+') {
13448+
n++;
13449+
}
13450+
}
13451+
return n;
13452+
}
13453+
13454+
TEST(pipeline_objectscript_export_range_join_keeps_one_trailing_marker) {
13455+
char joined[256];
13456+
int regions = 0;
13457+
13458+
/* Neither side dropped anything, so nothing invents a marker. */
13459+
join_export_ranges("1-2,5-9", 2, "20-24", 1, joined, sizeof(joined), &regions);
13460+
ASSERT_STR_EQ("1-2,5-9,20-24", joined);
13461+
ASSERT_EQ(0, count_plus(joined));
13462+
ASSERT_EQ(3, regions);
13463+
13464+
/* The first class overran the cap. Its marker must move to the end, so the
13465+
* second class's ranges stay visible in front of it. */
13466+
join_export_ranges("1-2,5-9,+7", 2, "20-24", 1, joined, sizeof(joined), &regions);
13467+
ASSERT_STR_EQ("1-2,5-9,20-24,+7", joined);
13468+
ASSERT_EQ(1, count_plus(joined));
13469+
13470+
/* The second class overran the cap. Same single trailing marker. */
13471+
join_export_ranges("1-2", 1, "20-24,+3", 1, joined, sizeof(joined), &regions);
13472+
ASSERT_STR_EQ("1-2,20-24,+3", joined);
13473+
ASSERT_EQ(1, count_plus(joined));
13474+
13475+
/* Both overran. One marker, carrying the sum, or the report would
13476+
* under-count what it threw away. */
13477+
join_export_ranges("1-2,+7", 1, "20-24,+3", 1, joined, sizeof(joined), &regions);
13478+
ASSERT_STR_EQ("1-2,20-24,+10", joined);
13479+
ASSERT_EQ(1, count_plus(joined));
13480+
13481+
/* An empty aggregate is the first class in the file. No leading comma. */
13482+
join_export_ranges(NULL, 0, "20-24,+3", 1, joined, sizeof(joined), &regions);
13483+
ASSERT_STR_EQ("20-24,+3", joined);
13484+
ASSERT_EQ(1, regions);
13485+
13486+
/* A part with nothing to say leaves the aggregate exactly as it was. */
13487+
join_export_ranges("1-2,+7", 1, "", 0, joined, sizeof(joined), &regions);
13488+
ASSERT_STR_EQ("1-2,+7", joined);
13489+
PASS();
13490+
}
13491+
#endif
13492+
1341213493
SUITE(pipeline) {
1341313494
RUN_TEST(pipeline_lsp_surface_persisted_and_body_edit_invariant);
1341413495
/* Index lock */
@@ -13453,6 +13534,9 @@ SUITE(pipeline) {
1345313534
RUN_TEST(pipeline_objectscript_export_preserves_calls_sequential_parallel);
1345413535
RUN_TEST(pipeline_objectscript_export_incremental_matches_full_relationships);
1345513536
RUN_TEST(pipeline_objectscript_export_aggregate_exceeds_arena_block_table);
13537+
#if defined(CBM_COVERAGE_MARKER_TEST_API) && CBM_COVERAGE_MARKER_TEST_API
13538+
RUN_TEST(pipeline_objectscript_export_range_join_keeps_one_trailing_marker);
13539+
#endif
1345613540
RUN_TEST(pipeline_env_access_configures_sequential_parallel_parity);
1345713541
RUN_TEST(pipeline_call_reference_sequential_parallel_edge_set_parity);
1345813542
RUN_TEST(pipeline_incremental_cross_file_call_reference_matches_fresh_full);

0 commit comments

Comments
 (0)