feat(task): support starting pagination from page token#332
feat(task): support starting pagination from page token#332zero-my merged 1 commit intolarksuite:mainfrom
Conversation
📝 WalkthroughWalkthroughAdded a new CLI flag Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds a Confidence Score: 5/5This PR is safe to merge — the change is minimal, consistent with existing patterns, and covered by an updated test. All three files have clean, focused changes with no logic errors. The Execute path correctly sets the initial page_token before the pagination loop, and subsequent pages overwrite it with the response token as expected. The test indirectly but effectively asserts the query parameter is forwarded (any missing parameter would cause the stub not to match and the API call to return an error). No P0/P1 issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| shortcuts/task/task_get_my_tasks.go | Adds page-token flag and correctly plumbs it into both the DryRun params map and the Execute queryParams before the pagination loop. |
| shortcuts/task/task_get_my_tasks_test.go | Adds a third table-driven sub-case that verifies page_token is forwarded as a query parameter; uses the existing httpmock substring-URL mechanism correctly. |
| skills/lark-task/references/lark-task-get-my-tasks.md | Documentation updated with a usage example and parameter table entry for --page-token. |
Sequence Diagram
sequenceDiagram
participant User
participant CLI as lark-cli
participant API as Lark Task API
User->>CLI: task +get-my-tasks --page-token cursor
CLI->>API: GET /open-apis/task/v2/tasks with page_token query param
API-->>CLI: items list plus has_more and next cursor
loop Up to page-limit iterations
CLI->>API: GET tasks with next cursor
API-->>CLI: items list, has_more false on last page
end
CLI-->>User: Rendered output (pretty or json)
Reviews (1): Last reviewed commit: "feat(task): support starting pagination ..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
shortcuts/task/task_get_my_tasks_test.go (1)
51-52: Consider making the token test stub URL stricter.Using only
page_token=pt_001is a bit permissive. Prefer a path+query matcher (or explicit query assertions) to avoid accidental false positives.Also applies to: 65-65
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@shortcuts/task/task_get_my_tasks_test.go` around lines 51 - 52, The test's stubURL value is too permissive; update the stubURL assignments (the variable named stubURL used in the task_get_my_tasks tests) to include the full path plus query (e.g., "/v1/tasks?page_token=pt_001") or switch the HTTP test harness to assert the request path and query explicitly (match both path and query params rather than just "page_token=pt_001"); make the same change for the other occurrence where stubURL currently equals "page_token=pt_001" so both tests verify path+query rather than a loose substring.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@shortcuts/task/task_get_my_tasks_test.go`:
- Around line 51-52: The test's stubURL value is too permissive; update the
stubURL assignments (the variable named stubURL used in the task_get_my_tasks
tests) to include the full path plus query (e.g., "/v1/tasks?page_token=pt_001")
or switch the HTTP test harness to assert the request path and query explicitly
(match both path and query params rather than just "page_token=pt_001"); make
the same change for the other occurrence where stubURL currently equals
"page_token=pt_001" so both tests verify path+query rather than a loose
substring.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 08e0fe9f-4769-49b0-a1e4-c1ed9be09737
📒 Files selected for processing (3)
shortcuts/task/task_get_my_tasks.goshortcuts/task/task_get_my_tasks_test.goskills/lark-task/references/lark-task-get-my-tasks.md
Summary
Add a
--page-tokenflag totask +get-my-tasksso users can resume listing tasks from a specific page token returned by the API.Changes
--page-tokenflag toshortcuts/task/task_get_my_tasks.goand pass it through aspage_tokenfor the initial requestskills/lark-task/references/lark-task-get-my-tasks.mdwith--page-tokenparameter and examplepage_tokenwhen providedTest Plan
make unit-testgo test ./shortcuts/task -run TestGetMyTasks_LocalTimeFormatting -vRelated Issues
N/A
Summary by CodeRabbit
New Features
--page-tokenflag to theget-my-taskscommand, enabling users to resume pagination from a previously-obtained page token and continue retrieving subsequent batches of tasks without restarting the complete query.Documentation
--page-tokenparameter, including example commands and descriptions showing how to continue paginated task results.