From e582df3194845e808db920730fe4c63c47eb659e Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Thu, 2 Apr 2026 13:33:43 +0200 Subject: [PATCH] Convert perf assertions to warnings, add CI job timeout Shared CI runners are too variable for hard timing thresholds. Performance is still logged and warns above 15s, but no longer blocks the test suite. Added 30min timeout on test-unix jobs. --- .github/workflows/dry-run.yml | 1 + tests/test_incremental.c | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.yml index 62ea7e37f..959ce4488 100644 --- a/.github/workflows/dry-run.yml +++ b/.github/workflows/dry-run.yml @@ -181,6 +181,7 @@ jobs: cc: cc cxx: c++ runs-on: ${{ matrix.os }} + timeout-minutes: 30 steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 diff --git a/tests/test_incremental.c b/tests/test_incremental.c index e1907d0e3..735dbab63 100644 --- a/tests/test_incremental.c +++ b/tests/test_incremental.c @@ -803,11 +803,13 @@ TEST(incr_perf_single_file_fast) { char *resp = index_repo_timed(&ms, &peak_mb); ASSERT(resp != NULL); free(resp); -#define MAX_TOOL_MS 15000 /* 15s max — accounts for slower CI runners */ +#define PERF_WARN_MS 15000 /* warn above 15s — slow CI runners may exceed this */ - ASSERT_LT((int)ms, MAX_TOOL_MS); /* must be faster than full index */ - - printf(" [perf] single file incremental: %.0fms\n", ms); + if ((int)ms > PERF_WARN_MS) { + printf(" [PERF WARNING] single file incremental: %.0fms (>%dms)\n", ms, PERF_WARN_MS); + } else { + printf(" [perf] single file incremental: %.0fms\n", ms); + } delete_file_at("fastapi/incr_perf_probe.py"); PASS(); @@ -817,7 +819,7 @@ TEST(incr_perf_single_file_fast) { * PHASE 8: MCP tool integration — comprehensive per-tool tests * * Every tool, every parameter, error paths, timeouts. - * Timing: each call_tool_timed() asserts < MAX_TOOL_MS. + * Timing: each call_tool_timed() warns if > PERF_WARN_MS. * ══════════════════════════════════════════════════════════════════ */ static char *call_tool_timed(const char *tool, double *ms, const char *args_fmt, ...) { @@ -886,11 +888,13 @@ static int resp_lacks_key(const char *resp, const char *key) { return !resp_has_key(resp, key); } -/* Helper: assert tool call succeeds within timeout */ -#define TOOL_OK(resp, ms) \ - do { \ - ASSERT((resp) != NULL); \ - ASSERT_LT((int)(ms), MAX_TOOL_MS); \ +/* Helper: assert tool call succeeds, warn if slow */ +#define TOOL_OK(resp, ms) \ + do { \ + ASSERT((resp) != NULL); \ + if ((int)(ms) > PERF_WARN_MS) { \ + printf(" [PERF WARNING] tool call: %.0fms (>%dms)\n", (ms), PERF_WARN_MS); \ + } \ } while (0) /* Helper: assert response is not an error */