Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Feishu markdown delivery: a new markdown optimizer, FeishuClient methods to send/update 'post' markdown messages, FeishuRuntime updated to optimize and use markdown APIs across message flows, and tests adjusted to mock/assert the markdown APIs. ChangesFeishu Markdown Message Support
Sequence Diagram(s)sequenceDiagram
participant Client as FeishuClient
participant Runtime as FeishuRuntime
participant Optimizer as optimizeMarkdownForFeishu
Runtime->>Optimizer: provide raw text segments
Optimizer-->>Runtime: return optimized markdown
Runtime->>Client: sendMarkdown(target, chunk) / updateMarkdown(messageId, chunk)
Client-->>Runtime: returns message_id or void
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/presenter/remoteControlPresenter/feishu/feishuRuntime.ts (1)
716-726:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDelete stale chunks before the resend fallback.
When an earlier optimized chunk changes, this branch re-sends the whole segment and replaces
messageIds, but the oldexisting.messageIdsare never removed. That leaves stale chunks visible alongside the replacement copy.♻️ Suggested fix
) { + for (const messageId of existing.messageIds) { + if (messageId) { + await this.deps.client.deleteMessage(messageId) + } + } + const messageIds: Array<string | null> = [] for (const chunk of nextChunks) { const messageId = await this.deps.client.sendMarkdown(target, chunk) messageIds.push(messageId ?? null) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/presenter/remoteControlPresenter/feishu/feishuRuntime.ts` around lines 716 - 726, The resend branch re-sends nextChunks into a fresh messageIds array but never removes the old existing.messageIds, leaving stale messages visible; before re-sending, iterate existing.messageIds and delete each non-null id (e.g. await this.deps.client.deleteMessage(id)) handling nulls and awaiting all deletions, then proceed to send chunks with this.deps.client.sendMarkdown and replace existing.messageIds with the new messageIds. Ensure deletions are awaited/aggregated (Promise.all) and that you update the stored message id list after successful resend.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/presenter/remoteControlPresenter/feishu/feishuClient.ts`:
- Around line 32-37: The createMarkdownPayload helper currently returns an
object shaped as { zh_cn: { content: ... } } but must be wrapped in a post
object per Feishu/Lark IM v1 schema; update the createMarkdownPayload function
so it returns JSON.stringify({ post: { zh_cn: { content: [[{ tag: 'md', text }]]
} } }) so sendMarkdown and updateMarkdown receive the correct payload for
msg_type: 'post' (zh_cn.title can remain omitted).
---
Outside diff comments:
In `@src/main/presenter/remoteControlPresenter/feishu/feishuRuntime.ts`:
- Around line 716-726: The resend branch re-sends nextChunks into a fresh
messageIds array but never removes the old existing.messageIds, leaving stale
messages visible; before re-sending, iterate existing.messageIds and delete each
non-null id (e.g. await this.deps.client.deleteMessage(id)) handling nulls and
awaiting all deletions, then proceed to send chunks with
this.deps.client.sendMarkdown and replace existing.messageIds with the new
messageIds. Ensure deletions are awaited/aggregated (Promise.all) and that you
update the stored message id list after successful resend.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6e8bc384-cbe8-491e-a96f-c0e9d94a1887
📒 Files selected for processing (4)
src/main/presenter/remoteControlPresenter/feishu/feishuClient.tssrc/main/presenter/remoteControlPresenter/feishu/feishuMarkdown.tssrc/main/presenter/remoteControlPresenter/feishu/feishuRuntime.tstest/main/presenter/remoteControlPresenter/feishuRuntime.test.ts
| export function optimizeMarkdownForFeishu(text: string, cardVersion = 2): string { | ||
| try { | ||
| let r = optimizeMarkdownStyleCore(text, cardVersion) | ||
| r = stripInvalidImageKeys(r) |
There was a problem hiding this comment.
Preserve fenced code examples when stripping image keys.
optimizeMarkdownStyleCore() protects fenced blocks, but stripInvalidImageKeys() runs afterwards on the restored markdown. A code sample containing  will be rewritten, so code snippets are no longer preserved verbatim.
before:
after:
Summary by CodeRabbit
New Features
Tests