Problem
The legacy API currently reuses economy cache entries and saved report outputs too aggressively across backend/runtime changes. When the underlying PolicyEngine runtime or output schema changes, old cached rows can still be treated as reusable even though they no longer reflect the current payload contract.
This showed up clearly with the new congressional district winner/loser fields: the backend could be updated correctly, but old cached report outputs and economy responses would still serve payloads that predated those fields.
Why this matters
This is bigger than one district-map feature.
- Backend rollouts can appear "partially deployed" because some requests hit fresh logic while others reuse stale payloads.
- Old report links can continue serving outdated output indefinitely.
- Long-running jobs that span a deploy boundary can end up polluting the current cache lineage if stale rows are promoted incorrectly.
- Feature launches become dependent on manual backfills and cache clears instead of the system naturally converging on current data.
Desired outcome
We should treat report/economy cache reuse as a runtime-versioned contract, not just a country-package or request-shape contract.
Specifically:
- Cache keys for economy/report reuse should change when the relevant runtime changes.
- Stale report IDs should resolve to current-version rows rather than continuing to serve stale payloads.
- Jobs created under an old runtime should not be relabeled in place as current-version cache entries after a deploy.
- Users opening old reports should converge onto current payloads without requiring ad hoc manual intervention.
Related work
Implementation is in PR #3384.
Problem
The legacy API currently reuses economy cache entries and saved report outputs too aggressively across backend/runtime changes. When the underlying PolicyEngine runtime or output schema changes, old cached rows can still be treated as reusable even though they no longer reflect the current payload contract.
This showed up clearly with the new congressional district winner/loser fields: the backend could be updated correctly, but old cached report outputs and economy responses would still serve payloads that predated those fields.
Why this matters
This is bigger than one district-map feature.
Desired outcome
We should treat report/economy cache reuse as a runtime-versioned contract, not just a country-package or request-shape contract.
Specifically:
Related work
Implementation is in PR #3384.