Repository navigation
Page the Spam, Trash and Everything topic views - #315
Merged
Merged
Conversation
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.
There was a problem hiding this comment.
🟢 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
SentPageseparate. - 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 rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto 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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Go SDK can't page HEY's Spam, Trash and Everything views.
GetSpam,GetTrashandGetEverythingdecode the topics but drop theLinkheader that carries the next-page cursor, so callers see the first page and nothing after it. hey-cli wants these views forhey thread list --in spam|trash|everything(hey-cli#161). Without them it would have to read the routes through the document client and parseLinkitself.This adds
GetSpamPage,GetTrashPageandGetEverythingPage. They return aTopicListPagewith the view's title, description, topics, the opaquenext_pagecursor andX-Total-Count, the same shape asGetSentPageand the collection and label pages. The existing methods are unchanged for callers; they now share one read with the new ones and useinstrumentlike 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.GetSentPagekeeps its ownSentPagetype. Sent pages by offset in haystack and sends noX-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
urlfrom 2.5.8 to 2.5.9 in both Rust lockfiles. A new advisory, RUSTSEC-2026-0592, madecargo denyfail Rust Tests here. It has nothing to do with this change, and main will fail the same way until the bump lands.