From d84599e6004dcaa020caaf856748b9edec33a109 Mon Sep 17 00:00:00 2001 From: maxsol Date: Sat, 21 Nov 2026 20:45:37 +0100 Subject: [PATCH 1/3] build: let the commit-msg hook pass merge commits A local git merge writes "Merge branch ..." and the hook blocked it. CI skips merge commits (git log --no-merges), so the hook does too: it exits early while MERGE_HEAD exists. --- .githooks/commit-msg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 951f800..a28f26e 100755 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -1,3 +1,5 @@ #!/bin/sh # Check the message against Conventional Commits (ADR 31). Enable: git config core.hooksPath .githooks +# A merge commit is skipped, as in CI: its message is git's "Merge branch …". +git rev-parse -q --verify MERGE_HEAD > /dev/null && exit 0 exec node scripts/check-commits.ts --file "$1" From 44a878a4da8246d8a5b0cf7c476649bc37cd8f7c Mon Sep 17 00:00:00 2001 From: maxsol Date: Sat, 21 Nov 2026 20:48:44 +0100 Subject: [PATCH 2/3] test: check the image header read without a clock "decodes in under 50 ms" failed on a slow CI runner (61 ms) while the code was right. The test now puts invalid base64 after the first 64 KB: an image read whole would not decode, one read by its header does. Checked: with the whole string decoded, the test fails. --- packages/engine/test/providers/anthropic/estimate.test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/engine/test/providers/anthropic/estimate.test.ts b/packages/engine/test/providers/anthropic/estimate.test.ts index 4c9bad7..3afa98d 100644 --- a/packages/engine/test/providers/anthropic/estimate.test.ts +++ b/packages/engine/test/providers/anthropic/estimate.test.ts @@ -54,10 +54,9 @@ describe("imageSize", () => { }); test("reads only the header bytes: a huge image decodes no more than its first 64 KB", () => { - const huge = PNG_96x64 + "A".repeat(20_000_000); - const start = performance.now(); + // Not valid base64 after the first 64 KB: an image read whole would not decode. No clock, so no flake on CI. + const huge = `${PNG_96x64}${"A".repeat(200_000)}!!!!`; expect(imageSize(huge)).toEqual({ width: 96, height: 64 }); - expect(performance.now() - start).toBeLessThan(50); }); test("returns undefined for data that is not a known image format", () => { From 62a4c5d04525f118bb9eea8a88caaa1bdc1bc96c Mon Sep 17 00:00:00 2001 From: maxsol Date: Sat, 21 Nov 2026 20:50:14 +0100 Subject: [PATCH 3/3] test: run the load tests after the unit tests, one at a time A CI run on Node failed with three unit tests past vitest's 5 s timeout; they take 16-68 ms. That run was twice as slow as usual, and query/performance.test.ts, which takes 24 s, ran beside them. The load tests take most of the CPU, so on a slow runner the unit tests beside them stall, and their own timings get noise (latency.test.ts once measured a p95 of 661 ms). Two vitest projects now: unit (files in parallel) and perf (the three load test files, fileParallelism off), run one after the other by pnpm test. bun test already runs files one at a time, and its job never timed out. A longer timeout was rejected: it would hide a real hang too. --- package.json | 2 +- vitest.config.ts | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9efae7c..ee741cf 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "lint": "biome ci .", "format": "biome check --write .", "typecheck": "tsc -p tsconfig.json && pnpm -r typecheck", - "test": "vitest run", + "test": "vitest run --project unit && vitest run --project perf", "test:bun": "bun test ./fixtures ./packages/engine ./packages/shared ./packages/web ./scripts", "check": "pnpm lint && pnpm typecheck && pnpm test && pnpm test:mod && pnpm layers && pnpm scan && pnpm egress && pnpm supply-chain", "layers": "node scripts/check-layers.ts", diff --git a/vitest.config.ts b/vitest.config.ts index a8935a1..9a3f412 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,6 +1,21 @@ import { configDefaults, defineConfig } from "vitest/config"; +// Load tests measure time, and take most of the CPU while they run. Beside the unit tests they made unit tests +// pass vitest's 5 s timeout on slow CI runners, and their own numbers noisy. So `pnpm test` runs `unit` (files in +// parallel) and then `perf` (one file at a time, nothing beside it). +const PERF = [ + "packages/engine/test/query/performance.test.ts", + "packages/engine/test/ingest/performance.test.ts", + "packages/engine/test/api/latency.test.ts", +]; + export default defineConfig({ - // The mod's tests import claude-code/testing and run under `claude plugin test` (pnpm test:mod). - test: { exclude: [...configDefaults.exclude, "packages/mod/**"] }, + test: { + // The mod's tests import claude-code/testing and run under `claude plugin test` (pnpm test:mod). + exclude: [...configDefaults.exclude, "packages/mod/**"], + projects: [ + { extends: true, test: { name: "unit", exclude: PERF } }, + { extends: true, test: { name: "perf", include: PERF, fileParallelism: false } }, + ], + }, });