From b8f2bd513e3f0b0ffbcea456127245ef0eb8a958 Mon Sep 17 00:00:00 2001 From: Colby Mchenry Date: Wed, 30 Sep 2026 21:34:36 +0000 Subject: [PATCH] test(ui-server): time the busiest symbol as the best of five requests (#2208) `answers in under 100 ms` took one wall-clock sample while the rest of the suite ran in parallel, and failed under that load at 250-430 ms (three times in one day of full-suite runs) while passing alone. It now takes the fastest of five warm requests: contention is gone from at least one, and a real slowdown is slow on every one. Co-authored-by: Claude Opus 5.5 --- __tests__/ui-server-api.test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/__tests__/ui-server-api.test.ts b/__tests__/ui-server-api.test.ts index 7282a5bce..a750e31e6 100644 --- a/__tests__/ui-server-api.test.ts +++ b/__tests__/ui-server-api.test.ts @@ -1093,9 +1093,16 @@ describe.runIf(CodeGraph.isInitialized(path.resolve(__dirname, '..')))( await repoGet(`/api/node/${hit.id}`); // warm - const started = performance.now(); - const res = await repoGet(`/api/node/${hit.id}`); - const elapsed = performance.now() - started; + // The fastest of a few requests: one sample, taken while the rest of the + // suite runs in parallel, measured the machine's load (250–430 ms) as + // often as the endpoint. A real slowdown is slow on every request. + let res!: Response; + let elapsed = Infinity; + for (let i = 0; i < 5; i++) { + const started = performance.now(); + res = await repoGet(`/api/node/${hit.id}`); + elapsed = Math.min(elapsed, performance.now() - started); + } expect(res.status).toBe(200); const body = JSON.parse(res.body);