| 9620 | }; |
| 9621 | |
| 9622 | static int idx845_index_inprocess_check(const char *repo_dir) { |
| 9623 | int spawns_before = cbm_index_supervisor_spawn_count(); |
| 9624 | |
| 9625 | cbm_mcp_server_t *srv = cbm_mcp_server_new(NULL); |
| 9626 | if (!srv) { |
| 9627 | return IDX845_NO_RESULT; |
| 9628 | } |
| 9629 | char args[1024]; |
| 9630 | snprintf(args, sizeof(args), "{\"repo_path\":\"%s\",\"mode\":\"fast\"}", repo_dir); |
| 9631 | char *resp = cbm_mcp_handle_tool(srv, "index_repository", args); |
| 9632 | |
| 9633 | int code = IDX845_OK; |
| 9634 | if (cbm_index_supervisor_spawn_count() != spawns_before) { |
| 9635 | code = IDX845_SPAWNED; |
| 9636 | } else if (!resp) { |
| 9637 | code = IDX845_NO_RESULT; |
| 9638 | } else if (!response_contains_json_fragment(resp, "\"status\":\"indexed\"")) { |
| 9639 | code = IDX845_NOT_INDEXED; |
| 9640 | } |
| 9641 | free(resp); |
| 9642 | cbm_mcp_server_free(srv); |
| 9643 | return code; |
| 9644 | } |
| 9645 | |
| 9646 | TEST(index_supervisor_gate_requires_marked_host_issue845) { |
| 9647 | /* #845: index_repository via cbm_mcp_handle_tool from an EMBEDDER (this test |
no test coverage detected