| 21591 | }; |
| 21592 | |
| 21593 | static int idx845_index_inprocess_check(const char *repo_dir) { |
| 21594 | int spawns_before = cbm_index_supervisor_spawn_count(); |
| 21595 | |
| 21596 | cbm_mcp_server_t *srv = cbm_mcp_server_new(NULL); |
| 21597 | if (!srv) { |
| 21598 | return IDX845_NO_RESULT; |
| 21599 | } |
| 21600 | char args[1024]; |
| 21601 | snprintf(args, sizeof(args), "{\"repo_path\":\"%s\",\"mode\":\"fast\"}", repo_dir); |
| 21602 | char *resp = cbm_mcp_handle_tool(srv, "index_repository", args); |
| 21603 | |
| 21604 | int code = IDX845_OK; |
| 21605 | if (cbm_index_supervisor_spawn_count() != spawns_before) { |
| 21606 | code = IDX845_SPAWNED; |
| 21607 | } else if (!resp) { |
| 21608 | code = IDX845_NO_RESULT; |
| 21609 | } else if (!response_contains_json_fragment(resp, "\"status\":\"indexed\"")) { |
| 21610 | code = IDX845_NOT_INDEXED; |
| 21611 | } |
| 21612 | free(resp); |
| 21613 | cbm_mcp_server_free(srv); |
| 21614 | return code; |
| 21615 | } |
| 21616 | |
| 21617 | TEST(index_supervisor_gate_requires_marked_host_issue845) { |
| 21618 | /* #845: index_repository via cbm_mcp_handle_tool from an EMBEDDER (this test |
no test coverage detected