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

Function architecture_wait_for_result

tests/test_mcp.c:9018–9035  ·  view source on GitHub ↗

Wait for the stable terminal job state, without asserting a transient pending * window or a particular number of worker polls. */

Source from the content-addressed store, hash-verified

9016/* Wait for the stable terminal job state, without asserting a transient pending
9017 * window or a particular number of worker polls. */
9018static 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
9037TEST(tool_get_architecture_behavior_evidence_cache_isolation) {
9038 char cache[CBM_SZ_1K];

Callers 1

test_mcp.cFile · 0.85

Calls 3

cbm_now_msFunction · 0.85
cbm_mcp_handle_toolFunction · 0.85
extract_text_contentFunction · 0.85

Tested by

no test coverage detected