Skip to content

fix(renewable): replace hardcoded fallback with last-known-good data#5551

Merged
koala73 merged 2 commits into
mainfrom
codex/renewable-last-known-good-5497
Jul 24, 2026
Merged

fix(renewable): replace hardcoded fallback with last-known-good data#5551
koala73 merged 2 commits into
mainfrom
codex/renewable-last-known-good-5497

Conversation

@koala73

@koala73 koala73 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #5497.

  • remove the hardcoded 2022 renewable-energy snapshot from the production recovery path
  • persist only validated World Bank payloads and serve them as bounded last-known-good data for up to seven days
  • version the breaker cache key so pre-fix entries that may contain the static snapshot are never reused
  • expose live, cached, and unavailable states to the panel, including cache age
  • prevent cached or unavailable renewable data from triggering happy-variant record celebrations

This is an alternative to #5521's disclosure-banner approach: the static fallback is deleted rather than retained and labelled.

Intent and non-goals

The intent is to preserve availability with canonical last-known-good data while failing closed when no trustworthy observation exists.

Non-goals:

  • no direct browser-to-World-Bank fallback
  • no bootstrap/KV deployment flag changes
  • no generic circuit-breaker redesign
  • no changes to the independent EIA capacity series

Validation matrix

Check Result
Renewable last-known-good, expiry, malformed payload, legacy cache, and milestone regression tests Pass (7/7)
Rendered panel cached/unavailable state tests Pass (2/2)
Energy-variant renewable wiring tests Pass (3/3)
npm run typecheck Pass
Full test:data inside the sandbox Environment-blocked: tsx IPC was denied and the fallback run hung on the unrelated Clerk/JWKS test
tests/auth-session.test.mts outside the sandbox Pass (23/23)

Review gates

  • Reviewed for cache integrity, stale-state races, failure semantics, and milestone side effects.
  • A stale-while-revalidate race found during review was fixed by storing cache timestamps with each snapshot and classifying the returned object atomically.
  • No unresolved review findings.

Documentation

Not applicable. This changes an internal recovery contract and reuses the existing panel data-badge convention.

Screenshots / UI evidence

Automated rendered-DOM coverage verifies the unavailable state renders no World Bank chart and the cached state displays cache age. No durable screenshot is attached.

CI and review follow-up

Pending after publication.

Residual findings

None.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Ready Ready Preview, Comment Jul 24, 2026 3:40pm

Request Review

- enforce the seven-day ceiling for in-memory renewable snapshots
- exercise chart rendering with validator-valid cached data
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.

Renewable Energy panel serves hardcoded 2022 fallback data with zero staleness disclosure (sibling of fixed #3758)

1 participant