Skip to content

Require PolicyEngine 6.3.4 for regional simulations - #3868

Draft
anth-volk wants to merge 8 commits into
masterfrom
fix/3864-acs-local-regional-defaults
Draft

anth-volk wants to merge 8 commits into
masterfrom
fix/3864-acs-local-regional-defaults

Conversation

@anth-volk

@anth-volk anth-volk commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3864

Blocking dependency

Do not merge or deploy until all of these are done:

The runtime and Docker image already require policyengine[models]==6.3.4. Until it is published, uv lock --check and the image build fail by design.

Why 6.3.4: with 6.2.7, every SPM calculation on the certified ACS-local source that states and congressional districts use stops with SPM_COMPOSITION_REQUIRED. The source predates SPM measurement-scope and independence-role declarations. 6.3.4 adds backward compatibility for such legacy sources:

  • ACS group quarters are outside the SPM measurement, following Census's ACS household-population method.
  • The source's ASEC/PUF records take the certified SPM independence role from the national release.

Summary

  • Require policyengine[models]==6.3.4 in the API runtime and the generic container image. Use the bundle's exact Core 3.33.0, US 2.2.1, UK 2.126.12 and SPM calculator 1.0.0; do not select country packages independently.
  • Verify that the national US default remains populace_us_2024, and that states and congressional districts use the certified populace_us_2024_acs_local dataset through standard region_datasets metadata, not dataset_overlays.
  • Update the exact installed-catalog expectations for 6.3.4's models.
  • Support England's multi-value region filter in catalog extraction:
    • Flat list or tuple membership values are stored as compact JSON arrays in the existing text column.
    • Scalar values keep their previous representation.
    • Invalid, empty, nested or oversized membership values fail before database access.
  • Assert that the real installed England filter keeps all nine English regions.
  • Null poverty rates pass through. The simulation API (Clear out duplicate policies #726) now reports null for a poverty group with nobody inside the poverty measurement (PovertyRateValue). That is not a measured 0%. A new test confirms economic impact results keep those nulls when returned and stored. API v1 does not parse poverty fields, so no other code change is needed.
  • Update the bundle changelog fragment.

Catalog compatibility

With 6.3.4's models (US 2.2.1, UK 2.126.12), the installed catalog contains:

Entity Count
Variables 7,294
Parameter nodes 29,300
Parameters 104,158
Parameter values 1,194,256
Datasets 3
Regions 826

These were measured with the published 6.3.1 bundle, which installs the same model versions; 6.3.4 changes no model package. Exact count assertions remain, so future country-package changes require explicit review.

Validation

In an environment with the published 6.3.1 bundle (same Core, US, UK and SPM calculator versions as 6.3.4):

  • The complete API unit suite passed (2,297 tests), including the new null-poverty test.
  • The installed-catalog compatibility test, constants and catalog-extraction tests passed (70 tests).

On the branch:

  • Changed-file Ruff format and lint, migration quality guards, and migration-contract export passed. The regenerated artifacts have no tracked changes.

Not yet run: the lockfile refresh and frozen install against 6.3.4, the database-backed integration suite, container builds and live deployment checks. All of these wait for publication.

Deployment scope

  • Existing Flask/API v1 routes and compute delegation remain in place.
  • The only response change is upstream: poverty rates from the simulation API may now be null for a group with nobody measured. That does not happen for whole states or districts in current data.
  • App follow-up (not yet tracked): policyengine-app-v2 types these rates as numbers, and its percentage-change text would show NaN for such a group.
  • No new environment variables or secrets. The image installs 6.3.4, whose only new runtime download is a certified file from the same public Hugging Face repository as the ACS-local source; anonymous access was verified. UK data access is unchanged.
  • No route cutover, Alembic revision, database provisioning, service account or deployment target. No running infrastructure or traffic was modified.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.25%. Comparing base (21ddf34) to head (3c7c0e7).

Files with missing lines Patch % Lines
policyengine_api/data/v2/catalog/extraction.py 60.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3868      +/-   ##
==========================================
+ Coverage   45.22%   45.25%   +0.02%     
==========================================
  Files         183      183              
  Lines       11073    11085      +12     
  Branches     1905     1907       +2     
==========================================
+ Hits         5008     5016       +8     
- Misses       5644     5647       +3     
- Partials      421      422       +1     

☔ 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.

@anth-volk anth-volk changed the title Require PolicyEngine 6.2.2 for regional simulations Require PolicyEngine 6.2.5 for regional simulations Oct 9, 2026
@anth-volk
anth-volk force-pushed the fix/3864-acs-local-regional-defaults branch from 301109c to 3c7c0e7 Compare October 12, 2026 12:46
@anth-volk anth-volk changed the title Require PolicyEngine 6.2.5 for regional simulations Require PolicyEngine 6.2.7 for regional simulations Oct 12, 2026
@anth-volk anth-volk changed the title Require PolicyEngine 6.2.7 for regional simulations Require PolicyEngine 6.3.4 for regional simulations Oct 13, 2026
anth-volk and others added 8 commits October 14, 2026 00:33
PolicyEngine.py 6.3.4 adds backward compatibility for the legacy ACS-local
source that state and congressional-district simulations use: ACS group
quarters are outside the SPM measurement, and its ASEC/PUF records take the
certified SPM independence role. With 6.2.7, every SPM calculation on that
source stops with SPM_COMPOSITION_REQUIRED.

- Pin policyengine[models]==6.3.4 in pyproject.toml and the Dockerfile.
  The lockfile is regenerated once 6.3.4 is published; until then the lock
  check fails by design.
- 6.3.x certifies policyengine-uk 2.126.12. Update the exact installed
  catalog counts, measured with 6.3.1, which installs the same US 2.2.1
  and UK 2.126.12 models.
- The simulation API now reports a null poverty rate for a group with
  nobody measured (PovertyRateValue). Add a test that economic impact
  results keep those nulls when returned and stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
policyengine.py 6.3.4 is published. The lock moves policyengine 6.2.7 ->
6.3.4 and policyengine-uk 2.125.1 -> 2.126.12; policyengine-us 2.2.1 and
policyengine-core 3.33.0 are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk force-pushed the fix/3864-acs-local-regional-defaults branch from 4a9a0d9 to 962a786 Compare October 13, 2026 21:11

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.

State society-wide reports run on the sparse national dataset

1 participant