Skip to content

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.

fix(test): retire the last stub-era ingest probes; unfork the cypher guard

Martin Vogel0b736b2f6fb7
diff --git a/tests/test_cypher.c b/tests/test_cypher.c
index ff5250c48..6a67007cb 100644
--- a/tests/test_cypher.c
+++ b/tests/test_cypher.c
@@ -3871,36 +3871,29 @@ TEST(cypher_exec_prop_string_with_escaped_quote) {
}
TEST(cypher_wide_return_projection_bounded) {
-#ifdef _WIN32
- SKIP_PLATFORM("fork crash-isolation is POSIX-only; the parse-time bound is platform-agnostic");
-#else
+ /* In-process on every platform. This test used a forked child as crash
+ * isolation, but a fork of the sanitized runner that then does real
+ * store setup is byte-fragile on macOS: any growth of the store-open
+ * path (a 1.5KB schema addition crossed it) gets the child killed
+ * before the query ever runs — the guard was failing on harness
+ * fragility, not on the bound. The parse-time bound is the contract;
+ * assert it directly. If it ever regresses, the overflow aborts the
+ * runner loudly — a less graceful report, an equally gating one. And
+ * in-process runs on Windows too, which the fork never did. */
char query[4096];
int off = snprintf(query, sizeof(query), "MATCH (f:Function) RETURN ");
for (int i = 0; i < 48; i++) { /* 48 > CBM_SZ_32 (32) fixed columns */
off += snprintf(query + off, sizeof(query) - (size_t)off, "%sf.p%d", i ? ", " : "", i);
}
- fflush(NULL);
- pid_t pid = fork();
- if (pid == 0) {
- cbm_store_t *s = setup_cypher_store();
- cbm_cypher_result_t r = {0};
- (void)cbm_cypher_execute(s, query, "test", 0, &r);
- cbm_cypher_result_free(&r);
- cbm_store_close(s);
- _exit(0); /* reached only when execution did NOT overflow */
- }
- ASSERT_TRUE(pid > 0);
- int status = 0;
- (void)waitpid(pid, &status, 0);
- if (WIFSIGNALED(status)) {
- char msg[96];
- snprintf(msg, sizeof(msg), "wide RETURN killed by signal %d — projection stack overflow",
- WTERMSIG(status));
- FAIL(msg);
- }
- ASSERT_TRUE(WIFEXITED(status));
+ cbm_store_t *s = setup_cypher_store();
+ ASSERT_NOT_NULL(s);
+ cbm_cypher_result_t r = {0};
+ int rc = cbm_cypher_execute(s, query, "test", 0, &r);
+ ASSERT_TRUE(rc != 0); /* rejected at parse time, never executed */
+ ASSERT_EQ(r.row_count, 0);
+ cbm_cypher_result_free(&r);
+ cbm_store_close(s);
PASS();
-#endif
}
/* #601: an unbounded whole-graph OPTIONAL MATCH / GROUP BY does
diff --git a/tests/test_daemon_runtime.c b/tests/test_daemon_runtime.c
index 5f41d914e..4f321d9b1 100644
--- a/tests/test_daemon_runtime.c
+++ b/tests/test_daemon_runtime.c
@@ -927,14 +927,23 @@ static void *runtime_real_application_detect_changes_thread(void *opaque) {
return NULL;
}
-static bool runtime_real_application_ingest_probe(cbm_daemon_runtime_client_t *client) {
+static bool runtime_real_application_ingest_probe(cbm_daemon_runtime_client_t *client,
+ const char *project) {
+ /* A valid minimal ingest against the seeded project: unresolved names
+ * store nothing, and the response reports them — proof the client's
+ * request path works. (traces:[] was the old stub's probe; it is a
+ * tool error now, and the daemon requires the project explicitly.) */
+ char args[512];
+ (void)snprintf(args, sizeof(args),
+ "{\"project\":\"%s\",\"traces\":[{\"caller\":\"runtime-probe-a\","
+ "\"callee\":\"runtime-probe-b\"}]}",
+ project ? project : "");
uint8_t *response = NULL;
uint32_t response_length = 0;
- cbm_daemon_runtime_application_status_t status =
- cbm_daemon_application_client_tool(client, "ingest_traces", "{\"traces\":[]}", &response,
- &response_length, RUNTIME_TEST_TIMEOUT_MS);
+ cbm_daemon_runtime_application_status_t status = cbm_daemon_application_client_tool(
+ client, "ingest_traces", args, &response, &response_length, RUNTIME_TEST_TIMEOUT_MS);
bool usable = status == CBM_DAEMON_RUNTIME_APPLICATION_OK && response && response_length > 0 &&
- strstr((const char *)response, "traces_received");
+ strstr((const char *)response, "pairs_unmatched");
free(response);
return usable;
}
@@ -3665,7 +3674,7 @@ TEST(daemon_runtime_disconnect_cancels_blocked_non_index_child_and_preserves_oth
NULL, NULL, RUNTIME_TEST_TIMEOUT_MS) ==
CBM_DAEMON_RUNTIME_APPLICATION_OK;
bool second_usable_before =
- contexts_set && runtime_real_application_ingest_probe(second) &&
+ contexts_set && runtime_real_application_ingest_probe(second, project) &&
cbm_daemon_runtime_client_heartbeat(second, RUNTIME_TEST_TIMEOUT_MS);
runtime_real_application_call_t call = {
@@ -3740,7 +3749,7 @@ TEST(daemon_runtime_disconnect_cancels_blocked_non_index_child_and_preserves_oth
}
bool second_usable_after = second && child_cleanup_complete &&
- runtime_real_application_ingest_probe(second) &&
+ runtime_real_application_ingest_probe(second, project) &&
cbm_daemon_runtime_client_heartbeat(second, RUNTIME_TEST_TIMEOUT_MS);
bool second_closed = false;
if (second) {