Repository navigation
Refactor shared team-season page scaffolding - #51
Conversation
Pin the pre-analytics behavior every analytics route shares, across all eight routes: empty database, unknown team/season 404s, explicit and default selection, FastAPI 422 validation, and the missing-schema 503. Terminal states keep the requested query values in navigation; resolved selections rebuild navigation from the resolved values. Refs #44 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extract the duplicated route prefix (team-season lookup, 503/empty/404 handling, team and season resolution, navigation rebuild) into _prepare_team_season_page, returning a small PreparedTeamSeasonPage or a rendered terminal response. Declare the team_id/season/window query contract once as Annotated aliases. The abstraction stops before metric-specific record loading: every route's code from its first repository call onward is unchanged, and the generated OpenAPI schema is identical. Refs #44 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Group the shared team-season scaffold assertions so each analytics route makes all checks for one state against one migrated database, instead of one tiny test per assertion. Every contract is still pinned on all eight routes, including the requested-vs-resolved navigation distinction. Add a parametrized DB-only regression proving each analytics browser route renders from persisted data without constructing an MLB client or calling the network-facing services, using the same monkeypatch pattern as the existing route suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @Mattsface's task in 2m 13s —— View job Claude's Task List
ReviewThe trigger comment was just Summary: This is a clean, behavior-preserving mechanical refactor. I diffed each of the eight routes' pre-refactor bodies against the new Architecture (
Tests (
Minor observations (non-blocking):
Validation limitation: I was not able to run No blocking issues found. Scope stays within the stated route-scaffolding slice of #44 (no chart, validator, persistence, template, or Player-UI changes touched, matching the PR's stated exclusions). |
Summary
Implements the first, route-scaffolding slice of #44.
Scope intentionally excluded
Validation
Branch review found no production-code blocker. PR CI should be treated as the authoritative full pytest/Ruff validation before merge.
Refs #44