Skip to content

feat(task): support starting pagination from page token#332

Merged
zero-my merged 1 commit intolarksuite:mainfrom
ILUO:feat/task-get-my-tasks-page-token
Apr 8, 2026
Merged

feat(task): support starting pagination from page token#332
zero-my merged 1 commit intolarksuite:mainfrom
ILUO:feat/task-get-my-tasks-page-token

Conversation

@ILUO
Copy link
Copy Markdown
Contributor

@ILUO ILUO commented Apr 8, 2026

Summary

Add a --page-token flag to task +get-my-tasks so users can resume listing tasks from a specific page token returned by the API.

Changes

  • Add --page-token flag to shortcuts/task/task_get_my_tasks.go and pass it through as page_token for the initial request
  • Update skills/lark-task/references/lark-task-get-my-tasks.md with --page-token parameter and example
  • Extend unit test coverage to validate the request includes page_token when provided

Test Plan

  • Unit tests passed: make unit-test
  • Added/updated tests:
    • go test ./shortcuts/task -run TestGetMyTasks_LocalTimeFormatting -v

Related Issues

N/A

Summary by CodeRabbit

  • New Features

    • Added --page-token flag to the get-my-tasks command, enabling users to resume pagination from a previously-obtained page token and continue retrieving subsequent batches of tasks without restarting the complete query.
  • Documentation

    • Updated command documentation with the new --page-token parameter, including example commands and descriptions showing how to continue paginated task results.

@github-actions github-actions bot added domain/task PR touches the task domain size/M Single-domain feat or fix with limited business impact labels Apr 8, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

Added a new CLI flag --page-token to the +get-my-tasks command, enabling pagination to resume from a specified page token. The flag is passed to the API request as page_token in both dry-run and execute operations, while preserving existing iteration behavior.

Changes

Cohort / File(s) Summary
Task Command Implementation
shortcuts/task/task_get_my_tasks.go
Added --page-token string flag with description "start from the specified page token". Flag value is passed to API request parameters in both dry-run and execute flows.
Task Command Tests
shortcuts/task/task_get_my_tasks_test.go
Extended table-driven tests with per-case pageToken and stubURL fields. Added new test case "start from page token" with --page-token pt_001 argument and corresponding response validation.
Documentation
skills/lark-task/references/lark-task-get-my-tasks.md
Updated documentation to describe --page-token <string> parameter. Added example command demonstrating pagination resumption and parameters table entry.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

domain/task, size/M

Suggested reviewers

  • tengchengwei

Poem

🐰✨ A token to resume, a page to explore,
Pagination now hops from shore to shore!
With --page-token in tow, the journey's anew,
Continuing queries with a hop, skip, and boo! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding pagination support via a page token flag to the task command.
Description check ✅ Passed The pull request description follows the template structure with all required sections (Summary, Changes, Test Plan, Related Issues) properly filled with specific details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 8, 2026

Greptile Summary

This PR adds a --page-token flag to task +get-my-tasks, allowing users to resume pagination from a known position. The implementation is clean and consistent with how other flags are handled in both the DryRun and Execute paths.

Confidence Score: 5/5

This 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.

Vulnerabilities

No security concerns identified. The page_token value is passed as a query parameter to the upstream API; it is not interpreted or executed locally.

Important Files Changed

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)
Loading

Reviews (1): Last reviewed commit: "feat(task): support starting pagination ..." | Re-trigger Greptile

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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_001 is 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

📥 Commits

Reviewing files that changed from the base of the PR and between f5a8fbf and b6eb0a4.

📒 Files selected for processing (3)
  • shortcuts/task/task_get_my_tasks.go
  • shortcuts/task/task_get_my_tasks_test.go
  • skills/lark-task/references/lark-task-get-my-tasks.md

Copy link
Copy Markdown
Collaborator

@zero-my zero-my left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zero-my zero-my merged commit 1f8d4b2 into larksuite:main Apr 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/task PR touches the task domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants