fix(api): accept academic-year codes in rankings year filter #7

Merged
tudor merged 1 commits from fix/rankings-year-validation into main 2026-07-05 10:46:04 +00:00
Owner

The rankings endpoint validated year with le=2100, but the database stores academic-year codes like 201819, so any explicit year selection returned a 422 and the rankings page rendered its empty state (e.g. /rankings?local_authority=Wandsworth&year=201819).

  • Widen the bound to le=210100 so academic-year codes pass validation; out-of-range values are still rejected.
  • Extend the e2e rankings journey to pick a specific year from the dropdown and assert the table stays populated. This test fails against current production, reproducing the bug.

🤖 Generated with Claude Code

The rankings endpoint validated `year` with `le=2100`, but the database stores academic-year codes like `201819`, so any explicit year selection returned a 422 and the rankings page rendered its empty state (e.g. `/rankings?local_authority=Wandsworth&year=201819`). - Widen the bound to `le=210100` so academic-year codes pass validation; out-of-range values are still rejected. - Extend the e2e rankings journey to pick a specific year from the dropdown and assert the table stays populated. This test fails against current production, reproducing the bug. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tudor added 1 commit 2026-07-04 22:06:51 +00:00
fix(api): accept academic-year codes in rankings year filter
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 9m36s
PR Checks / Backend Smoke (pull_request) Successful in 5s
PR Checks / Build Backend (no push) (pull_request) Successful in 20s
PR Checks / Build Frontend (no push) (pull_request) Successful in 52s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 10s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 1m44s
6c872ce726
The rankings endpoint validated year with le=2100, but the database
stores academic-year codes like 201819, so any explicit year selection
returned a 422 and the rankings page rendered its empty state. Widen
the bound to cover the codes and extend the e2e journey to pick a
specific year and assert the table stays populated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

🤖 AI Code Review (Claude Code)

Fixes the /api/rankings endpoint's year query parameter validation, which previously rejected the 6-digit academic-year codes (e.g. 201819) actually stored in the year column, by widening the upper bound from 2100 to 210100. Adds a matching e2e test that selects a specific year on the rankings page and asserts the table stays populated. Verified against the dbt staging models (time_period cast to year) and the frontend's RankingsView (which already passes these codes as option values), and the fix is correctly scoped — no other endpoint uses this parameter.

No issues found.

## 🤖 AI Code Review (Claude Code) Fixes the `/api/rankings` endpoint's `year` query parameter validation, which previously rejected the 6-digit academic-year codes (e.g. `201819`) actually stored in the `year` column, by widening the upper bound from 2100 to 210100. Adds a matching e2e test that selects a specific year on the rankings page and asserts the table stays populated. Verified against the dbt staging models (`time_period` cast to `year`) and the frontend's `RankingsView` (which already passes these codes as option values), and the fix is correctly scoped — no other endpoint uses this parameter. ✅ No issues found.
tudor merged commit 0a370e3b63 into main 2026-07-05 10:46:04 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tudor/school_compare#7