Repository navigation
Conversation
`+messages-search --page-all` stops after 40 pages. The warning about that was printed only by the pretty-format renderer, so the default JSON output gave no sign that the result was incomplete apart from `has_more: true`. Print the warning from the pagination loop to stderr, in the same `[pagination] reached page limit` form that `+flag-list` and `+chat-members-list` use. The stdout schema does not change. The old stdout warning is removed; it also suggested `--page-all`, which cannot continue a search that already used the maximum. Fixes larksuite#2929 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟡 Changes recommended
A test in shortcuts/im/im_messages_search_execute_test.go uses an overly broad stdout substring assertion ("page limit") that risks false positives, so the assertion should be tightened to the specific pagination marker before approval.
1 open issue
What changed in this PR
Make im +messages-search emit a pagination truncation warning to stderr across all output formats so JSON/machine-readable stdout remains unchanged but users are informed when auto-pagination stops at the hard page cap.
Changes:
- Print
[pagination] reached page limit ... result is incompleteto stderr when auto-pagination stops whilehas_more=true. - Remove the pretty-only stdout warning and simplify
searchMessagesreturn values accordingly. - Update unit tests and the skill reference documentation to reflect the new stderr warning behavior.
| File | Description |
|---|---|
| skills/lark-im/references/lark-im-messages-search.md | Updates the command reference to document that hitting the page cap produces a stderr pagination warning while keeping stdout schema unchanged. |
| shortcuts/im/im_messages_search.go | Moves the page-limit truncation warning into the search/pagination loop and emits it on stderr for all formats while removing the previous pretty-only warning plumbing. |
| shortcuts/im/im_messages_search_execute_test.go | Adjusts the execution test to assert the truncation warning appears on stderr and does not contaminate stdout output. |
Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
| if strings.Contains(output, "page limit") { | ||
| t.Fatalf("stdout = %q, must not carry the page limit warning", output) | ||
| } |

Summary
im +messages-search --page-allstops after 40 pages, and in JSON output (the default) nothing says so: the warning lived only in the pretty-format renderer. This PR prints the warning on stderr in every--format, in the same form that+flag-listand+chat-members-listalready use.Changes
searchMessageswrites[pagination] reached page limit (N) while has_more=true; result is incomplete. …to stderr at the point where the page limit stops the loop.use --page-limit, --page-all …) was wrong when--page-allhad already used the maximum of 40 pages.searchMessagesno longer returnstruncatedByLimitandpageLimit; nothing reads them now.messages,total,has_more,page_token).skills/lark-im/references/lark-im-messages-search.md: say that the page cap produces a stderr warning.Test Plan
Unit tests pass:
go test -count=1 ./shortcuts/im/.TestImMessagesSearchExecuteAutoPaginationBatchesnow asserts the stderr warning and that stdout does not carry it. The test failed before the fix.Manual local verification confirms the
lark-cli im +messages-searchflow works as expected:A search that ends naturally (
has_more: false) prints nothing on stderr.go build ./...,go vet ./shortcuts/im/,gofmt -l,golangci-lint v2.1.6 run --new-from-rev=c5fbf1a5 ./shortcuts/im/...(0 issues),go run -C lint . --changed-from c5fbf1a5 ..,node scripts/skill-format-check/index.js.Related Issues
+flag-listfix for im +flag-list: 默认分页截断导致有效标记数量误报为 0,无法快速读取实时 Flagged 数量 #1859.Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com
🤖 Generated with Claude Code
Summary by CodeRabbit