feat: add IM chat disband shortcut#1197
Conversation
📝 WalkthroughWalkthroughThis PR adds a new high-risk IM shortcut ChangesIM Chat Disband Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
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 unit tests (beta)
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.
🧹 Nitpick comments (1)
shortcuts/im/im_chat_disband_test.go (1)
41-49: ⚡ Quick winSimplify body assertion to strictly enforce no request body.
The current logic unmarshals and checks for an empty JSON object, which would pass if the body is
{}. For a DELETE request withnilbody (line 42 ofim_chat_disband.go), the HTTP layer should send zero bytes, not even an empty JSON object.♻️ Proposed simplification
- if len(stub.CapturedBody) != 0 { - var body map[string]interface{} - if err := json.Unmarshal(stub.CapturedBody, &body); err != nil { - t.Fatalf("request body invalid JSON: %v\n%s", err, string(stub.CapturedBody)) - } - if len(body) != 0 { - t.Fatalf("request body = %#v, want empty", body) - } - } + if len(stub.CapturedBody) != 0 { + t.Fatalf("DELETE request sent body = %q, want no body", string(stub.CapturedBody)) + }🤖 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 `@shortcuts/im/im_chat_disband_test.go` around lines 41 - 49, The test in im_chat_disband_test.go currently unmarshals stub.CapturedBody and allows an empty JSON object ("{}"), but a DELETE with a nil body (as sent by im_chat_disband.go) must be zero bytes; replace the current block with a strict assertion that stub.CapturedBody length is zero and fail the test if any bytes were sent (i.e., if len(stub.CapturedBody) != 0 then t.Fatalf with the raw captured bytes), so the test fails on "{}" as well as any other payload.
🤖 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.
Nitpick comments:
In `@shortcuts/im/im_chat_disband_test.go`:
- Around line 41-49: The test in im_chat_disband_test.go currently unmarshals
stub.CapturedBody and allows an empty JSON object ("{}"), but a DELETE with a
nil body (as sent by im_chat_disband.go) must be zero bytes; replace the current
block with a strict assertion that stub.CapturedBody length is zero and fail the
test if any bytes were sent (i.e., if len(stub.CapturedBody) != 0 then t.Fatalf
with the raw captured bytes), so the test fails on "{}" as well as any other
payload.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 22a71ec6-720c-43c8-a9be-30c89ae99445
📒 Files selected for processing (10)
shortcuts/im/builders_test.goshortcuts/im/helpers_test.goshortcuts/im/im_chat_disband.goshortcuts/im/im_chat_disband_test.goshortcuts/im/shortcuts.goskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-chat-disband.mdtests/cli_e2e/im/chat_disband_dryrun_test.gotests/cli_e2e/im/chat_disband_workflow_test.gotests/cli_e2e/im/helpers_test.go
Summary
Add a high-risk IM shortcut for disbanding group chats through the documented
DELETE /open-apis/im/v1/chats/{chat_id}API.Changes
im +chat-disbandwith required--chat-id,--yesexecution confirmation, dry-run output, andim:chat:deletescope metadata.im:chat:delete.Test Plan
PATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH go test ./shortcuts/im -run 'TestImChatDisband|TestShortcutDryRunShapes|TestShortcuts' -count=1PATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH go test ./tests/cli_e2e/im -run 'TestIM_ChatDisbandDryRun|TestIM_ChatDisbandWorkflowAsBot' -count=1PATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH go test ./shortcuts/im -count=1PATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH make fmt-checkPATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH go vet ./...PATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH make unit-testPATH=/Users/bytedance/.cache/codex-runtimes/go/go/bin:$PATH make buildNote: the live disband E2E skipped locally because the configured local app does not have
im:chat:delete; the dry-run and shortcut tests validate the request shape locally.Summary by CodeRabbit
New Features
im +chat-disbandcommand to disband group chats; marked as high-risk operation requiring confirmation; supports dry-run mode.Documentation
im +chat-disbandcommand with usage examples and required permissions.Tests