Upgrade PolicyEngine.py, compact SPM provenance, and deploy UK credentials - #3855
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3855 +/- ##
===========================================
+ Coverage 45.76% 87.56% +41.79%
===========================================
Files 182 198 +16
Lines 10812 12211 +1399
Branches 1837 2159 +322
===========================================
+ Hits 4948 10692 +5744
+ Misses 5456 922 -4534
- Partials 408 597 +189 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
CI follow-up completed in commits
Validation:
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. |
|
@anth-volk, could this PR and PolicyEngine/policyengine-sim-api#703 target policyengine.py 6.2.0 instead of 6.1.2 before they merge? A UK household calculator I'm building needs the duties added in policyengine-uk 2.102.0 (PolicyEngine/policyengine-uk#1876: alcohol, tobacco, vehicle excise and road fuel gas). API v1 runs policyengine-uk 2.90.2 today, and 6.1.2 still selects 2.90.2. 6.2.0 was released on 29 Sep at 18:02 UTC, after this PR was opened, and selects 2.102.3 (PolicyEngine/policyengine.py#536). What moves between 6.1.2 and 6.2.0. Only policyengine-uk, from 2.90.2 to 2.102.3. Core 3.32.5, US 2.2.1, spm-calculator 1.0.0 and both certified data releases ( What else it changes. 6.2.0 moves every UK result the API serves, household and economy, onto 2.102.3. Its changelog lists the absolute poverty line rebased to FYE 2025, which raises UK absolute poverty in 2026-27 on the certified enhanced FRS by about 4 points overall and 7 points for children after housing costs, and relative poverty measured on the median over individuals (PolicyEngine/policyengine-uk#1865). Versions 2.102.1 and 2.102.2 also fix Class 4 National Insurance. If you and Max would rather land the v6 migration on 6.1.2 first, when would 6.2.0 follow? No bot PR will open for it: every |
4ad5036 to
9232049
Compare
Fixes #3862
Fixes #3865
Fixes #3867
Summary
policyengine[models]==6.2.1, selecting PolicyEngine Core 3.32.10, PolicyEngine US 2.2.1, PolicyEngine UK 2.102.3, andspm-calculator1.0.0.PE_UK_PRIVATE_HF_READ_TOKENcredential through GitHub Actions, Google Secret Manager, Cloud Run, and the Modal secret synchronization step.This PR consolidates and supersedes #3863 and #3866 while preserving their logical commits. It also incorporates the PolicyEngine.py 6.2.1 upgrade that was already present in this PR.
API behavior
The compact SPM contract deliberately removes the earlier
spm_configfield and the large per-execution provenance structure. A completed household calculation returns onecanonical-spm-provenance-v2receipt. A completed society-wide calculation returns onecanonical-spm-comparison-v2object containing one receipt and an execution count for each of the baseline and reform simulations.The receipt records only the selected forecast identity and content hash, scenario, geography selection, county-data vintage, optional as-of date, calculated years, and the four runtime package versions needed to identify the calculation implementation.
Simulation service relationship
The corresponding simulation-service changes have already landed through PolicyEngine/policyengine-sim-api#703, #716, and #721. The API validates the worker's installed bundle and compact receipt contract before accepting completed US economy results.
Credential deployment
The deployment workflows synchronize
PE_UK_PRIVATE_HF_READ_TOKENfrom the GitHub environment into Google Secret Manager, grant the Cloud Run runtime identity access, attach it to Cloud Run under the same explicit name, and include it in the Modal secret set. The prior ambiguous token names are not accepted by the new path.Validation
uv lock --checkuv run --frozen --extra dev mypyuv run --frozen --extra dev ruff format --check .uv run --frozen --extra dev ruff check .uv run python scripts/export_migration_contracts.py(no generated changes)uv run python scripts/run_quality_guards.py