fix(im): +flag-list --page-all no longer silently truncates at default page-limit#1875
Open
jacob-qu wants to merge 1 commit into
Open
fix(im): +flag-list --page-all no longer silently truncates at default page-limit#1875jacob-qu wants to merge 1 commit into
jacob-qu wants to merge 1 commit into
Conversation
…t page-limit `im +flag-list --page-all` was still capped by the default `--page-limit` of 20 and stopped there without any signal, even when `has_more` was true. Because the server returns canceled flags before active ones, active flags often live past page 20, so callers saw `flag_items: []` and read it as "no flags" — misleading for humans and AI agents alike. Align flag-list with the existing pagination contract used by `im +chat-members-list` and `im +messages-search`: - Allow `--page-limit 0` to mean unlimited (validation now accepts 0-1000). - When the page limit is reached while more pages remain, emit a stderr warning pointing to `--page-all --page-limit 0`, instead of stopping silently. - Update the flag description to document `0 = unlimited`. Tests pin the reversed validation contract (0 accepted, -1/1001 rejected), assert the truncation warning is emitted, and verify an unlimited scan reaches every page without falsely warning. Closes larksuite#1859
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe ChangesFlag pagination
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant executeListAllPages
participant FlagsAPI
CLI->>executeListAllPages: pass page-limit
executeListAllPages->>FlagsAPI: request next flags page
FlagsAPI-->>executeListAllPages: flags page and has_more
executeListAllPages-->>CLI: results or page-limit warning
🚥 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@1c8defcb1c1f3d0ade486aed138ef3a2080e8b7f🧩 Skill updatenpx skills add jacob-qu/cli#fix/flag-list-page-all-truncation -y -g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
im +flag-list --page-allwas still capped by the default--page-limitof 20 and stopped there without any signal, even whenhas_morewas true. Because the server returns canceled flags before active ones, active flags often live past page 20, so callers sawflag_items: []and read it as "no flags" — misleading for both humans and AI agents. This aligns+flag-listwith the pagination contract already used byim +chat-members-listandim +messages-search.Changes
--page-limit 0to mean unlimited (validation now accepts0–1000;0was previously rejected).--page-all --page-limit 0, instead of stopping silently.0 = unlimited.Test Plan
go test -race ./shortcuts/im/...)lark-cli im +flag-listflow works as expected--page-limit -1/1001→ typed validation error--page-limit 0→ passes validation, dry-run shows the requestgo vet,gofmt -l, andgolangci-lint run --new-from-rev=origin/main(0 issues) all passNew/updated tests pin the reversed validation contract (
0accepted,-1/1001rejected), assert the truncation warning is emitted, and verify an unlimited scan reaches every page without falsely warning.Related Issues
Summary by CodeRabbit
New Features
+flag-listshortcut by setting--page-limit=0.Bug Fixes