Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
test(pi): pin result wrap, error throw, and abort in generated adapter
Alex Musichen2ae84e7f73b0
diff --git a/tests/test_agent_clients.c b/tests/test_agent_clients.cindex 89dda28ba..ceb717e18 100644--- a/tests/test_agent_clients.c+++ b/tests/test_agent_clients.c@@ -1139,6 +1139,24 @@ TEST(client_adapter_pi_emits_parameters_and_execute) {PASS();}+/* Result wrap + abort: Pi's TUI reads result.content; a spawn/parse failure+ * must throw rather than return a result without content; AbortSignal must+ * kill the cli child. String-shape only; a live Pi process is not gated. */+TEST(client_adapter_pi_wraps_result_and_honors_abort) {+ char *js = cbm_client_adapter_pi("/usr/local/bin/codebase-memory-mcp");+ ASSERT_NOT_NULL(js);+ ASSERT_NOT_NULL(strstr(js, "return { content, details: result ?? {} };"));+ ASSERT_NOT_NULL(strstr(js, "if (result && typeof result === 'object' && result.error)"));+ ASSERT_NOT_NULL(strstr(js, "throw new Error(String(result.error));"));+ ASSERT_NOT_NULL(strstr(js, "Array.isArray(result.content)"));+ ASSERT_NOT_NULL(+ strstr(js, "[{ type: 'text', text: JSON.stringify(result ?? null, null, 2) }]"));+ ASSERT_NOT_NULL(strstr(js, "signal?.addEventListener('abort', onAbort, { once: true })"));+ ASSERT_NOT_NULL(strstr(js, "if (!child.killed) child.kill();"));+ free(js);+ PASS();+}+/* #616 rejected `"` in its path template but not `\`, so a Windows home like* C:\Users\urs\bin produced `\u` — an invalid unicode escape — and the whole* auto-loaded plugin failed to parse. A broken plugin in an auto-load directory@@ -1230,6 +1248,7 @@ SUITE(agent_clients) {RUN_TEST(client_adapter_pi_registers_every_registry_tool);RUN_TEST(client_adapter_pi_default_exports_its_factory_issue1550);RUN_TEST(client_adapter_pi_emits_parameters_and_execute);+ RUN_TEST(client_adapter_pi_wraps_result_and_honors_abort);RUN_TEST(client_adapter_escapes_windows_paths_and_quotes);RUN_TEST(client_adapter_opencode_sends_the_required_hook_event);RUN_TEST(client_adapter_rejects_missing_binary_path);