From 855dcec4c18a3faf33fa966856675ca7bac6e675 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 09:59:44 +0000 Subject: [PATCH] fix(web): declare the three remaining implicit return types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Residue from CodeRabbit's review of #1381 after ae2be83 and 5e69b7e landed the substantive findings. Those two commits typed `upstreamFailure`, `upstreamUnreachable`, and the `activateRequest` / `webhookRequest` / `transcribeRequest` helpers; these three were missed: - `getOpenAiHeaders` -> `Record | null` - `sdpRequest` -> `Request` - `upstreamResponse` -> `Response` Types only — no behavior, no response shape, no test expectation changes. `getOpenAiHeaders` already returned exactly this union on both paths, so the annotation is descriptive rather than a narrowing. Verified at this head: tsc clean, eslint clean, web suite 271 passed / 1 failed — the pre-existing billing-chat-gating timeout (#1116), matching 5e69b7e exactly. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0138bgDsN77ZFnktuYw26Pqa --- .../src/app/api/__tests__/realtime-session-route.test.ts | 8 ++++++-- apps/web/src/app/api/realtime/session/route.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/api/__tests__/realtime-session-route.test.ts b/apps/web/src/app/api/__tests__/realtime-session-route.test.ts index ca69a73d6..e723fe739 100644 --- a/apps/web/src/app/api/__tests__/realtime-session-route.test.ts +++ b/apps/web/src/app/api/__tests__/realtime-session-route.test.ts @@ -4,7 +4,7 @@ import { GET, POST } from '@/app/api/realtime/session/route'; const ORIGINAL_OPENAI_KEY = process.env.OPENAI_API_KEY; const ORIGINAL_SAFETY_IDENTIFIER = process.env.OPENAI_SAFETY_IDENTIFIER; -function sdpRequest(body: string) { +function sdpRequest(body: string): Request { return new Request('http://localhost/api/realtime/session', { method: 'POST', headers: { 'content-type': 'application/sdp' }, @@ -12,7 +12,11 @@ function sdpRequest(body: string) { }); } -function upstreamResponse(body: unknown, status = 200, headers: HeadersInit = { 'content-type': 'application/json' }) { +function upstreamResponse( + body: unknown, + status = 200, + headers: HeadersInit = { 'content-type': 'application/json' }, +): Response { return new Response(typeof body === 'string' ? body : JSON.stringify(body), { status, headers, diff --git a/apps/web/src/app/api/realtime/session/route.ts b/apps/web/src/app/api/realtime/session/route.ts index ab2277c4c..65b9e3250 100644 --- a/apps/web/src/app/api/realtime/session/route.ts +++ b/apps/web/src/app/api/realtime/session/route.ts @@ -85,7 +85,7 @@ function upstreamUnreachable( return Response.json({ error, code }, { status: 502 }); } -function getOpenAiHeaders(contentType?: string) { +function getOpenAiHeaders(contentType?: string): Record | null { const apiKey = process.env.OPENAI_API_KEY; if (!apiKey) {