Walk up from `start`, deriving a project name at each level and querying * search_graph until an indexed project is found (or the walk is exhausted). * Stops at the first non-error result: a valid project with zero hits is a * legitimate "no match" and must NOT cause a parent-directory probe. */
| 767 | * Stops at the first non-error result: a valid project with zero hits is a |
| 768 | * legitimate "no match" and must NOT cause a parent-directory probe. */ |
| 769 | static char *ha_resolve_and_query(cbm_mcp_server_t *srv, const char *start, const char *token) { |
| 770 | char *project = ha_resolve_indexed_project_with_root(srv, start, NULL, 0U); |
| 771 | if (!project) { |
| 772 | return NULL; |
| 773 | } |
| 774 | char *args = ha_build_args(project, token); |
| 775 | free(project); |
| 776 | if (!args) { |
| 777 | return NULL; |
| 778 | } |
| 779 | char *result = cbm_mcp_handle_tool(srv, "search_graph", args); |
| 780 | free(args); |
| 781 | if (!result) { |
| 782 | return NULL; |
| 783 | } |
| 784 | bool is_error = false; |
| 785 | char *context = ha_format_context(result, token, &is_error); |
| 786 | free(result); |
| 787 | return context; |
| 788 | } |
| 789 | |
| 790 | static bool ha_envelope_succeeded(const char *envelope) { |
| 791 | yyjson_doc *doc = envelope ? yyjson_read(envelope, strlen(envelope), 0) : NULL; |
no test coverage detected