Skip to content

WetherVane v5 ForecastHistoryChart#170

Open
HaydenHaines wants to merge 8 commits into
mainfrom
feat/wethervane-v5-forecast-history-chart
Open

WetherVane v5 ForecastHistoryChart#170
HaydenHaines wants to merge 8 commits into
mainfrom
feat/wethervane-v5-forecast-history-chart

Conversation

@HaydenHaines
Copy link
Copy Markdown
Owner

Summary

  • add ForecastHistoryChart on race detail pages
  • add race-history API proxy and package scripts needed for QA
  • includes follow-up governor overview history sparklines commit currently on this branch

QA

  • T2b final QA task #2346: SC1-SC4 PASS
  • SC5 deferred because dev server was not running

Agentic-box EPIC closed in commit 3baa744.

HaydenHaines and others added 8 commits May 3, 2026 08:16
…t scores

Exposes make_xt_impact_report() via a new FastAPI endpoint. Returns top race
movers sorted by |delta_pp| with 1-hour module-level TTL cache. Includes
?races= and ?limit= query params. Adds 8 pytest tests (all passing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Surface the GET /api/v1/forecast/xt-impact backend endpoint in the UI:

- web/lib/api.ts: XtImpactMover + XtImpactResponse interfaces, fetchXtImpact()
- web/app/api/forecast/xt-impact/route.ts: Next.js proxy (ISR 1h) forwarding
  to the Python backend
- web/components/explore/XtImpactPanel.tsx: SWR client component rendering
  top-10 movers table (race, delta_pp, direction arrow) with 1h dedup interval
- web/app/explore/types/page.tsx: lazy-load XtImpactPanel via dynamic import
  below the ScatterPlot section

tsc --noEmit passes, npm run build exits 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
_xt_delta_from_polls already computed xt_race_counts but discarded it
before returning. Now propagates through the full stack:

- forecast_engine.py: include xt_race_counts in return dict
- xt_impact.py: read xt_race_counts from cached report, attach
  n_xt_polls to each top_movers entry
- api.ts: add n_xt_polls: number to XtImpactMover interface
- XtImpactPanel.tsx: add Polls column rendering mover.n_xt_polls
- test_forecast_engine.py: new TestXtRaceCounts unit test confirms
  xt_race_counts is present and correctly counts xt_ polls per race;
  update key-check test to include xt_race_counts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Surfaces the top 5 Senate races by cross-type poll impact delta on the
landing page. New compact widget sits below the MiniMap and shows each
race's name, a two-sided dem/rep delta bar, ±pp value, and a cross-type
poll count badge. SWR-cached for 1 hour. tsc --noEmit passes clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a full Visx line chart showing dem margin over snapshot dates,
replacing the inline sparkline in the Forecast History section of the
race detail page. Chart includes axes, zero reference line, hover tooltip,
loading/empty states, and is mounted above the polls section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SC3: create web/app/api/forecast/race-history/route.ts proxying GET
/api/v1/forecast/race-history to the Python backend (pattern mirrors
xt-impact/route.ts).

SC4: add typecheck (tsc --noEmit) and lint (eslint . --max-warnings=29)
scripts to web/package.json; --max-warnings=29 baselines 29 pre-existing
warnings so new regressions will break CI while legacy debt is visible.

Closes T2 gate failures on feat/wethervane-v5-forecast-history-chart.
Resolved all 29 existing ESLint warnings (unused vars/imports, stale
eslint-disable directives, react-hooks/exhaustive-deps, and ARIA
combobox missing aria-controls). Lowered --max-warnings from 29 to 0
so any future warning immediately fails CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… page

Import useRaceHistory hook and pass historyBySlug to all three RaceCardGrid
instances (competitive, D-leaning, R-leaning) to match the senate overview
pattern. No backend changes -- /forecast/race-history already returns all races.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant