Skip to content

fix(eve): unblock main typecheck after chat-sdk drift (#1504) - #1506

Open
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:claude/issue1504-chat-sdk-drift-20260802
Open

fix(eve): unblock main typecheck after chat-sdk drift (#1504)#1506
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:claude/issue1504-chat-sdk-drift-20260802

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

fix(eve): unblock main typecheck after chat-sdk drift (#1504)

Summary

CI typecheck and every downstream E2E job on main is failing because the vendored chat-sdk roll added two type requirements that callers don't yet satisfy:

  1. Author gained required fullName: string.
  2. MessageData gained required formatted: FormattedContent, metadata: MessageMetadata, attachments: Attachment[].
  3. ActionEvent's thread field uses the interface's lone generic (TRawMessage) where it lands on Thread<TRawMessage, unknown> — so with the default TRawMessage = unknown, event.thread is Thread<unknown, unknown>, not assignable to the Thread<Record<string, unknown>, unknown> that bridgeSend accepts.

Reproduced on a clean checkout of origin/main (6ad578ae) with npx tsc --noEmit -p packages/eve: 5 errors across chatSdkChannel.ts:273, photon/inboundContent.test.ts, and photon/photonIMessageChannel.test.ts.

Fix

  • src/public/channels/chat-sdk/chatSdkChannel.ts: narrow event.thread at the bridgeSend boundary with as unknown as Thread. Runtime is unaffected — serializeThread only calls thread.toJSON(). Two-line comment explains the variance mismatch. The file remains at exactly the 700-line production-source cap enforced by analytics.test.tstests still fail when accessed via the messages view wrapper (5 sites).
  • src/public/channels/photon/photonIMessageChannel.test.ts: same rich stub, factored through a buildMessage(text, threadId) helper so the four call sites stay consistent.

Verification

  • pnpm run typecheckclean (was 5 TS errors).
  • pnpm run test:unit5829 passed / 1 skipped / 4 pre-existing failures in test/bin-bootstrap.test.ts (Node ≥24 environment check; the runner is on v22.22.3). Reproduced identically on a clean checkout of origin/main with the patch stashed, so this is environmental and unrelated.
  • Targeted: pnpm exec vitest run src/public/channels/photon src/public/channels/chat-sdk26/26 pass.

Compatibility / risk

  • No production-code shape change; test stubs are additive only (extra required fields, plus the previously required ones). Existing successful test expectations are untouched.
  • The cast at chatSdkChannel.ts:273 is a no-op at runtime; documents the variance mismatch at the seam where the SDK's drifted type meets our bridge.
  • Longer-term fix is to update the chat-sdk ActionEvent interface so thread uses Thread<Record<string, unknown>, TRawMessage> (or similar); out of scope here since .generated/compiled/chat/* is vendored.

Fixes #1504

CI typecheck + all E2E jobs are red on main because the vendored
chat-sdk roll added two type requirements callers don't satisfy:

1. `Author` gained required `fullName: string`.
2. `MessageData` gained required `formatted`, `metadata`, `attachments`.
3. `ActionEvent`'s `thread` field uses the interface's generic
   (`TRawMessage`) where it lands on `Thread<TRawMessage, unknown>` so
   with the default `TRawMessage = unknown` the thread is
   `Thread<unknown, unknown>` — not assignable to the
   `Thread<Record<string, unknown>, unknown>` that `bridgeSend` accepts.

Repair:

- `src/public/channels/chat-sdk/chatSdkChannel.ts` — narrow
  `event.thread` to the `Thread` shape `bridgeSend` accepts with an
  `as unknown as Thread` cast and a one-line note. Runtime is
  unaffected; `serializeThread` only calls `thread.toJSON()` on the
  value. Added 2 comment lines + 1 wrapping newline; the file remains
  at exactly the 700-line production cap enforced by
  `file-length.test.ts`.
- `src/public/channels/photon/inboundContent.test.ts` — provide the
  richer `Message` stub (`fullName`, `formatted: parseMarkdown(text)`,
  `metadata`, explicit `attachments`).
- `src/public/channels/photon/photonIMessageChannel.test.ts` — same
  richer stub, factored through a `buildMessage` helper to keep the
  four call sites consistent.

Verified locally:

- `pnpm run typecheck` — clean (previously 5 TS errors).
- `pnpm run test:unit` — 5829 passed / 1 skipped / **4 pre-existing
  failures in `test/bin-bootstrap.test.ts`** (Node 24 vs Node 22
  environment check, unrelated to this change — reproduced on a clean
  checkout of `origin/main`).
- Targeted: `pnpm exec vitest run src/public/channels/photon
  src/public/channels/chat-sdk` — 26/26 pass.

Fixes vercel#1504.

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typecheck + all E2E red on main: vendored chat-sdk drifted Author / MessageData / Thread

1 participant