Skip to content

Page the Spam, Trash and Everything topic views - #315

Merged
robzolkos merged 2 commits into
mainfrom
topic-list-pages
Nov 23, 2026
Merged

robzolkos merged 2 commits into
mainfrom
topic-list-pages

Conversation

@robzolkos

@robzolkos robzolkos commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

The Go SDK can't page HEY's Spam, Trash and Everything views. GetSpam, GetTrash and GetEverything decode the topics but drop the Link header that carries the next-page cursor, so callers see the first page and nothing after it. hey-cli wants these views for hey thread list --in spam|trash|everything (hey-cli#161). Without them it would have to read the routes through the document client and parse Link itself.

This adds GetSpamPage, GetTrashPage and GetEverythingPage. They return a TopicListPage with the view's title, description, topics, the opaque next_page cursor and X-Total-Count, the same shape as GetSentPage and the collection and label pages. The existing methods are unchanged for callers; they now share one read with the new ones and use instrument like the newer wrappers.

Only Go needed this. The spec already marks all four routes @heyPagination(style: "link", totalCountHeader: "X-Total-Count"), and the Rust, TypeScript, Kotlin and Swift SDKs already return pages for them. Haystack already sends both headers on these routes through geared_pagination, so no API change is needed.

GetSentPage keeps its own SentPage type. Sent pages by offset in haystack and sends no X-Total-Count, so a total there would always read zero.

Tests: make go-check go-check-drift. They cover the cursor and total on a first page, the empty cursor and empty list on the last page, and the error path for each view.

A second commit updates url from 2.5.8 to 2.5.9 in both Rust lockfiles. A new advisory, RUSTSEC-2026-0592, made cargo deny fail Rust Tests here. It has nothing to do with this change, and main will fail the same way until the bump lands.

GetSpam, GetTrash and GetEverything drop the Link header, so a client can read only the first page of each view. GetSpamPage, GetTrashPage and GetEverythingPage keep the next-page cursor and X-Total-Count, as GetSentPage and the collection and label pages do.
Copilot AI balanced review requested due to automatic review settings November 23, 2026 22:21

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.

🟢 Approved

No active review issues are reported for the pagination changes.

No open issues 🎉

What changed in this PR

Adds pagination support to the Go SDK’s Spam, Trash, and Everything topic views, enabling callers such as hey-cli to retrieve more than the first page.

Changes:

  • Adds page methods returning topics, view metadata, the next-page cursor, and total count.
  • Shares instrumented reads with existing methods while preserving their return types and keeping SentPage separate.
  • Adds tests for cursor round-tripping, totals, empty last pages, and error propagation across all three views.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
go/​pkg/​hey/​topics.go Adds TopicListPage, three page methods, and shared instrumented reads.
go/​pkg/​hey/​services_test.go Tests pagination metadata, final-page behavior, and errors for each view.

Review effort: Balanced

cargo deny fails on url 2.5.8, whose Url::origin() recurses without limit on nested blob: URLs.
@robzolkos
robzolkos merged commit a8b2482 into main Nov 23, 2026
35 checks passed
@robzolkos
robzolkos deleted the topic-list-pages branch November 23, 2026 22:45
@robzolkos robzolkos mentioned this pull request Nov 23, 2026
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