fix(feishu): support Lark private chats as direct messages#31400
fix(feishu): support Lark private chats as direct messages#31400Takhoffman merged 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR broadens the Feishu/Lark channel's concept of a "direct message" from the strictly Key changes:
Confidence Score: 4/5
Last reviewed commit: eeea06b |
| const syntheticChatType: "p2p" | "group" | "private" = | ||
| event.chat_type === "group" ? "group" : "p2p"; |
There was a problem hiding this comment.
Overly-wide type annotation that can never be "private"
The explicit type annotation "p2p" | "group" | "private" is misleading here because the ternary expression can only ever evaluate to "p2p" or "group" — "private" is normalized away and will never actually be assigned to syntheticChatType. Without the explicit annotation TypeScript would infer the narrower and more accurate "p2p" | "group". Keeping "private" in the annotation suggests to future readers that a synthetic reaction event could carry chat_type === "private", which will never happen.
| const syntheticChatType: "p2p" | "group" | "private" = | |
| event.chat_type === "group" ? "group" : "p2p"; | |
| const syntheticChatType: "p2p" | "group" = | |
| event.chat_type === "group" ? "group" : "p2p"; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/monitor.account.ts
Line: 96-97
Comment:
**Overly-wide type annotation that can never be `"private"`**
The explicit type annotation `"p2p" | "group" | "private"` is misleading here because the ternary expression can only ever evaluate to `"p2p"` or `"group"` — `"private"` is normalized away and will never actually be assigned to `syntheticChatType`. Without the explicit annotation TypeScript would infer the narrower and more accurate `"p2p" | "group"`. Keeping `"private"` in the annotation suggests to future readers that a synthetic reaction event could carry `chat_type === "private"`, which will never happen.
```suggestion
const syntheticChatType: "p2p" | "group" =
event.chat_type === "group" ? "group" : "p2p";
```
How can I resolve this? If you propose a fix, please make it concise.eeea06b to
9584610
Compare
|
PR #31400 - fix(feishu): support Lark private chats as direct messages (#31400) Merged after verification.
|
…31400) thanks @stakeswky Verified: - pnpm test -- extensions/feishu/src/bot.checkBotMentioned.test.ts - pnpm build - pnpm check (blocked by unrelated baseline lint errors in untouched files) - pnpm test:macmini (not run after pnpm check blocked) Co-authored-by: stakeswky <64798754+stakeswky@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…31400) thanks @stakeswky Verified: - pnpm test -- extensions/feishu/src/bot.checkBotMentioned.test.ts - pnpm build - pnpm check (blocked by unrelated baseline lint errors in untouched files) - pnpm test:macmini (not run after pnpm check blocked) Co-authored-by: stakeswky <64798754+stakeswky@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…31400) thanks @stakeswky Verified: - pnpm test -- extensions/feishu/src/bot.checkBotMentioned.test.ts - pnpm build - pnpm check (blocked by unrelated baseline lint errors in untouched files) - pnpm test:macmini (not run after pnpm check blocked) Co-authored-by: stakeswky <64798754+stakeswky@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
chat_type=privateas a direct message path (same handling asp2p).p2pchecks.Root cause
Lark private chats can arrive with
chat_type=private, but the Feishu channel only treated DMs aschat_type === "p2p". This prevented private chats from following the intended DM handling path.Changes
private.chat_type !== "group"in mention-forward logic.isDirectin message handling so DM policy gating applies to bothp2pandprivate.p2p|groupwhile remaining type-safe.Validation
Fixes #31351