Pagy 43 ignores the repo's `Pagy::OPTIONS` initializer; out-of-range pages render empty
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
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
Summary
Two related problems, both rooted in the pagy 6.4.3 → 43.2.2 jump (commit 6bf5b912):
config/initializers/pagy.rbsetsPagy::OPTIONS[:size]andPagy::OPTIONS[:overflow]. Pagy 43 reads neither —Pagy::OPTIONSis an empty hash that nothing consumes these keys from — so both lines are dead config.- 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#initializecallsassign_empty_page_variablesfor any page past the last, with nooverflowoption, noOverflowError, and no:last_page/:exceptionmodes 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
- 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.
- 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.
- 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 fromconfig/initializers/pagy.rb(verify:ast-grep run --pattern 'Pagy::OPTIONS[$K] = $V' --lang rubyreturns 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codebar/planner
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
expenses
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de codebar/planner
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
solana-foundation/pay-kit#341 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
TheOdinProject/curriculum#31427 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Mail processor needs SSL flagAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
cyclestreets/cyclescape#1107 · 1 reacción ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 1 día