From a4506de1c53326d2ec2ec25338d9f8125d4972d6 Mon Sep 17 00:00:00 2001 From: Rene Fichtmueller Date: Sat, 18 Jul 2026 07:11:14 +0000 Subject: [PATCH] fix: tolerate 1-2ms setTimeout jitter in the Ollama-enrichment timeout test CI build-verify run #23 (commit 388c4f3) failed on a strict lower bound (elapsed >= 5000) that measured 4999ms -- normal clock/timer jitter between the two Date.now() reads, not a real regression in the 5s AbortController timeout itself. Confirmed unrelated to that commit's actual change (a route-glue removal). Loosened the floor to 4990ms. --- src/features/hijack-alerts/__tests__/detector.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/hijack-alerts/__tests__/detector.test.ts b/src/features/hijack-alerts/__tests__/detector.test.ts index a11bff4..0e2a5e0 100644 --- a/src/features/hijack-alerts/__tests__/detector.test.ts +++ b/src/features/hijack-alerts/__tests__/detector.test.ts @@ -210,8 +210,10 @@ describe('Hijack Detector', () => { const elapsed = Date.now() - startTime expect(result).toBe(baseDesc) - // AbortController timeout should trigger around 5-6 seconds - expect(elapsed).toBeGreaterThanOrEqual(5000) + // AbortController timeout should trigger around 5-6 seconds. A few ms + // of tolerance below 5000 absorbs normal setTimeout/Date.now() jitter + // between the two clock reads (observed flake: 4999ms). + expect(elapsed).toBeGreaterThanOrEqual(4990) expect(elapsed).toBeLessThan(7000) }, { timeout: 10000 })