Add pagination notice when search results are truncated#314
Conversation
Search silently truncated results when --limit was set, unlike every other list command. Wire up the existing SDK Meta.TotalCount to output.TruncationNoticeWithTotal so users see "Showing X of Y results" when results are truncated. Add --all flag for fetching everything, matching the pattern used by todos, recordings, and other list commands. Update --limit help text now that --all exists.
Test the search command end-to-end with a mock HTTP transport that returns configurable result counts and X-Total-Count headers. Covers truncation notice appearing in the JSON envelope when results are truncated, absence of notice when all results fit, and --all/--limit mutual exclusivity error.
There was a problem hiding this comment.
Pull request overview
Adds better UX for basecamp search pagination by introducing an --all flag and surfacing a truncation notice when the API reports more results exist than were returned.
Changes:
- Add
--allflag tobasecamp searchand make it mutually exclusive with--limit. - Include truncation notice via
output.TruncationNoticeWithTotal(len(results), searchResult.Meta.TotalCount)in the search response envelope. - Add tests for truncation notice behavior and update
.surfacesnapshot for the new flag.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/commands/search.go |
Adds --all, mutual exclusivity with --limit, and truncation notice wiring using API total count. |
internal/commands/search_test.go |
Introduces tests validating truncation notice presence/absence and flag exclusivity. |
.surface |
Updates surface snapshot to include the new basecamp search --all flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6daf960802
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
--allflag tobasecamp search, matching the pattern every other list command usessearchResult.Meta.TotalCounttooutput.TruncationNoticeWithTotalso truncated results show "Showing X of Y results (use --all for complete list)"--limithelp text (remove stale "0 = all" now that--allexists).surfacesnapshot for the new flagTest plan
TestSearchTruncationNoticePresent— mock transport returns 5 results with TotalCount=20, assert envelope notice contains "Showing 5 of 20"TestSearchNoTruncationNotice— 5 results with TotalCount=5, assert no noticeTestSearchAllAndLimitMutuallyExclusive—--all --limit 5returns usage errormake testandmake test-e2epass