From 15b673d1784d4efdc674d46c7775ef3027fbc753 Mon Sep 17 00:00:00 2001 From: Trevor Nash-Keller <4496266+trevornk@users.noreply.github.com> Date: Wed, 26 Aug 2026 15:46:09 -0500 Subject: [PATCH] fix(desktop): restore the typecheck by completing the typing-sync harness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `main` is red. 68518c1f9b added a dedicated `renderTypingSync` harness for the typing-aware deferral tests, but its params object omits `updateSessionState`, which `BackgroundSyncParams` requires: src/app/contrib/hooks/use-background-sync.test.ts(660,25): error TS2345: Property 'updateSessionState' is missing in type '{ ... }' but required in type 'BackgroundSyncParams'. `npm run typecheck` exits 2, so `apps/desktop :: check:lint` fails and the JS & TS checks job goes red on every open PR regardless of its contents. Vitest did not catch this because it transpiles without typechecking, so the new suite passes while `tsc -p .` fails. Supply the missing prop. The updater runs against a throwaway state — this harness never exercises the transcript path — and it is added to the existing `stable` object rather than inline, because the harness's own comment requires every param to keep a stable identity across the tick-driven re-renders; a fresh `vi.fn()` per render would re-run the connect-reseed effect and re-subscribe the throttle, polluting the very counts the tests observe. Verified: all three tsc projects clean (`tsc -p .`, `tsconfig.electron.json`, `tsconfig.e2e.json`), use-background-sync suites 26/26, eslint clean. --- .../app/contrib/hooks/use-background-sync.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts index 794fbe53b6..8a56eeb293 100644 --- a/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts +++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts @@ -653,7 +653,19 @@ describe('typing-aware sessions.changed deferral', () => { refreshCurrentModel: vi.fn(), refreshHermesConfig: vi.fn(), refreshMessagingSessions: vi.fn(), - requestGateway: vi.fn(async () => ({ sessions: [] })) as never + requestGateway: vi.fn(async () => ({ sessions: [] })) as never, + // Required by the hook's params. This harness never drives the + // transcript path, so the updater just runs against a throwaway state — + // but it must live in `stable` like every other prop, since a fresh + // identity per render would re-run the connect-reseed effect. + updateSessionState: vi.fn( + ( + _sessionId: string, + updater: (state: ReturnType) => ReturnType< + typeof createClientSessionState + > + ) => updater(createClientSessionState(ACTIVE_STORED_ID)) + ) } return renderHook(() => {