Skip to content

Add legacy report rerun support#3392

Draft
anth-volk wants to merge 17 commits intomasterfrom
codex/report-rerun-v1-commit1
Draft

Add legacy report rerun support#3392
anth-volk wants to merge 17 commits intomasterfrom
codex/report-rerun-v1-commit1

Conversation

@anth-volk
Copy link
Copy Markdown
Collaborator

Fixes #3391

Summary

This draft adds legacy rerun support for reports in policyengine-api.

It includes:

  • explicit reset helpers for report_outputs and simulations
  • broader reform_impact cache deletion support for rerun invalidation
  • POST /<country_id>/report/<report_id>/rerun
  • route coverage for household, economy, and malformed-linkage rerun cases

Notes

  • economy cache invalidation uses the current legacy app-path assumptions:
    • dataset = "default"
    • options_hash = "[]"
    • time_period = report.year
  • malformed linked-simulation state returns a controlled error before any reset work runs

Testing

FLASK_DEBUG=1 uv run pytest --confcutdir=tests/unit \
  tests/unit/routes/test_report_output_routes.py \
  tests/unit/services/test_report_output_service.py \
  tests/unit/services/test_simulation_service.py \
  tests/unit/services/test_reform_impacts_service.py

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 78.60082% with 104 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.67%. Comparing base (6af28d7) to head (79a89b3).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
policyengine_api/services/economy_service.py 73.55% 38 Missing and 35 partials ⚠️
...olicyengine_api/services/reform_impacts_service.py 79.22% 13 Missing and 3 partials ⚠️
policyengine_api/routes/economy_routes.py 85.36% 3 Missing and 3 partials ⚠️
policyengine_api/api.py 40.00% 2 Missing and 1 partial ⚠️
policyengine_api/data/data.py 62.50% 3 Missing ⚠️
policyengine_api/services/report_output_service.py 85.71% 1 Missing and 1 partial ⚠️
policyengine_api/country.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3392      +/-   ##
==========================================
+ Coverage   72.20%   73.67%   +1.47%     
==========================================
  Files          56       56              
  Lines        2425     2910     +485     
  Branches      423      529     +106     
==========================================
+ Hits         1751     2144     +393     
- Misses        595      645      +50     
- Partials       79      121      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Add legacy report rerun support for report outputs, simulations, and economy cache

2 participants