From 6ec1b01d8cb874f5619eda9d2a1f3655eaef228f Mon Sep 17 00:00:00 2001 From: Jermiah Joseph Date: Wed, 11 Nov 2026 07:08:09 -0500 Subject: [PATCH] test(observability): scope the no-log assertion to the scrape route The test "a successful scrape writes no log line" asserted logs.lines was empty. The capture is cleared in beforeEach, but a streamed request from an earlier test finished later and logged request.usage_missing (reason=disconnect) into the new capture. The test then failed on the merge commit b21b789 (CI run 43016837766, 3920 pass, 1 fail). It passes alone, 4 of 4 runs. The test is meant to prove the scrape itself logs nothing, so it now filters the capture to lines naming /plugboard/metrics. Rejected: waiting for background work, which would slow every run to hide one race. Validation: bun test test/http/observability.test.ts passes; full bun test run recorded in the PR. --- test/http/observability.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/http/observability.test.ts b/test/http/observability.test.ts index 64860712..018bfa78 100644 --- a/test/http/observability.test.ts +++ b/test/http/observability.test.ts @@ -236,7 +236,9 @@ describe("#56 GET /plugboard/metrics", () => { test("a successful scrape writes no log line", async () => { await route({ metrics: true }) await server!.send({ path: "/plugboard/metrics" }) - expect(logs.lines).toEqual([]) + // Only lines about this scrape count. A background line from an earlier test (e.g. a streamed + // request's usage_missing) can land after beforeEach clears the capture, so filter on the route. + expect(logs.lines.filter((line) => line.raw.includes("/plugboard/metrics"))).toEqual([]) }) test("off: the route records no metrics at all", async () => {