Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#2,917 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
ruby
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Ruby
Estrellas
104
Forks
205
Merge medio
1 d 6 h
PR fusionados (30 d)
70

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codebar/planner

Todos los issues de codebar/planner

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.