Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
test(mcp): tighten systemic failure test assertions and sweep phase comments
Shashwat Mishra05e0ccae81ac
diff --git a/src/mcp/mcp.c b/src/mcp/mcp.cindex 26b0c70ed..2cd2fb22e 100644--- a/src/mcp/mcp.c+++ b/src/mcp/mcp.c@@ -7756,7 +7756,7 @@ static bool supervisor_suspect_contains(char **s, int n, const char *rel) {return false;}-/* Append one quarantine entry "rel\tphase\n" (phase = "crash"|"hang") to the+/* Append one quarantine entry "rel\tphase\n" (phase = "crash"|"hang"|"error") to the* quarantine list. The worker's loader parses this back and reports the skip's* phase in skipped[]; a bare "rel" line is still tolerated there (defaults crash). */static bool supervisor_append_quarantine(const char *path, const char *rel, const char *phase) {@@ -7790,7 +7790,7 @@ cbm_mcp_supervised_result_disposition_t cbm_mcp_supervised_result_disposition(* - the worker's own response on a clean first run (the common path);* - after a crash/hang, the response from a clean single-threaded RECOVERY run* that quarantines the culprit file(s) — status="indexed" with them listed in- * skipped[] as phase="crash"/"hang", and the good files indexed;+ * skipped[] as phase="crash"/"hang"/"error", and the good files indexed;* - a best-effort PARTIAL index (one final quarantine-only run) if the recovery* loop cannot converge but at least one file was quarantined;* - a contained-failure response only if even that cannot produce a clean run.@@ -7839,7 +7839,7 @@ static char *index_run_supervised(cbm_mcp_server_t *srv, const char *args) {* (for a hang the oldest still-open file IS the stuck one; for a crash* it is the longest-running suspect — the best single deterministic* pick). A clean run then indexes the good files and reports the- * quarantined ones as phase="crash"/"hang" skips via the ordinary+ * quarantined ones as phase="crash"/"hang"/"error" skips via the ordinary* Stage-2 skip plumbing. The old design re-ran SINGLE-THREADED to keep* one exact marker; at scale that fell into the sequential crawl, went* quiet, was killed as a hang mid-pass, and the stale marker got FOURdiff --git a/tests/test_mcp.c b/tests/test_mcp.cindex 068fb2684..6b7af64ed 100644--- a/tests/test_mcp.c+++ b/tests/test_mcp.c@@ -10048,6 +10048,8 @@ enum {IDXPAR_NO_QUARANTINE = 64, /* crasher missing from skipped[] */IDXPAR_INNOCENT_HIT = 65, /* a good file was quarantined/skipped */IDXPAR_GOOD_MISSING = 66, /* good file's Function absent from the store */+ IDXPAR_NOT_ERROR = 67, /* systemic failure did not report status error */+ IDXPAR_OUTCOME_WRONG = 68, /* systemic failure outcome is not exit_nonzero */};#ifndef _WIN32@@ -10176,13 +10178,24 @@ static int idxpar_systemic_exit_nonzero_give_up_check(const char *repo_dir) {cbm_unsetenv("CBM_TEST_EXIT_ON");if (!resp) {- return IDXPAR_OK;+ return IDXPAR_NULL_RESP;}- bool gave_up = response_contains_json_fragment(resp, "\"status\":\"gave_up\"") ||- response_contains_json_fragment(resp, "\"status\":\"error\"") ||- response_contains_json_fragment(resp, "\"action\":\"give_up\"");+ bool is_error = response_contains_json_fragment(resp, "\"status\":\"error\"");+ bool is_exit_nonzero = response_contains_json_fragment(resp, "\"outcome\":\"exit_nonzero\"");+ bool innocent_hit =+ strstr(resp, "idxpar_good_a.py") != NULL || strstr(resp, "idxpar_good_b.py") != NULL;free(resp);- return gave_up ? IDXPAR_OK : 99;++ if (!is_error) {+ return IDXPAR_NOT_ERROR;+ }+ if (!is_exit_nonzero) {+ return IDXPAR_OUTCOME_WRONG;+ }+ if (innocent_hit) {+ return IDXPAR_INNOCENT_HIT;+ }+ return IDXPAR_OK;}#endif /* !_WIN32 */