Return an empty page instead of 500ing on out-of-range wishlist product pages#6082
Merged
Conversation
…ct pages Public wishlist product listings (Wishlists::ProductsController#index) raised Pagy::OverflowError when the requested ?page= exceeded the total page count, returning a 500 to stale links and crawlers. Use pagy's overflow: :empty_page so out-of-range pages return an empty items list with pagination metadata, matching the pattern already used by other public paginated presenters. Fixes Sentry GUMROAD-2A (1,614 events / 566 users since March).
gumclaw
enabled auto-merge (squash)
July 21, 2026 12:11
Contributor
Author
|
Self-review (fable-5 adversarial pass on the diff):
|
Contributor
Greptile SummaryThis PR makes out-of-range public wishlist pages return an empty result instead of an error. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues were found in the changed code. The overflow option follows an existing repository pattern, and the new test covers the reported out-of-range request.
What T-Rex did
Important Files Changed
Reviews (1): Last reviewed commit: "Return an empty page instead of 500ing o..." | Re-trigger Greptile |
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.
What
Public wishlist product listings (
Wishlists::ProductsController#index→WishlistPresenter#paginated_public_items) now return an empty page instead of raisingPagy::OverflowErrorwhen the requested?page=exceeds the total page count.Why
Sentry GUMROAD-2A —
Pagy::OverflowError: expected :page in 1..1; got 2— has fired 1,614 times for 566 users since March 2026 and is still firing daily. The endpoint is public and unauthenticated: the page number comes straight from the query string, so out-of-range pages arrive constantly (stale bookmarks, crawlers, wishlists whose products were removed between page loads). Each one 500ed.The repo's global pagy default is
overflow: :exception(config/initializers/pagy.rb), and other public paginated presenters already opt out per-call (paginated_installments_presenter.rbusesoverflow: :empty_page,affiliated_products_presenter.rb/paginated_utm_links_presenter.rbuse:last_page). This applies the same pattern here.:empty_page(not:last_page) so the client's "load more" pagination terminates cleanly withnext: nilinstead of re-serving the last page's items.A prior attempt (#4116) rescued the error in the presenter and fell back to page 1; it was closed for inactivity. Pagy's built-in overflow mode is simpler and matches existing convention.
QA steps
https://<seller>.gumroad.com/wishlists/<id>/products?page=2.200with{"items": [], "pagination": {"page": 2, "pages": 1, "next": null, ...}}.Test Results
bundle exec rspec spec/presenters/wishlist_presenter_spec.rb— 28 examples, 0 failures. The new spec ("returns an empty page instead of raising when the requested page exceeds the total pages") was proven red against unmodified main before the fix.Before/After
Not a UI change — valid in-range pages render byte-identical data (all 27 pre-existing presenter specs pass unmodified). Only the out-of-range error path changes from a 500 to an empty JSON page.
AI disclosure: Generated with Claude Fable 5 (Gumclaw's daily Sentry sweep cron). Instructions: triage top unresolved Sentry issues in the gumroad project, classify, and fix actionable items with red-first tests per the repo's contribution gates.