fix/task search pagination#2041
Conversation
📝 WalkthroughWalkthroughTask and tasklist search pagination now sends ChangesSearch pagination
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant SearchShortcut
participant TaskAPI
CLI->>SearchShortcut: Execute search with initial page_token
SearchShortcut->>TaskAPI: POST search with query and page_token parameter
TaskAPI-->>SearchShortcut: Return results and next page_token
SearchShortcut->>TaskAPI: POST next page with returned page_token
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
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/task/task_search_test.go`:
- Line 120: Replace the substring-based pagination assertions in
shortcuts/task/task_search_test.go at lines 120-120 and
shortcuts/task/task_tasklist_search_test.go at lines 93-93 by decoding the
dry-run envelope, then assert that api.0.params.page_token is present with the
expected value and api.0.body.page_token is absent in both task and tasklist
search tests.
In `@tests/cli_e2e/task/task_search_pagination_dryrun_test.go`:
- Around line 15-63: The existing TestTask_SearchPaginationDryRun only validates
request construction; add a separate live bot-credential E2E test that creates
matching task resources, performs the search, follows the returned page token to
page two, and deletes all created resources with cleanup. Skip the live flow
when running in fork PRs, while preserving the current dry-run test and using
the existing task client/helpers and cleanup conventions.
🪄 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: 4921b98a-1db3-4551-92b0-107138c3948b
📒 Files selected for processing (8)
shortcuts/task/task_query_helpers.goshortcuts/task/task_query_helpers_test.goshortcuts/task/task_search.goshortcuts/task/task_search_pagination_test.goshortcuts/task/task_search_test.goshortcuts/task/task_tasklist_search.goshortcuts/task/task_tasklist_search_test.gotests/cli_e2e/task/task_search_pagination_dryrun_test.go
There was a problem hiding this comment.
🧹 Nitpick comments (1)
shortcuts/task/task_search_pagination_test.go (1)
76-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse typed fields for the dry-run JSON assertion.
This test decodes
paramsandbodyintomap[string]interface{}despite the repository requirement to parse JSON boundaries into typed structs. Use typedPageTokenfields so contract changes fail clearly and cannot be silently accepted.Proposed fix
var envelope struct { API []struct { - Params map[string]interface{} `json:"params"` - Body map[string]interface{} `json:"body"` + Params struct { + PageToken string `json:"page_token"` + } `json:"params"` + Body struct { + PageToken json.RawMessage `json:"page_token"` + } `json:"body"` } `json:"api"` } ... - if got, _ := call.Params["page_token"].(string); got != want { + if call.Params.PageToken != want { ... - if _, present := call.Body["page_token"]; present { + if len(call.Body.PageToken) != 0 {Also applies to: 88-93
🤖 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/task/task_search_pagination_test.go` around lines 76 - 80, Update the dry-run JSON envelope assertion in the pagination test to decode API params and body into typed structs containing PageToken fields instead of map[string]interface{}. Apply the same typed representation to both affected API entries, preserving the existing assertions while making PageToken contract changes fail explicitly.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@shortcuts/task/task_search_pagination_test.go`:
- Around line 76-80: Update the dry-run JSON envelope assertion in the
pagination test to decode API params and body into typed structs containing
PageToken fields instead of map[string]interface{}. Apply the same typed
representation to both affected API entries, preserving the existing assertions
while making PageToken contract changes fail explicitly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 806cda98-7f6c-452d-aa88-5cd57884f981
📒 Files selected for processing (3)
shortcuts/task/task_search_pagination_test.goshortcuts/task/task_search_test.goshortcuts/task/task_tasklist_search_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- shortcuts/task/task_search_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@51e148ad4a81b689be5480f106da659f771ad2b3🧩 Skill updatenpx skills add ILUO/cli#fix/task-search-pagination -y -g |
* fix: send task search page token in query * test: assert task search dry-run pagination contract
Summary
Fix pagination for
task +searchandtask +tasklist-searchby sendingpage_tokenas a URL query parameter instead of including it in the POST body.Changes
Test Plan
lark-cli task +searchandlark-cli task +tasklist-searchflows work as expected — not run locally per request.git diff --cached --checkcompleted without errors.Related Issues
Summary by CodeRabbit
Bug Fixes
Tests
page_token.