MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / index_repo

Function index_repo

tests/test_incremental.c:108–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static char *index_repo(void) {
109 char args[512];
110 snprintf(args, sizeof(args), "{\"repo_path\":\"%s\"}", g_repodir);
111 char *resp = cbm_mcp_handle_tool(g_srv, "index_repository", args);
112 /* Fail-closed at the source: every caller asserts resp != NULL, but an
113 * error response (e.g. a transient pre-publication abort that preserves
114 * the previous index) used to slip through and cascade into dozens of
115 * mysterious count/query failures downstream — a 99-test pile-up on the
116 * Windows leg traced back to exactly this. Surface the real cause once,
117 * here, and let the existing non-NULL asserts fail loudly. */
118 if (resp && strstr(resp, "\"isError\":true")) {
119 fprintf(stderr, " index_repo: index_repository returned an error response:\n %.400s\n",
120 resp);
121 free(resp);
122 return NULL;
123 }
124 return resp;
125}
126
127/* Timed index: returns response, sets *elapsed_ms and *peak_rss_mb */
128static char *index_repo_timed(double *elapsed_ms, size_t *peak_rss_mb) {

Callers 2

index_repo_timedFunction · 0.85
test_incremental.cFile · 0.85

Calls 1

cbm_mcp_handle_toolFunction · 0.85

Tested by

no test coverage detected