Wait for the stable terminal job state, without asserting a transient pending * window or a particular number of worker polls. */
| 9016 | /* Wait for the stable terminal job state, without asserting a transient pending |
| 9017 | * window or a particular number of worker polls. */ |
| 9018 | static char *architecture_wait_for_result(cbm_mcp_server_t *srv, const char *args) { |
| 9019 | uint64_t deadline = cbm_now_ms() + 10000; |
| 9020 | for (;;) { |
| 9021 | char *response = cbm_mcp_handle_tool(srv, "get_architecture", args); |
| 9022 | char *text = extract_text_content(response); |
| 9023 | free(response); |
| 9024 | yyjson_doc *doc = text ? yyjson_read(text, strlen(text), 0) : NULL; |
| 9025 | yyjson_val *status = doc ? yyjson_obj_get(yyjson_doc_get_root(doc), "status") : NULL; |
| 9026 | const char *value = yyjson_get_str(status); |
| 9027 | bool pending = value && strcmp(value, "pending") == 0; |
| 9028 | yyjson_doc_free(doc); |
| 9029 | if (!pending || cbm_now_ms() >= deadline) { |
| 9030 | return text; |
| 9031 | } |
| 9032 | free(text); |
| 9033 | sqlite3_sleep(1); |
| 9034 | } |
| 9035 | } |
| 9036 | |
| 9037 | TEST(tool_get_architecture_behavior_evidence_cache_isolation) { |
| 9038 | char cache[CBM_SZ_1K]; |
no test coverage detected