Skip to content

fix(cli): report chunk truncation only when rows are omitted - #4260

Open
rudycelekli wants to merge 1 commit into
Tencent:mainfrom
rudycelekli:fix/cli-chunk-truncation-20261013
Open

rudycelekli wants to merge 1 commit into
Tencent:mainfrom
rudycelekli:fix/cli-chunk-truncation-20261013

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

chunk list --all-pages reported meta.has_more=true when the complete document had exactly --limit chunks. Determine truncation before slicing using fetched rows and the server total, so reaching the limit with no omitted rows reports false. Genuine truncation and single-page behavior stay unchanged.

Validation

  • Eight real root-command/SDK HTTP cases cover exact limits on one and multiple pages, below-limit totals, omitted known/fetched rows, single-page behavior, and empty documents. Both exact-limit regressions fail on original source; six healthy controls pass. All eight pass with this change, including counts, order, and request counts.
  • Full CLI go test -count=1 ./... and go vet ./... pass.
  • golangci-lint 2.12.2, run --new-from-rev=origin/main --concurrency=2 --timeout=2m ./..., passes from cli/.

Tests use temporary configuration and synthetic loopback HTTP. Full backend checks remain blocked by uncached backend dependencies; these results cover the CLI module. Developed and reviewed with AI assistance.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The logic matches the documented semantics and is comprehensively covered by focused regression tests.

0 open findings

What changed in this PR

Fixes incorrect meta.has_more reporting when fetched chunk counts exactly match --limit.

Changes:

  • Detects truncation using fetched rows and server totals before slicing.
  • Adds eight HTTP-backed pagination and truncation regression cases.
File Description
cli/​cmd/​chunk/​list.go Corrects exact-limit truncation detection.
cli/​cmd/​chunk/​list_truncation_test.go Covers limit, pagination, ordering, and empty results.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants