Skip to content

feat: add im +chat-members-list for user and bot members#1610

Closed
jinzemo wants to merge 12 commits into
larksuite:mainfrom
jinzemo:feat/im-chat-members-list
Closed

feat: add im +chat-members-list for user and bot members#1610
jinzemo wants to merge 12 commits into
larksuite:mainfrom
jinzemo:feat/im-chat-members-list

Conversation

@jinzemo

@jinzemo jinzemo commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Listing a group chat's members previously required two separate Meta API calls (im chat.members get for users and im chat.members bots for bots). The new GET /open-apis/im/v1/chats/{chat_id}/members/list endpoint returns both in one response. This PR adds the im +chat-members-list shortcut that wraps it, returning users and bots together with one command.

Changes

  • Add im +chat-members-list shortcut in shortcuts/im/im_chat_members_list.go: dual-bucket users[] / bots[] output, --member-types filter, --member-id-type, single-page and --page-all pagination, server-truncation surfacing, and --chat-id path validation + escaping
  • Register the shortcut in shortcuts/im/shortcuts.go
  • Add unit tests in shortcuts/im/im_chat_members_list_test.go
  • Add skill reference skills/lark-im/references/lark-im-chat-members-list.md and a row in skills/lark-im/SKILL.md

Test Plan

  • make unit-test passed
  • validate passed (build / vet / unit / integration)
  • local-eval E2E passed (5/5); skillave 4/5 (the one miss is eval-agent nondeterminism, not a CLI defect — correctness is covered by E2E + acceptance)
  • acceptance-reviewer passed (10/10 scenarios)
  • manual verification: lark-cli im +chat-members-list --chat-id <oc_id> --dry-run (path escaping confirmed) and live dual-bucket listing with --member-types / --member-id-type / --page-all

Related Issues

N/A

Summary by CodeRabbit

  • New Features
    • Added +chat-members-list shortcut to list group chat members, returning stable users and bots buckets with optional totals, pagination (--page-all/--page-limit/tokens), and member-type filtering; emits truncation warnings when present.
  • Documentation
    • Updated the Lark IM skill shortcuts table and added full reference docs for +chat-members-list, including usage, output contract, and examples.
  • Tests
    • Added a comprehensive test suite covering parameter validation, dry-run request/path encoding, paging accumulation/limits, truncation handling, and pretty/table output ordering.

@coderabbitai

coderabbitai Bot commented Jun 26, 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: b60a1825-ffc7-451e-96b7-eefe159d2e65

📥 Commits

Reviewing files that changed from the base of the PR and between 14242d7 and 9af312b.

📒 Files selected for processing (7)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_chat_list_test.go
  • shortcuts/im/im_chat_members_list.go
  • shortcuts/im/im_chat_members_list_test.go
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-chat-members-list.md
✅ Files skipped from review due to trivial changes (3)
  • skills/lark-im/SKILL.md
  • shortcuts/im/helpers_test.go
  • skills/lark-im/references/lark-im-chat-members-list.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • shortcuts/im/shortcuts.go
  • shortcuts/im/im_chat_list_test.go
  • shortcuts/im/im_chat_members_list.go
  • shortcuts/im/im_chat_members_list_test.go

📝 Walkthrough

Walkthrough

Adds the +chat-members-list IM shortcut, including request construction, pagination, output rendering, validation, tests, registry wiring, and user-facing docs.

Changes

IM chat members list

Layer / File(s) Summary
Shortcut contract and parameter validation
shortcuts/im/im_chat_members_list.go, shortcuts/im/im_chat_members_list_test.go, shortcuts/im/im_chat_list_test.go
Adds +chat-members-list, member-type normalization, query parameter building, validation, dry-run path generation, and flag parsing support for member-types.
Execution, pagination, and rendering
shortcuts/im/im_chat_members_list.go, shortcuts/im/im_chat_members_list_test.go
Implements member-page fetching, page accumulation, output assembly, truncation warnings, and pretty-table rendering, with execution tests for paging, truncation, and column layout.
Registry and docs
shortcuts/im/shortcuts.go, shortcuts/im/helpers_test.go, shortcuts/im/im_chat_members_list_test.go, skills/lark-im/SKILL.md, skills/lark-im/references/lark-im-chat-members-list.md
Registers the shortcut in Shortcuts(), updates shortcut-order and metadata checks, and adds the skill table entry plus the new reference guide.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • larksuite/cli#1273: Both PRs touch the IM shortcut registry/testing by extending Shortcuts() and updating shortcuts/im/helpers_test.go’s expected command list.

Suggested labels

feature

Suggested reviewers

  • YangJunzhou-01
  • fangshuyu-768

Poem

🐰 I hopped through the chat list bright,
and found new members in the light.
Users and bots now split just so,
with pages gathered row by row.
A tiny nose twitch, a happy bounce—✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.28% 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 summarizes the new IM chat-members-list shortcut and its user/bot member focus.
Description check ✅ Passed The description follows the required template and includes 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 unit tests (beta)
  • Create PR with unit tests

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 github-actions Bot added domain/im PR touches the im domain size/L Large or sensitive change across domains or core paths labels Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

PR Quality Summary

CI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun.

Failed checks

  • deterministic-gate — failure — details
  • results — failure — details

deterministic-gate

  • public_content_generic_credentialshortcuts/im/im_chat_members_list.go:303 — public contribution contains a generic credential assignment — Action: remove the value from the public contribution and replace it with a non-sensitive placeholder
  • public_content_generic_credentialshortcuts/im/im_chat_members_list_test.go:259 — public contribution contains a generic credential assignment — Action: remove the value from the public contribution and replace it with a non-sensitive placeholder

@CLAassistant

CLAassistant commented Jun 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 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 `@shortcuts/im/im_chat_members_list_test.go`:
- Around line 34-65: The new error-path checks in normalizeMemberTypes should
assert the typed error contract instead of only nil/non-nil. Update
TestNormalizeMemberTypes and the related cases to verify the returned error with
errs.ProblemOf for category/subtype, and use errors.As into a
*errs.ValidationError to assert ve.Param since ProblemOf does not expose Param.
Keep the existing normalizeMemberTypes coverage, but pin the metadata so
regressions in the error type, subtype, or parameter cannot pass.

In `@shortcuts/im/im_chat_members_list.go`:
- Around line 32-33: The shortcut’s generic format support in
im_chat_members_list is allowing non-pretty outputs that can omit bots and break
the “users and bots in one command” contract. Update the shortcut definition and
its format handling to either make csv/table/ndjson bucket-aware in the relevant
command path, or explicitly reject those formats with a typed validation error
and a hint to use json/pretty instead, using the existing shortcut and
validation flow in im_chat_members_list and related format checks.
- Around line 49-53: The member-list pagination flow currently allows
`--page-all` and `--page-token` together, which causes the code path in the
member listing command to skip `fetchAllMemberPages` and return only a single
page without warning. Update the handler that builds the request and chooses
between `fetchAllMemberPages` and the single `CallAPITyped` path to either
reject the invalid flag combination with a validation error or explicitly honor
`--page-token` by disabling `--page-all`; make the decision in the same command
logic that checks `runtime.Bool("page-all")` and `runtime.Int("page-limit")` so
the behavior is consistent and discoverable.

In `@skills/lark-im/references/lark-im-chat-members-list.md`:
- Around line 131-132: The wording in the Lark IM chat members documentation
overstates the bot bucket guarantee by saying it is “always complete”; update
the sentence in the affected markdown section to use softer language like
“typically” or “expected” so it aligns with the existing truncation warning
behavior by member type and does not claim impossibility.
🪄 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: 6400ae13-2f65-48e4-819a-713347834fe7

📥 Commits

Reviewing files that changed from the base of the PR and between 39d60cb and 98bda4a.

📒 Files selected for processing (7)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_chat_list_test.go
  • shortcuts/im/im_chat_members_list.go
  • shortcuts/im/im_chat_members_list_test.go
  • shortcuts/im/shortcuts.go
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-chat-members-list.md

Comment thread shortcuts/im/im_chat_members_list_test.go
Comment thread shortcuts/im/im_chat_members_list.go
Comment thread shortcuts/im/im_chat_members_list.go
Comment thread skills/lark-im/references/lark-im-chat-members-list.md Outdated
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add jinzemo/cli#feat/im-chat-members-list -y -g

@jinzemo
jinzemo force-pushed the feat/im-chat-members-list branch from 14242d7 to 9af312b Compare June 26, 2026 09:16
@jinzemo jinzemo closed this Jun 26, 2026
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 size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants