From a5a8549ee528bd25a90fd828a285dcbcbbbf362e Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Thu, 5 Nov 2026 01:35:24 -0600 Subject: [PATCH] fix(quota-gatherer): typecheck errors in opendesign-renewal test (TS2339 on closure-narrowed lets) PR #6121 claimed tsc --noEmit clean on the strength of a pipeline-masked exit code (bunx tsc | head); the real exit was 2 with three TS2339 errors in the renewal test: bare lets assigned inside dep closures are narrowed to their null initializer at the expect sites. Capture through a holder object instead. Verified now with the real exit code: tsc --noEmit = 0, bun tests 8/8. --- .../aggregator/src/opendesign-renewal.test.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pm-stack/aggregator/src/opendesign-renewal.test.ts b/pm-stack/aggregator/src/opendesign-renewal.test.ts index 09e23ad632..bab26b0dbf 100644 --- a/pm-stack/aggregator/src/opendesign-renewal.test.ts +++ b/pm-stack/aggregator/src/opendesign-renewal.test.ts @@ -62,16 +62,20 @@ describe("renewOpenDesignSession", () => { }); test("a dead stored session is renewed from the browser cookie, validated before storing", async () => { - let written: OpenDesignCredentialLike | null = null; - let validated: OpenDesignCredentialLike | null = null; + // Holder object, not bare lets: TS narrows closure-assigned lets to + // their initializer at the expect() sites below (TS2339 on never). + const captured: { + written: OpenDesignCredentialLike | null; + validated: OpenDesignCredentialLike | null; + } = { written: null, validated: null }; const state = await renewOpenDesignSession( baseDeps({ - readCredential: () => written ?? stored, + readCredential: () => captured.written ?? stored, writeCredential: (value: OpenDesignCredentialLike) => { - written = value; + captured.written = value; }, validateCredential: async (candidate: OpenDesignCredentialLike) => { - validated = candidate; + captured.validated = candidate; }, fetchSession: async (cred: OpenDesignCredentialLike) => cred.cookie.includes("fresh-token") ? { expiresAt: "2026-11-12T02:00:00.000Z" } : null, @@ -81,9 +85,9 @@ describe("renewOpenDesignSession", () => { }) as never, ); expect(state.status).toBe("renewed"); - expect(validated?.cookie).toContain("fresh-token"); - expect(written?.cookie).toContain("fresh-token"); - expect(written?.workspaceId).toBe("ws1"); + expect(captured.validated?.cookie).toContain("fresh-token"); + expect(captured.written?.cookie).toContain("fresh-token"); + expect(captured.written?.workspaceId).toBe("ws1"); expect(state.horizonHours).toBe(168); });