fix(eve): unblock main typecheck after chat-sdk drift (#1504) - #1506
Open
iroiro147 wants to merge 1 commit into
Open
fix(eve): unblock main typecheck after chat-sdk drift (#1504)#1506iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
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>
Contributor
|
@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(eve): unblock main typecheck after chat-sdk drift (#1504)
Summary
CI
typecheckand every downstream E2E job onmainis failing because the vendored chat-sdk roll added two type requirements that callers don't yet satisfy:Authorgained requiredfullName: string.MessageDatagained requiredformatted: FormattedContent,metadata: MessageMetadata,attachments: Attachment[].ActionEvent'sthreadfield uses the interface's lone generic (TRawMessage) where it lands onThread<TRawMessage, unknown>— so with the defaultTRawMessage = unknown,event.threadisThread<unknown, unknown>, not assignable to theThread<Record<string, unknown>, unknown>thatbridgeSendaccepts.Reproduced on a clean checkout of
origin/main(6ad578ae) withnpx tsc --noEmit -p packages/eve: 5 errors acrosschatSdkChannel.ts:273,photon/inboundContent.test.ts, andphoton/photonIMessageChannel.test.ts.Fix
src/public/channels/chat-sdk/chatSdkChannel.ts: narrowevent.threadat thebridgeSendboundary withas unknown as Thread. Runtime is unaffected —serializeThreadonly callsthread.toJSON(). Two-line comment explains the variance mismatch. The file remains at exactly the 700-line production-source cap enforced byanalytics.test.ts— tests still fail when accessed via themessagesview wrapper (5 sites).src/public/channels/photon/photonIMessageChannel.test.ts: same rich stub, factored through abuildMessage(text, threadId)helper so the four call sites stay consistent.Verification
pnpm run typecheck— clean (was 5 TS errors).pnpm run test:unit→ 5829 passed / 1 skipped / 4 pre-existing failures intest/bin-bootstrap.test.ts(Node ≥24 environment check; the runner is on v22.22.3). Reproduced identically on a clean checkout oforigin/mainwith the patch stashed, so this is environmental and unrelated.pnpm exec vitest run src/public/channels/photon src/public/channels/chat-sdk→ 26/26 pass.Compatibility / risk
chatSdkChannel.ts:273is a no-op at runtime; documents the variance mismatch at the seam where the SDK's drifted type meets our bridge.ActionEventinterface sothreadusesThread<Record<string, unknown>, TRawMessage>(or similar); out of scope here since.generated/compiled/chat/*is vendored.Fixes #1504