Skip to content

Commit 96a2fc3

Browse files
committed
test(mcp): ask for JSON where the coverage test asserts a JSON field
DeusData#1787 landed correct production code and a test that cannot pass on today's main. The test is the only thing wrong, and only in how it asks. check_index_coverage answers in the compact table by default, where a field name never appears: main.go main.go coverage_unavailable metadata_match read_source_and_reindex [] The test asserts on the JSON field spelling: strstr(response, "\"freshness\":\"metadata_match\"") Both halves are right; they were simply written against different response formats. The branch was cut on 2026-09-02, before that default changed, and was never rebased -- its CI green is from a main that no longer exists. The neighbouring coverage tests already pass "format":"json" for exactly this reason; this one predates them. So the request gains format=json and the assertions are untouched. Asserting the field rather than a bare strstr for "metadata_match" is what keeps the check exact: the value also appears in the table's recommended_action column and would be matched by any other path's row. Verified: build/c/test-runner mcp -> 318 passed, 0 failed, 4 skipped. Before this change the same suite reported 317 passed, 1 failed on identical production code. What this is NOT: a production defect. coverage_path_freshness on main uses cbm_path_info_utf8, exactly as DeusData#1787 intended, and the Windows second-vs- nanosecond truncation it fixes is gone. I checked that by reading origin/main rather than the local checkout, which was stale at 59a05eb and still carried the old helper -- that misreading briefly convinced me the merge had dropped the fix, and it had not. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent f347d59 commit 96a2fc3

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎tests/test_mcp.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5800,8 +5800,14 @@ TEST(tool_check_index_coverage_freshness_uses_indexer_mtime_source_issue1714) {
58005800
info.size),
58015801
CBM_STORE_OK);
58025802

5803-
char *response = cbm_mcp_handle_tool(
5804-
srv, "check_index_coverage", "{\"project\":\"test-project\",\"paths\":[\"main.go\"]}");
5803+
/* format=json, like every other coverage test here: the DEFAULT response is
5804+
* the compact table, in which a field name never appears. Keeping the
5805+
* assertion on the JSON field is what makes it exact — a bare strstr for
5806+
* "metadata_match" would also be satisfied by a neighbouring column or by
5807+
* another path's row. */
5808+
char *response = cbm_mcp_handle_tool(srv, "check_index_coverage",
5809+
"{\"project\":\"test-project\",\"paths\":[\"main.go\"],"
5810+
"\"format\":\"json\"}");
58055811
ASSERT_NOT_NULL(response);
58065812
ASSERT_NOT_NULL(strstr(response, "\"freshness\":\"metadata_match\""));
58075813
free(response);
@@ -5815,8 +5821,9 @@ TEST(tool_check_index_coverage_freshness_uses_indexer_mtime_source_issue1714) {
58155821
ASSERT_EQ(cbm_store_upsert_file_hash(store, "test-project", "main.go", "",
58165822
seconds_mtime_ns, info.size),
58175823
CBM_STORE_OK);
5818-
response = cbm_mcp_handle_tool(
5819-
srv, "check_index_coverage", "{\"project\":\"test-project\",\"paths\":[\"main.go\"]}");
5824+
response = cbm_mcp_handle_tool(srv, "check_index_coverage",
5825+
"{\"project\":\"test-project\",\"paths\":[\"main.go\"],"
5826+
"\"format\":\"json\"}");
58205827
ASSERT_NOT_NULL(response);
58215828
ASSERT_NOT_NULL(strstr(response, "\"freshness\":\"metadata_changed\""));
58225829
free(response);

0 commit comments

Comments
 (0)