Repository navigation
chore(deps): update policyengine to 6.20.4 - #1169
Merged
Merged
Conversation
Rebuild UK frames as Stage 12's aggregation does and run the inequality calculation the UK economic impact analysis runs, then read the values build_inequality reports. With twenty copies of one household at the top 10% and top 1% cutoffs, the shares must follow the order of the copies' rows. Rows in household_id order must give exactly the Gini of the same rows listed by income with ties kept in row order, and the same shares to 1e-12 relative: each share divides by the total income summed in the rows' own order, which differs between the two lists in the last bits. .py 6.20.0 ranks incomes with numpy's default sort, which reorders equal values, so all twelve cases fail on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ity test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since .py 6.20.1 the UK release pins each file in Microcosm's build folders to the Hugging Face commit that published it, so the local-area dataset's revision is a 40-character commit hash, not a microcosm-uk-2024-25-dense-… tag name. The test still checks that it is the revision the installed release manifest records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The raise from 6.20.0 brings in the stable inequality sort and, from 6.20.1 to 6.20.3, a new UK model, core package and certified UK datasets, with new UK label forms. API v1 keeps requesting its own .py version until it raises its pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changelog fragment says the top shares differed between hosts, by up to 9.8e-5 relative in one check, rather than between runs, and that policyengine-core's reform and caching fixes apply to US simulations too. The row-order tests' docstring writes "API v1's calculation". The reported_data_version docstring says the UK national and local-area revisions are Hugging Face commits since .py 6.20.1, as the US one has been since 6.20.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1168
Summary
Update .py (
policyengine) from 6.20.0 to 6.20.4 in the simulation service. The executor's twopolicyengine[models]pins (the project's dependencies and themodal-simulation-imagegroup) anduv.lockmove to 6.20.4. The executor's Docker image and every Modal image install from that lock, so requests for .py 6.20.4 run on it.6.20.4 (PolicyEngine/policyengine.py#777) ranks households with equal incomes in the order of their rows when it calculates the Gini coefficient and the top 10% and top 1% income shares. Before, numpy's default sort put tied households in an order that depends on the CPU, so the same UK report could give different top shares on different hosts (in one check of 20 UK values, up to 9.8e-5 relative apart) and Gini values that differed in their last bits. With 6.20.4 the same rows give the same values on every host.
This PR started as the automated update PR; it adds a test, a test fix and a fuller changelog fragment.
What the update brings in
The pin moves from 6.20.0, so the update also brings in 6.20.1 to 6.20.3:
Inequality.runand its Gini calculation. The bundle manifest changes only its version labels.uk-frs-calibration-attempt-20261122T100732Z-b891aa69, built with policyengine-uk 2.179.2.What changes for the simulation service:
microcosm_uk_2024_25, SHA-256ae116bc3…) and local-area (microcosm_uk_2024_25_dense, SHA-256cf1c98ac…) datasets.data_versionbecomesuk-frs-calibration-attempt-20261122T100732Z-b891aa69(wasmicrocosm-uk-2024-25-national-20261107T020434Z-eeb6093e). The UK datasets' revisions are 40-character Hugging Face commit hashes instead of tag names, so a UK-wide or nation report on the local-area dataset is labelled with one; US revisions have been commit hashes since 6.20.0.The bundle the update installs, as the automated update read it from the 6.20.4 wheel:
Tests
_dataset_from_frames,PrecomputedSimulation), runcalculate_uk_inequality(what the UKeconomic_impact_analysisruns for each simulation) and read the valuesbuild_inequalityreports.household_idorder (as Stage 12 stores them) give exactly the Gini, and the shares to 1e-12 relative, of the same rows listed by income with ties kept in row order. Each share divides by the total income summed in the rows' own order, so the two lists differ in the last bits; a different ranking of tied households at a cutoff moves a share by about 1e-4 relative or more.mainwith .py 6.20.0, where all 12 cases failed on an arm64 Mac with numpy 2.4.4. With the light copies first the top 10% share came out 0.2037 instead of 0.2222; with the heavy copies first the top 1% share 0.0741 instead of 0.0370; the seeded cases differed in the Gini and by 5e-4 to 0.33 relative in the shares. After the update all 12 pass.test_the_installed_bundle_routes_area_regions_to_the_dense_datasetexpected the local-area dataset's revision to start withmicrocosm-uk-2024-25-dense-. Since 6.20.1 it is a commit hash; the test now checks for one, and still checks that it equals the installed release manifest's revision. This was the one executor test failure on the automated 6.20.1 to 6.20.3 PRs.uv lock --checkpass.Review
One round of adversarial review (a read-only reviewer) found no bugs. Its four wording findings are fixed in the last commit: the changelog fragment now says the top shares differed between hosts, and that policyengine-core's fixes reach US simulations too; the new test module says "API v1's calculation"; and
reported_data_version's docstring says the UK revisions are commit hashes since .py 6.20.1. No bugs are left.What the merge waits for
mainafter it and needs nothing its deployment produces.API v1 and the order of merges
/v2/routes select by the same version. So API v1, and through it API v2, moves onto 6.20.4 only in API v1's own update, Update PolicyEngine bundle to 6.20.4 policyengine-api#4377 (D5 · 9 in the migration plan). This PR changes only the simulation service.policyengine.latestat/versions. Once this PR deploys and staging'slatestis 6.20.4, API v1masterdeploys stop at that check until Update PolicyEngine bundle to 6.20.4 policyengine-api#4377 merges, and that PR's own check fails until staging serves 6.20.4. So Update PolicyEngine bundle to 6.20.4 policyengine-api#4377 should be reviewed and ready before this PR merges, and merge as soon as this PR is deployed.Deployment and environment variables
uv.lock.policyengine/populace-uk-private) and are read with the existing credential: the GitHub Actions secretPE_UK_PRIVATE_HF_READ_TOKEN, which the deploy workflow validates and copies to the Modal secretpe-uk-private-hf-read-token.The earlier automated update PRs, #1080 (6.20.1), #1084 (6.20.2) and #1116 (6.20.3), are superseded by this one.
🤖 Generated with Claude Code