Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Pagy 43 ignores the repo's `Pagy::OPTIONS` initializer; out-of-range pages render empty

Đang mở
#2,917 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
ruby
Lĩnh vực
backend

Hướng nghiên cứu

Start by reading config/initializers/pagy.rb and Pagy::Offset in the installed Pagy 43.6.2 source, then inspect the shared controller concern if the behavior is changed. First record whether stale pages remain empty, are clamped, or return 404; done means the decision is documented, dead options are removed, and shared behavior has specs if it changes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

discussion tech debt

Summary

Two related problems, both rooted in the pagy 6.4.3 → 43.2.2 jump (commit 6bf5b912):

  1. config/initializers/pagy.rb sets Pagy::OPTIONS[:size] and Pagy::OPTIONS[:overflow]. Pagy 43 reads neither — Pagy::OPTIONS is an empty hash that nothing consumes these keys from — so both lines are dead config.
  2. Requesting an out-of-range ?page= on any paginated page renders an empty listing labelled with the full total (e.g. "700 workshops" over an empty table). In Pagy 43 this behaviour is hard-wired: Pagy::Offset#initialize calls assign_empty_page_variables for any page past the last, with no overflow option, no OverflowError, and no :last_page/:exception modes anywhere in the gem. The series nav still renders, with prev pointing at the last real page.

This manifests on every pagy page in the app: the admin pages (feedback, members, groups, sponsors, invitation logs, admin chapter workshops index) and /coaches.

Context

Raised as a review finding on PR #2915 ("stale/out-of-range ?page= then count-labeled empty table") and deferred there because the behaviour is shared by every paginated page. The finding's original suggested fix — passing overflow: :last_page per call — is not possible on Pagy 43: the option no longer exists, so it would be another silent no-op. Verified against the installed pagy 43.6.2 source.

Related: #2916 (stale items: keywords — same upgrade missed the same breaking changes).

Options

  1. Accept the hard-wired empty-page behaviour. Delete the dead initializer lines (or the file if nothing else remains) and document the behaviour. No code path changes; users landing on a stale page see an empty table with a correct total and a working nav back.
  2. Clamp out-of-range pages to the last real page. Pagy 43 offers no lever, so this means resolving the page param against the real page count before building the pagy object — an extra count query per request, in one shared place (a controller concern), not per page.
  3. Render a 404 for out-of-range pages. Same clamping requirement, plus deciding which routes deserve it. Strictest, most infrastructure.

Option 1 is the default if nobody feels the behaviour is worth the extra query or plumbing; options 2 and 3 exist so the decision is explicit rather than inherited from a dead config line.

Acceptance criteria

  • A decision on out-of-range behaviour is recorded
  • Dead Pagy::OPTIONS[:overflow] / [:size] lines removed from config/initializers/pagy.rb (verify: ast-grep run --pattern 'Pagy::OPTIONS[$K] = $V' --lang ruby returns no output, or the initializer is deleted)
  • If the behaviour changes, it changes in one shared place with specs pinning it — not per-page
Ngôn ngữ chính
Ruby
Star
104
Fork
205
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
71

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codebar/planner

Tất cả issue của codebar/planner

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.