Skip to content

fix(runtime): honor the starting offset when paginating - #200

Merged
samzong merged 1 commit into
lathe-cli:mainfrom
git-jxj:git-jxj/fix-pagination-initial-offset-20261010
Oct 12, 2026
Merged

samzong merged 1 commit into
lathe-cli:mainfrom
git-jxj:git-jxj/fix-pagination-initial-offset-20261010

Conversation

@git-jxj

@git-jxj git-jxj commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Offset pagination with --all sends the requested starting offset on the first page, but resets its counter to zero afterward. For --offset 2 --limit 2, the requests use offsets 2, 2, 4, 5 and duplicate the first fetched page.

Initialize the counter from the resolved request query so both explicit offsets and specification defaults continue from the requested page. Regression tests exercise the generated command runtime against HTTP fixtures, including custom and encoded parameter names, different page sizes, total metadata, and an empty first page.

Verification

  • make check
  • go test -race ./...
  • go build ./...

The new regressions fail against the original implementation and pass with this change.

Compatibility

Offset-based --all now advances from the starting offset already sent in the first request. The CLI usage documentation describes this behavior.

Checklist

  • Tests or focused verification cover the changed surface.
  • User-facing behavior changes are documented.
  • Generated output under internal/generated/, .cache/, and ad-hoc skills/<cli-name>/ directories is not committed.
  • Commits are signed off when this is ready to merge.

Signed-off-by: xinjun.jiang <xinjun.jiang@daocloud.io>
@ghfind-review ghfind-review Bot added the review: medium ghfind author score; see https://ghfind.com label Oct 10, 2026
@samzong
samzong merged commit a6d2ce8 into lathe-cli:main Oct 12, 2026
3 checks passed
@samzong

samzong commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

@git-jxj Thank you for your attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: medium ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants