Skip to content

feat(im): add --page-all, align page-size limits, accept common flag aliases - #2138

Open
sang-neo03 wants to merge 6 commits into
mainfrom
feat/agent-affordance-fixes
Open

feat(im): add --page-all, align page-size limits, accept common flag aliases#2138
sang-neo03 wants to merge 6 commits into
mainfrom
feat/agent-affordance-fixes

Conversation

@sang-neo03

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

Copy link
Copy Markdown
Collaborator

Summary

Four of the most-used im list commands lacked --page-all while sibling commands in the same domain had it, so callers that learned the flag on +messages-search kept passing it to +threads-messages-list and friends and got unknown flag. Separately, +threads-messages-list declared a page-size ceiling of 500 while the server accepts 50, so oversized values were forwarded and came back as an opaque field validation failed that does not say which field was wrong.

Changes

  • Add --page-all and --page-limit to im +threads-messages-list, +chat-messages-list, +chat-list and +chat-search, following the existing +flag-list implementation. --page-limit defaults to 10 and accepts 1-1000; an explicitly supplied --page-token takes precedence and fetches only that page.

  • Merged results keep the single-page shape: items from every page in original order, has_more and page_token taken from the last fetched page so callers can resume.

  • Reaching the page cap with has_more=true reports an incomplete result on stderr, and a non-advancing page_token stops the loop. Progress and warnings go to stderr; stdout carries data only.

  • Raw items are merged before enrichment, so message conversion, sender-name resolution, thread expansion, reaction enrichment and resource download each run once over the merged set instead of once per page.

  • Page-size ceilings for the nine paginated im commands now come from a single table (shortcuts/im/im_page_size_limits.go) with a table-driven test. +threads-messages-list goes from 500 to 50; out-of-range values are rejected locally with a structured validation error naming the limit, and no HTTP request is issued when validation fails.

  • +chat-members-list moves off its hand-written bounds check onto the shared ValidatePageSizeTyped.

  • Update the four command references and skills/lark-im/SKILL.md, including how to resume from page_token when the result is incomplete.

  • Register eight hidden flag aliases in the im domain for names callers routinely type: --start-time/--end-time (71 occurrences), --thread-id (15), --message-id (7), --keyword (5), --sort-order (4) and --limit (4). The canonical flag wins when both are given, --help and schema still list only the canonical name, and a note naming the canonical flag goes to stderr. Out-of-range values report the flag the caller typed, so --limit 500 is rejected as --limit.

  • --thread and --message-ids drop their Required declaration and validate in Validate instead; cobra would otherwise reject the call before an alias could be resolved.

  • ParseTime gains "2006-01-02 15:04:05 Z07:00". A space-separated timestamp with an offset is the most common value written after --start-time, and without it the alias would only turn an unknown-flag error into a parse error. The format is additive — inputs that parsed before are unaffected.

  • Accept a hidden, value-aware --types compatibility input on im +chat-search. --types group maps through the canonical --chat-modes group path and emits a note on stderr; an explicit --chat-modes wins when both are supplied. --types p2p returns a validation error directing callers to im +chat-list --types p2p, while other values list the valid --chat-modes and --search-types domains. The group-only behavior is confirmed against the live service: filter.chat_modes=["p2p"] returns code 99992402 (field validation failed). The hidden flag remains absent from --help and schema output.

  • Clarify two IM reference constraints: +feed-shortcut-list has no caller-controlled --page-size, and +messages-resources-download has no --overwrite flag because saving to an existing path replaces the file atomically.

  • Accept value-compatible --member-types spellings on im +chat-members-list: case-insensitive all means no filter, plural users and bots normalize to user and bot, and all takes precedence in mixed lists. Compatibility notes go to stderr while stdout and request parameters retain the canonical shape.

  • Move --file-key and --type required checks for im +messages-resources-download into shortcut validation so missing values return a structured hint. The hint shows how to retrieve resource keys with im +messages-mget or batch-download attachments with im +chat-messages-list --download-resources; help still marks both flags as required. Update both command references with the accepted values and resource-download guidance.

Two notes for reviewers:

  • +feed-group-list-item has no public specification for its endpoint, so its ceiling of 50 was established by probing: page_size 51 and above returns code 230001 param is invalid, 50 succeeds. The probe is recorded in the table comment.

  • The four commands each carry their own pagination loop, mirroring the other --page-all implementations already in the repo. Collapsing all of them onto one shared loop requires the generic merge in internal/client/pagination.go to stop dropping page_token; that is deliberately left to a follow-up.

  • The four aliases that already existed in this package (--sort, --sort-type, --sort-by) now emit the same stderr note. That is a behaviour change, and intentional: silently accepting an alias means callers never learn the canonical name.

  • ParseTime lives in shortcuts/common and is shared by every domain. The change only widens what parses; no existing input changes meaning.

Test Plan

  • Unit tests pass — go test ./shortcuts/im/... -count=1, plus make vet fmt-check, make unit-test, make quality-gate
  • New coverage: multi-page merge, has_more/page_token from the last page, stop on repeated token, incomplete-result warning on stderr with clean stdout, explicit --page-token disabling --page-all, --page-limit bounds, enrichment/filtering running exactly once on merged results, and a dry-run e2e test
  • +chat-search --types coverage: group request parity with --chat-modes group, p2p and mixed-value validation, unknown-value guidance, canonical-flag precedence, stderr/stdout separation, and hidden help surface
  • Manual local verification: --help shows page size (1-50) for +threads-messages-list; --page-size 51 returns invalid --page-size 51: must be between 1 and 50; --page-limit 0 is rejected; --page-all --dry-run reports auto-pagination

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added automatic multi-page retrieval for chat lists, message lists, chat search, and thread messages using --page-all and configurable limits.
    • Added progress reporting, result aggregation, safeguards against repeated pages, and incomplete-result warnings.
    • Added IM flag aliases, chat-member type aliases, and improved compatibility support for chat-search filters.
    • Added support for space-separated date-time values with timezone offsets.
  • Bug Fixes

    • Standardized page-size validation and improved invalid-value error messages.
    • Improved resource-download validation and guidance for required options.
  • Documentation

    • Updated help and reference guides with pagination, limits, aliases, examples, and troubleshooting details.

@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 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

IM list and search shortcuts now support bounded automatic pagination through --page-all and --page-limit. Shared helpers enforce command-specific page-size limits. IM commands add hidden aliases, compatibility mappings, conditional validation, and stderr notices. Common time parsing accepts space-separated timezone offsets.

Changes

IM pagination and validation

Layer / File(s) Summary
Shared page-size validation
shortcuts/im/im_page_size_limits.go, shortcuts/im/*list.go, shortcuts/im/im_messages_search.go
Added command-specific limits, shared descriptions, and detailed validation errors.
List shortcut pagination
shortcuts/im/im_chat_list.go, shortcuts/im/im_chat_messages_list.go, shortcuts/im/im_chat_search.go, shortcuts/im/im_threads_messages_list.go
Added bounded multi-page retrieval, token handling, aggregation, progress output, and incomplete-result warnings.
Pagination and validation tests
shortcuts/im/im_list_page_all_test.go, tests/cli_e2e/im/im_list_page_all_dryrun_test.go, shortcuts/im/*_test.go
Added coverage for pagination, limits, explicit tokens, dry-run output, enrichment, and updated page-size inputs.
IM documentation
skills/lark-im/SKILL.md, skills/lark-im/references/*
Documented automatic pagination, continuation behavior, limits, aliases, member-type compatibility, resource validation, and validation errors.

IM flag aliases and compatibility

Layer / File(s) Summary
Alias resolution and diagnostics
shortcuts/im/sort_flags.go, shortcuts/im/im_messages_mget.go, shortcuts/im/im_messages_search.go
Added typed hidden aliases, canonical precedence, and one-time stderr notices for legacy flags.
Compatibility and conditional validation
shortcuts/im/im_chat_search.go, shortcuts/im/im_chat_members_list.go, shortcuts/im/im_messages_resources_download.go
Added --types mapping, member-type aliases, and manual validation for resource-download inputs.
Alias and compatibility tests
shortcuts/im/im_flag_aliases_test.go, shortcuts/im/sort_flags_test.go, tests/cli_e2e/im/*
Added unit and end-to-end coverage for alias equivalence, precedence, validation, help output, notices, member types, and resource-download inputs.

Common time parsing

Layer / File(s) Summary
Timezone-aware parsing
shortcuts/common/common.go, shortcuts/common/common_test.go
ParseTime accepts space-separated timestamps with timezone offsets and has direct test coverage.

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

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant IMShortcut
  participant LarkIMAPI
  participant Enrichment
  CLI->>IMShortcut: run with --page-all and --page-limit
  IMShortcut->>LarkIMAPI: request page
  LarkIMAPI-->>IMShortcut: return items and continuation token
  IMShortcut->>LarkIMAPI: request subsequent pages
  IMShortcut->>Enrichment: process merged items
  IMShortcut-->>CLI: return aggregated results and pagination status
Loading

Possibly related PRs

  • larksuite/cli#820: The pagination implementation extends the earlier +chat-list pagination code and related tests.

Suggested labels: feature

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.32% 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
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.
Title check ✅ Passed The title clearly summarizes the main changes: automatic pagination, centralized page-size limits, and common flag aliases.
Description check ✅ Passed The description includes all required sections and gives clear scope, implementation details, test coverage, and related-issue status.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/agent-affordance-fixes

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 commented Jul 31, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/agent-affordance-fixes -y -g

@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: 1

🧹 Nitpick comments (2)
shortcuts/im/im_feed_group_list.go (1)

36-36: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the repeated 50 default-page-size literal into a named constant.

Three shortcuts duplicate the literal 50 in two places each: the page-size flag's Default string and the defaultValue argument passed to validateIMPageSize. +chat-members-list already avoids this by using a named constant (chatMembersListDefaultPageSize). Apply the same pattern here to remove the duplication and reduce the risk of the literal drifting from imPageSizeLimits if a limit changes later.

  • shortcuts/im/im_feed_group_list.go#L36-L36: replace the literal "50"/50 with a named constant (e.g. feedGroupListDefaultPageSize) shared between the flag Default and the validateIMPageSize(rt, "+feed-group-list", ...) call at line 75.
  • shortcuts/im/im_feed_group_list_item.go#L31-L31: replace the literal "50"/50 with a named constant (e.g. feedGroupListItemDefaultPageSize) shared between the flag Default and the validateIMPageSize(rt, "+feed-group-list-item", ...) call at line 75.
  • shortcuts/im/im_flag_list.go#L28-L28: replace the literal "50"/50 with a named constant (e.g. flagListDefaultPageSize) shared between the flag Default and the validateIMPageSize(rt, "+flag-list", ...) call at line 74.
🤖 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_feed_group_list.go` at line 36, Extract the repeated default
page-size literals into named constants and reuse each constant for both the
flag Default and its corresponding validateIMPageSize call. Apply this in
shortcuts/im/im_feed_group_list.go (36-36, with the call at 75),
shortcuts/im/im_feed_group_list_item.go (31-31, with the call at 75), and
shortcuts/im/im_flag_list.go (28-28, with the call at 74), using distinct
constants for each shortcut such as feedGroupListDefaultPageSize,
feedGroupListItemDefaultPageSize, and flagListDefaultPageSize.
shortcuts/im/im_chat_list.go (1)

223-275: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Four copies of one page-all loop. All four fetchers repeat the same algorithm: clamp --page-limit, drop page_token, accumulate items, print progress, break on exhaustion, break on a repeated token, emit the cap notice, then rewrite items, has_more, and page_token on the last response. Each copy also prints the cumulative item count under a per-page label and hardcodes 1000 and 1-1000 in user-facing text instead of using the local maximum constant. Extract one helper in the im package that takes a page-fetch closure, a page cap, and an item noun, then call it from all four sites.

Sketch:

type imPageFetch func(pageToken string) (map[string]interface{}, error)

func imFetchAllPages(runtime *common.RuntimeContext, noun string, defaultLimit, maxLimit int, fetch imPageFetch) (map[string]interface{}, error)

Each caller then supplies only the closure that issues its own request shape.

  • shortcuts/im/im_chat_list.go#L223-L275: replace the body with a call to the shared helper, passing a closure that calls runtime.CallAPITyped("GET", imChatListPath, params, nil) and the noun chats.
  • shortcuts/im/im_chat_messages_list.go#L217-L269: replace the body with a call to the shared helper, passing a closure that sets params["page_token"] = []string{token} and calls runtime.DoAPIJSONTyped with the noun messages.
  • shortcuts/im/im_threads_messages_list.go#L193-L245: replace the body with a call to the shared helper, passing the map[string][]string closure and the noun thread messages.
  • shortcuts/im/im_chat_search.go#L234-L286: replace the body with a call to the shared helper, passing a closure that calls runtime.CallAPITyped("POST", "/open-apis/im/v2/chats/search", params, body) and the noun chats.

Build the cap notice inside the helper from maxLimit so the text cannot drift from the constants.

🤖 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_list.go` around lines 223 - 275, Replace the duplicated
pagination loops with a shared imFetchAllPages helper using imPageFetch,
centralizing limit clamping, token handling, accumulation, progress output,
termination checks, response rewriting, and max-limit messaging. In
shortcuts/im/im_chat_list.go:223-275, call it with a closure invoking
runtime.CallAPITyped for imChatListPath and noun “chats”; in
shortcuts/im/im_chat_messages_list.go:217-269, pass the []string token closure
and noun “messages”; in shortcuts/im/im_threads_messages_list.go:193-245, pass
the map[string][]string closure and noun “thread messages”; and in
shortcuts/im/im_chat_search.go:234-286, pass the POST search closure and noun
“chats”. Build the cap notice from each caller’s maxLimit rather than hardcoding
1000 or 1-1000.
🤖 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 `@skills/lark-im/SKILL.md`:
- Line 109: Update the shortcut index entries for +chat-messages-list and
+threads-messages-list in SKILL.md to name the supported --order option instead
of --sort, matching the option documented in their respective reference files.

---

Nitpick comments:
In `@shortcuts/im/im_chat_list.go`:
- Around line 223-275: Replace the duplicated pagination loops with a shared
imFetchAllPages helper using imPageFetch, centralizing limit clamping, token
handling, accumulation, progress output, termination checks, response rewriting,
and max-limit messaging. In shortcuts/im/im_chat_list.go:223-275, call it with a
closure invoking runtime.CallAPITyped for imChatListPath and noun “chats”; in
shortcuts/im/im_chat_messages_list.go:217-269, pass the []string token closure
and noun “messages”; in shortcuts/im/im_threads_messages_list.go:193-245, pass
the map[string][]string closure and noun “thread messages”; and in
shortcuts/im/im_chat_search.go:234-286, pass the POST search closure and noun
“chats”. Build the cap notice from each caller’s maxLimit rather than hardcoding
1000 or 1-1000.

In `@shortcuts/im/im_feed_group_list.go`:
- Line 36: Extract the repeated default page-size literals into named constants
and reuse each constant for both the flag Default and its corresponding
validateIMPageSize call. Apply this in shortcuts/im/im_feed_group_list.go
(36-36, with the call at 75), shortcuts/im/im_feed_group_list_item.go (31-31,
with the call at 75), and shortcuts/im/im_flag_list.go (28-28, with the call at
74), using distinct constants for each shortcut such as
feedGroupListDefaultPageSize, feedGroupListItemDefaultPageSize, and
flagListDefaultPageSize.
🪄 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 Plus

Run ID: f5aacaf0-380b-45cc-a85d-17fc8eccca54

📥 Commits

Reviewing files that changed from the base of the PR and between 003d0f4 and 1ecc327.

📒 Files selected for processing (24)
  • shortcuts/im/builders_test.go
  • shortcuts/im/coverage_additional_test.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_chat_list_test.go
  • shortcuts/im/im_chat_members_list.go
  • shortcuts/im/im_chat_messages_list.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_feed_group_item_test.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_flag_list.go
  • shortcuts/im/im_list_page_all_test.go
  • shortcuts/im/im_messages_search.go
  • shortcuts/im/im_page_size_limits.go
  • shortcuts/im/im_page_size_limits_test.go
  • shortcuts/im/im_threads_messages_list.go
  • shortcuts/im/with_sender_name_test.go
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-chat-list.md
  • skills/lark-im/references/lark-im-chat-members-list.md
  • skills/lark-im/references/lark-im-chat-messages-list.md
  • skills/lark-im/references/lark-im-chat-search.md
  • skills/lark-im/references/lark-im-threads-messages-list.md
  • tests/cli_e2e/im/im_list_page_all_dryrun_test.go

Comment thread skills/lark-im/SKILL.md Outdated
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.34021% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.58%. Comparing base (003d0f4) to head (7a2f644).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/im/im_threads_messages_list.go 81.81% 6 Missing and 6 partials ⚠️
shortcuts/im/im_chat_messages_list.go 85.50% 5 Missing and 5 partials ⚠️
shortcuts/im/im_chat_search.go 88.09% 5 Missing and 5 partials ⚠️
shortcuts/im/im_chat_list.go 85.18% 4 Missing and 4 partials ⚠️
shortcuts/im/im_chat_members_list.go 83.33% 3 Missing and 3 partials ⚠️
shortcuts/im/im_messages_resources_download.go 90.47% 2 Missing ⚠️
shortcuts/im/im_page_size_limits.go 88.23% 1 Missing and 1 partial ⚠️
shortcuts/im/sort_flags.go 88.88% 1 Missing and 1 partial ⚠️
shortcuts/im/im_messages_mget.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2138      +/-   ##
==========================================
+ Coverage   75.48%   75.58%   +0.10%     
==========================================
  Files         928      929       +1     
  Lines       98600    98945     +345     
==========================================
+ Hits        74427    74791     +364     
+ Misses      18519    18472      -47     
- Partials     5654     5682      +28     

☔ 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.

Four of the most-used im list commands lacked --page-all while sibling
commands in the same domain had it, so callers that learned the flag on
+messages-search kept passing it to +threads-messages-list and friends
and got "unknown flag". Separately, +threads-messages-list declared a
page-size ceiling of 500 while the server accepts 50, so oversized
values were forwarded and came back as an opaque "field validation
failed" with no indication of which field was wrong.

Add --page-all/--page-limit to +threads-messages-list,
+chat-messages-list, +chat-list and +chat-search, following the existing
+flag-list implementation: pages are capped, has_more and page_token
come from the last fetched page so callers can resume, reaching the cap
with has_more=true reports an incomplete result on stderr, and a
non-advancing page_token stops the loop. Progress goes to stderr; stdout
carries data only. Raw items from every page are merged first, then
message conversion, sender-name resolution, thread expansion, reaction
enrichment and resource download run once over the merged set.

Page-size ceilings for the nine paginated im commands now come from a
single table with a table-driven test, out-of-range values are rejected
locally with a structured validation error that names the limit, and no
HTTP request is issued when validation fails. +chat-members-list moves
off its hand-written bounds check onto the shared validator.

+feed-group-list-item keeps its current ceiling of 50: the public
specification for its endpoint is unavailable, so the value is left
pending confirmation rather than guessed.
@sang-neo03
sang-neo03 force-pushed the feat/agent-affordance-fixes branch from 1ecc327 to eb0bd8a Compare July 31, 2026 11:12
Six flags in the im domain are routinely typed under a different name —
--start-time for --start, --thread-id for --thread, --message-id for
--message-ids, --keyword for --query, --sort-order for --order and
--limit for --page-size. The value written alongside them is already
valid in every case; only the name is wrong, so the call fails once and
has to be retried under the canonical name.

Register the eight names as hidden aliases, following the existing
pattern in this package: the canonical flag wins when both are given,
--help and schema keep listing only the canonical name, and a note
naming the canonical flag is written to stderr so callers learn it
instead of settling on the alias. The four aliases that already existed
now emit that note too. Out-of-range values report the flag the caller
actually typed, so --limit 500 is rejected as --limit rather than as
--page-size.

--thread and --message-ids drop their Required declaration and validate
in Validate instead, otherwise cobra rejects the call before an alias
can be resolved.

ParseTime gains "2006-01-02 15:04:05 Z07:00". A space-separated
timestamp with an offset is the most common thing written after
--start-time, and without this format the alias would only turn an
unknown-flag error into a parse error. The format is additive: inputs
that parsed before are unaffected.
@sang-neo03
sang-neo03 requested a review from liangshuo-1 as a code owner August 1, 2026 04:24
@sang-neo03 sang-neo03 changed the title feat(im): add --page-all to list commands and align page-size limits feat(im): add --page-all, align page-size limits, accept common flag aliases Aug 1, 2026

@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: 2

🤖 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 `@tests/cli_e2e/im/im_chat_search_types_dryrun_test.go`:
- Around line 70-87: Extend the validation assertions in the dry-run cases
around the chat-list and chat-search command results to inspect typed metadata
in result.Stderr, not only error.message. Assert the expected validation
category, subtype, and parameter for the --types failures, using the structured
error fields returned by the validation path while preserving the existing
message and exit-code checks.
- Around line 49-55: Update the test arguments in the +chat-search dry-run case
to use the invalid alias value “p2p” for --types while retaining --chat-modes
topic, so it verifies canonical precedence bypasses alias validation. Keep the
existing exit-code, resolved filter, and stderr assertions unchanged.
🪄 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 Plus

Run ID: 260e349f-10a0-406e-94ed-165969ffd10f

📥 Commits

Reviewing files that changed from the base of the PR and between 09b38a7 and 3561753.

📒 Files selected for processing (8)
  • shortcuts/im/builders_test.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_search_test.go
  • shortcuts/im/im_messages_search.go
  • shortcuts/im/sort_flags.go
  • skills/lark-im/references/lark-im-feed-shortcut-list.md
  • skills/lark-im/references/lark-im-messages-resources-download.md
  • tests/cli_e2e/im/im_chat_search_types_dryrun_test.go
💤 Files with no reviewable changes (1)
  • shortcuts/im/im_messages_search.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • shortcuts/im/builders_test.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/sort_flags.go

Comment thread tests/cli_e2e/im/im_chat_search_types_dryrun_test.go Outdated
Comment thread tests/cli_e2e/im/im_chat_search_types_dryrun_test.go
@github-actions

github-actions Bot commented Aug 1, 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

@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: 2

🤖 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.go`:
- Around line 310-331: Update normalizeMemberTypes in
shortcuts/im/im_chat_members_list.go:310-331 to validate every trimmed
member-type token before applying the all no-filter rule, preserving input
values faithfully and returning the existing typed validation error for invalid
values such as admin. Update the admin,ALL case in
shortcuts/im/im_chat_members_list_test.go:171-172 to expect that validation
error instead of accepting the input; no other test-site changes are required.

In `@tests/cli_e2e/im/im_member_types_resource_download_dryrun_test.go`:
- Around line 64-72: Extend both rejection assertions in
tests/cli_e2e/im/im_member_types_resource_download_dryrun_test.go at lines 64-72
and 79-90 to verify the validation envelope’s error.type, error.subtype, and
parameter metadata. For lines 64-72, assert the --member-types parameter; for
lines 79-90, assert both expected parameter names in error.params, while
preserving the existing exit-code, stdout, and message checks.
🪄 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 Plus

Run ID: 6d40e28c-774a-4565-aa35-6ab8980331d4

📥 Commits

Reviewing files that changed from the base of the PR and between 3561753 and 7a2f644.

📒 Files selected for processing (7)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_chat_members_list.go
  • shortcuts/im/im_chat_members_list_test.go
  • shortcuts/im/im_messages_resources_download.go
  • skills/lark-im/references/lark-im-chat-members-list.md
  • skills/lark-im/references/lark-im-messages-resources-download.md
  • tests/cli_e2e/im/im_member_types_resource_download_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • skills/lark-im/references/lark-im-chat-members-list.md

Comment thread shortcuts/im/im_chat_members_list.go Outdated
Comment thread tests/cli_e2e/im/im_member_types_resource_download_dryrun_test.go
…n docs

Review follow-ups on the member-types and chat-search changes.

normalizeMemberTypes accepted any occurrence of "all" before validating
the remaining values, so an invalid value alongside it (--member-types
admin,all) was silently swallowed into "no filter". Validate every value
first; "all" only widens the filter after the whole list is known to be
well-formed, and the rejection message now names all three accepted
spellings.

The skill index and command descriptions for +chat-messages-list and
+threads-messages-list advertised "sort" while the actual flag is
--order; name the flag exactly so callers do not learn a spelling the
command rejects.

Test tightening from the same review: the canonical-precedence e2e now
passes an alias value that would fail validation (--types p2p) alongside
--chat-modes, proving an explicit canonical flag bypasses alias
validation entirely; rejection-path e2e tests assert the structured
validation metadata (error.type, error.subtype, param names) instead of
message text alone.
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.

1 participant