Skip to content

feat: add chat member shortcut#1983

Open
sang-neo03 wants to merge 22 commits into
mainfrom
feat/im-chat-member-add
Open

feat: add chat member shortcut#1983
sang-neo03 wants to merge 22 commits into
mainfrom
feat/im-chat-member-add

Conversation

@sang-neo03

@sang-neo03 sang-neo03 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a dedicated im +chat-members-add shortcut so callers can add user open_id and bot app_id values without constructing Meta API JSON. The shortcut preserves partial results, processes users before bots, and provides explicit recovery guidance for unknown outcomes.

Changes

  • Add ImChatMembersAdd request validation, dry-run previews, two-request execution, and stable combined output in shortcuts/im/im_chat_members_add.go
  • Run shortcut validation and confirmation before scope preflight in shortcuts/common/runner.go
  • Add unit, dry-run, and live workflow coverage under shortcuts/im/ and tests/cli_e2e/im/
  • Document identity selection, result fields, and safe retry behavior in skills/lark-im/

Test Plan

  • make unit-test passed
  • validate passed
  • local-eval passed (E2E 2/2; the bot-identity case used a scope-specific environment skip)
  • skillave completed 3/4; the remaining outcome_unknown recovery case was accepted by explicit human approval
  • acceptance-reviewer passed (5/5 cases)
  • manual verification: lark-cli im +chat-members-add --help and lark-cli im +chat-members-add --chat-id oc_review123 --bots bot_123 --as user --dry-run

Related Issues

N/A

Summary by CodeRabbit

  • New Features

    • Added im +chat-members-add to add users and bots to group chats.
    • Supports validation, deduplication, dry-run previews, confirmation, combined results, and partial-failure reporting.
    • Added recovery guidance for uncertain bot-addition outcomes.
  • Bug Fixes

    • Scope checks now occur after validation, dry-run handling, and confirmation gates.
  • Documentation

    • Updated IM shortcut guidance, permissions, usage examples, and recovery procedures.
  • Tests

    • Added comprehensive unit and end-to-end coverage for chat-member additions and dry-run workflows.

@github-actions github-actions Bot added domain/im PR touches the im domain size/L Large or sensitive change across domains or core paths labels Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44b2a860-eff4-47ed-87c5-c1e902fe5ef3

📥 Commits

Reviewing files that changed from the base of the PR and between 6675e3c and a0b4263.

📒 Files selected for processing (12)
  • shortcuts/common/runner.go
  • shortcuts/common/runner_scope_test.go
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_chat_members_add.go
  • shortcuts/im/im_chat_members_add_test.go
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-chat-create.md
  • skills/lark-im/references/lark-im-chat-members-add.md
  • tests/cli_e2e/im/chat_members_add_dryrun_test.go
  • tests/cli_e2e/im/chat_members_add_workflow_test.go
  • tests/cli_e2e/im/coverage.md

📝 Walkthrough

Walkthrough

Adds the +chat-members-add IM shortcut with validation, dry-run previews, sequential user/bot requests, aggregated results, unknown-outcome handling, documentation, registration, and unit/e2e coverage. Scope checks now run after local validation and confirmation gates, immediately before execution.

Changes

Chat member addition

Layer / File(s) Summary
Scope preflight ordering
shortcuts/common/runner.go, shortcuts/common/runner_scope_test.go
Moves scope resolution until after validation, dry-run handling, and high-risk confirmation; adds ordering tests.
Shortcut contract and request construction
shortcuts/im/im_chat_members_add.go, shortcuts/im/im_chat_members_add_test.go
Adds command metadata, ID validation and deduplication, shared validated specs, and user/bot dry-run request construction.
Batch execution and result projection
shortcuts/im/im_chat_members_add.go, shortcuts/im/im_chat_members_add_test.go
Executes users before bots, validates and merges responses, computes success counts, and handles partial and unknown outcomes.
Registration, documentation, and integration coverage
shortcuts/im/shortcuts.go, shortcuts/im/helpers_test.go, skills/lark-im/*, tests/cli_e2e/im/*
Registers the shortcut, documents its workflow and recovery rules, and adds dry-run, workflow, permission parsing, and coverage updates.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant ImChatMembersAdd
  participant MembersAPI
  CLI->>ImChatMembersAdd: validate and confirm request
  CLI->>ImChatMembersAdd: execute user and bot batches
  ImChatMembersAdd->>MembersAPI: add users
  ImChatMembersAdd->>MembersAPI: add bots
  MembersAPI-->>ImChatMembersAdd: response lists or errors
  ImChatMembersAdd-->>CLI: merged result
Loading

Possibly related PRs

  • larksuite/cli#1398: Adds another IM member-related shortcut and updates the same shortcut registry area.

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a chat member shortcut.
Description check ✅ Passed The description follows the required template and covers summary, changes, test plan, and related issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/im-chat-member-add

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@a0b42632067e8c34548a3b08bad7630ac2f34439

🧩 Skill update

npx skills add larksuite/cli#feat/im-chat-member-add -y -g

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.40974% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.12%. Comparing base (c876841) to head (a0b4263).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/im/im_chat_members_add.go 93.93% 16 Missing and 5 partials ⚠️
shortcuts/common/runner.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1983      +/-   ##
==========================================
+ Coverage   75.05%   75.12%   +0.07%     
==========================================
  Files         901      902       +1     
  Lines       95391    95738     +347     
==========================================
+ Hits        71591    71924     +333     
- Misses      18307    18319      +12     
- Partials     5493     5495       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

domain/im PR touches the im domain feature size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant