Skip to content

Update API v1 to PolicyEngine 6.1.2 - #3855

Draft
anth-volk wants to merge 8 commits into
masterfrom
feat/policyengine-6-1-2-api
Draft

anth-volk wants to merge 8 commits into
masterfrom
feat/policyengine-6-1-2-api

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Summary

  • Install policyengine[models]==6.1.2, which selects PolicyEngine Core 3.32.5, PolicyEngine US 2.2.1, PolicyEngine UK 2.90.2, and spm-calculator 1.0.0.
  • Validate that the simulation registry maps the PolicyEngine.py, US, and UK versions to one worker application with matching canonical SPM settings.
  • Update the automatic PolicyEngine.py dependency workflow to change the single bundle requirement, check uv.lock, verify all five installed distributions against the bundle manifest, and report the US and UK certified data releases.
  • Update API request, result, cache, and catalog fixtures for the v6 contract.

This supersedes #3837 as a clean implementation from current master. It does not reuse the implementation logic or commits from #3837.

PolicyEngine 6 behavior covered here

PolicyEngine.py 6.1.2 identifies the exact SPM forecast file and default scenario used by the installed US model. API v1 resolves those settings before submitting an economy calculation. It rejects a worker that reports different settings, and it validates the forecast, scenario, year, and geography receipts in completed results before caching them.

The bundle also changes the installed public model catalog. The compatibility fixture now records 7,046 variables, 29,118 parameter nodes, 103,705 parameters, and 1,192,826 parameter values.

Simulation API relationship

PolicyEngine/policyengine-sim-api#703 contains the corresponding worker update to PolicyEngine.py 6.1.2. The two PRs can be reviewed independently. This PR does not merge or deploy #703, and opening this PR does not roll out either service.

Until a compatible worker is deployed, API v1 returns SPM_CONFIGURATION_UNAVAILABLE for affected US economy requests instead of submitting them to an incompatible worker. The live worker compatibility check may therefore remain unsuccessful while #703 is only a PR.

Commits

  1. Prepare reusable v6 SPM fixtures.
  2. Update the API and generic Docker image to PolicyEngine.py 6.1.2.
  3. Add installed-bundle and simulation-worker compatibility validation.
  4. Update the automatic PolicyEngine.py dependency workflow.
  5. Update v6-dependent fixtures, expected responses, and catalog counts.
  6. Document the package tuple, data releases, and compatibility behavior.

Testing

  • uv lock --check
  • ruff check .github/find-api-model-versions.py policyengine_api tests
  • Shell syntax checks for the dependency and worker validation scripts
  • Full suite: 2,267 passed, 94 skipped
  • Installed catalog extraction: passed twice with identical counts
  • Automatic updater tests: 8 passed
  • Focused SPM tests: 158 passed

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.86207% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.68%. Comparing base (3682625) to head (dd5a0ac).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
policyengine_api/worker_spm_release.py 75.86% 10 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3855       +/-   ##
===========================================
+ Coverage   45.76%   87.68%   +41.92%     
===========================================
  Files         182      198       +16     
  Lines       10812    12010     +1198     
  Branches     1837     2106      +269     
===========================================
+ Hits         4948    10531     +5583     
+ Misses       5456      901     -4555     
- Partials      408      578      +170     

☔ View full report in Codecov by Harness.
📢 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.

…-1-2-api

# Conflicts:
#	tests/unit/routes/test_calculate_error_statuses.py
#	tests/unit/services/test_economy_service.py
@anth-volk

Copy link
Copy Markdown
Collaborator Author

CI follow-up completed in commits 736c26c3 and dd5a0ac7.

  • Applied Ruff formatting to the four reported test modules.
  • Confirmed the existing changelog fragment already passed; no changelog edit was needed.
  • Removed the live simulation compatibility job as a prerequisite for the API test and container-build jobs. The compatibility check remains visible.
  • Merged current master and resolved the v6 SPM test fixtures against the newly merged observability and cache behavior.

Validation:

  • Local full suite: 2,311 passed, 94 skipped.
  • Hosted lint, changelog, API tests, environment tests, both container builds, both database migration checks, cross-database integration tests, type checking, quality checks, and Codecov checks pass.

The only remaining unsuccessful check is the live simulation compatibility check because the deployed simulation service does not yet advertise PolicyEngine.py 6.1.2. No service was deployed or merged as part of this fix.

This branch had an error being deployed

1 failed deployment
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