fix(im): warn when flag pagination is truncated#1906
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesFlag-list pagination
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant CLI as executeListAllPages
participant API as IM flags API
participant Stdout as stdout
participant Stderr as stderr
CLI->>API: Request page with page_token
API-->>CLI: Return flag_items, has_more, page_token
CLI->>Stderr: Warn when page limit is reached with has_more=true
CLI->>Stdout: Return pagination metadata and continuation token
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@ff5b7b2e0da259cad89f98abe8b24e2570a6af72🧩 Skill updatenpx skills add zhumiaoxin/cli#fix/im-flag-list-pagination-warning -y -g |
bfd65a6 to
982bb71
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/flag_workflow_test.go`:
- Around line 243-245: Update the pagination assertion in the relevant CLI
workflow test to first require that data.has_more exists, then branch on its
value: require the page-limit warning when true and assert stderr does not
contain that warning when false. Cover both pagination-warning outcomes instead
of allowing a missing or false field to pass silently.
🪄 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: bd0059c6-940f-4455-a4d7-1475ed522332
📒 Files selected for processing (5)
shortcuts/im/im_flag_list.goshortcuts/im/im_flag_test.goskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-flag-list.mdtests/cli_e2e/im/flag_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- skills/lark-im/SKILL.md
- shortcuts/im/im_flag_list.go
- shortcuts/im/im_flag_test.go
d627de4 to
f0a791f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/references/lark-im-flag-list.md`:
- Around line 9-11: Update the pagination guidance in the Lark IM flag list
documentation to distinguish the last fetched page from the API’s final page:
treat the last item as authoritative only when pagination ends with
has_more=false. When the page limit is reached while has_more=true, describe
that item only as the newest observed item and require continuing pagination or
resuming with page_token for authoritative results.
🪄 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: fb48a5a9-6c7a-46e9-81f2-c530d4d9187e
📒 Files selected for processing (4)
shortcuts/im/im_flag_list.goshortcuts/im/im_flag_test.goskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-flag-list.md
🚧 Files skipped from review as they are similar to previous changes (3)
- skills/lark-im/SKILL.md
- shortcuts/im/im_flag_list.go
- shortcuts/im/im_flag_test.go
f0a791f to
d367b7d
Compare
d367b7d to
ff5b7b2
Compare
PR Quality SummaryCI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun. Failed checksdeterministic-gate
|
Summary
Fixes the silent partial-result behavior in
im +flag-list --page-allwhen the configured page limit is reached withhas_more=true. The default remains 20 pages, the hard maximum remains 1000, and the JSON schema and exit code stay unchanged.Changes
--page-limit; direct callers to the continuation token in stdout without copying the opaque token into logs.lark-imskill that 20 is the default cap, 1000 is the hard maximum, andhas_more=truemeans the result is incomplete.Test Plan
make unit-testgo vet ./...gofmt -l .(no output)go mod tidy(nogo.mod/go.sumdiff)go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=origin/main(0 issues)Related Issues