Skip to content

Commit 21a93a5

Browse files
waleedlatif1claude
andcommitted
fix(mcp): annotate undici/DOM type-bridge double-casts in pinned-fetch
Strict audit was failing on two new `as unknown as` casts in pinned-fetch.ts. They bridge DOM `RequestInit`/`Response` ↔ undici equivalents (structurally compatible at runtime since Node's global fetch is undici) and are required to satisfy the FetchLike contract. Annotate so they count as documented exemptions instead of new violations. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 14bfcb7 commit 21a93a5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

apps/sim/lib/mcp/pinned-fetch.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ export function createMcpPinnedFetch(resolvedIP: string): FetchLike {
2727
// Cast the init through unknown to bridge the typing without losing the
2828
// critical `dispatcher` typing on the call itself.
2929
const undiciInit: UndiciRequestInit = {
30+
// double-cast-allowed: DOM RequestInit and undici RequestInit are structurally compatible at runtime (Node's global fetch IS undici) but the TS types differ
3031
...(init as unknown as UndiciRequestInit),
3132
dispatcher,
3233
}
3334
const response = await undiciFetch(url as string | URL, undiciInit)
35+
// double-cast-allowed: undici Response and DOM Response are structurally compatible at runtime; bridging the types is required to satisfy the FetchLike contract
3436
return response as unknown as Response
3537
}) satisfies FetchLike
3638
}

0 commit comments

Comments
 (0)