Repository navigation
Conversation
API v1's economy requests send its installed .py version as policyengine_version, and the simulation service runs each request on the app it deployed for that version; the /v2/ routes read that version's catalog. Releases before 6.20.4 rank households with equal incomes with numpy's default sort, whose order depends on the CPU. This test fails on the 6.20.0 pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changelog fragment names the stable inequality sort and the policyengine-uk, policyengine-core and UK data release changes from 6.20.1 to 6.20.3. The dynamic parameters' docstring names the installed policyengine-uk version, whose gov.dynamic. folder is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changelog fragment says policyengine-core's reform and caching fixes may also change some US household results, and that the /v2/ model catalog gets a 6.20.4 version for both countries. The docstring states the range of policyengine-uk versions it was checked against, so the next bundle update doesn't make it wrong. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uv.lock is master's, relocked with uv lock --upgrade-package policyengine as the bundle update workflow does: policyengine 6.20.4, policyengine-core 3.34.10 and policyengine-uk 2.179.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
master moved the simulation client pin to 0.20261201.454, and its lock conflicted with this branch's. uv.lock is master's lock relocked with `uv lock --upgrade-package policyengine`, so it differs from master's only in policyengine 6.20.4, policyengine-core 3.34.10 and policyengine-uk 2.179.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…puts API v1 sends its installed .py version with each economy request, and the simulation service runs the request on that version's app. From .py 6.0.0 to 6.20.4, a US simulation built from a dataset doesn't list the dataset's columns in input_variables, so policyengine-us's marginal_tax_rate copies delete them and target=cliff results count the lost income as cliff gaps. This test fails until API v1 pins the release that fixes it (expected 6.20.5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nputs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe marginal_tax_rate's branch exactly (the two highest earners, and the lost age and location as well as income), say that 6.20.5 is the expected release until the fix is published, drop the fragment's labor supply claim until the release is checked, and give the fragment a name the bundle workflow's fragment for the same release won't share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Write the docstring relative to FIRST_RELEASE_RECORDING_DATASET_INPUTS, name the fragment in the constant's comment, and describe marginal_tax_rate's adults and the lost inputs exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4381 +/- ##
==========================================
- Coverage 93.90% 93.88% -0.03%
==========================================
Files 459 459
Lines 26172 26172
Branches 4047 4047
==========================================
- Hits 24578 24571 -7
- Misses 909 916 +7
Partials 685 685
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was previously deployed
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 #4380
Do not merge: raise the .py pin (
pyproject.toml,docker/Dockerfile,uv.lock) to the .py release that contains the dataset-inputs fix (expected 6.20.5), and setFIRST_RELEASE_RECORDING_DATASET_INPUTSand the changelog fragment to that release (this PR's own step, once the release is published).Summary
This moves API v1 onto the .py release that lists a US dataset's inputs in
input_variables(expected 6.20.5). From .py 6.0.0 to 6.20.4,PolicyEngineUSLatest.runbuilt a US simulation empty and stored each dataset column withset_input, so policyengine-core'sinput_variables, which it fills only when the simulation is constructed, didn't list them. policyengine-us'smarginal_tax_raterecalculates each adult's income in a branch of the simulation that deletes every variable not in that list, so the branch lost the household's income other than earnings, its age and its location, andcliff_gapcounted the lost income as a cliff gap.API v1's
target=cliffeconomy results come from the simulation service, which runs .py on the version API v1 sends aspolicyengine_version(its installedPOLICYENGINE_VERSION). API v1 has run .py 6.x since 2026-09-29, so its cliff results have shown the inflated gaps since then. They're correct only once API v1 sends the fixed release, which is what this PR does. API v1's/v2/routes read the model catalog for the same installed version.The pin raise itself isn't in this PR yet: the release isn't published. Until it is, the PR holds the test that fails before the raise and the changelog fragment. Once .py publishes the release, this PR checks that the release's history contains the fix's merge, raises both pins and relocks (
uv lock --upgrade-package policyengine), setsFIRST_RELEASE_RECORDING_DATASET_INPUTSand the changelog fragment to that version, adds to the fragment anything else the release changes for API v1, and removes the "Do not merge" line. The bundle update workflow will open its own "Update PolicyEngine bundle to " PR for the same release; that one gets closed without merging, as a duplicate of this PR.This branch is built on #4377 (
auto/update-policyengine-bundle-6.20.4, .py 6.20.0 → 6.20.4), which changes the same pins first. Until #4377 merges, this PR's diff includes its commits.What the merge waits for
Tracker tasks before this one (D5 · 13 in "5. Detailed-save API"), and what each must reach:
latestto be that version.CI until then:
masterdeploy stops at "Ensure staging model version aligns with simulation API" until this PR merges, so it merges soon after D5 · 12 reaches production.Stored economy results
API v1 keeps economy results in its Redis cache (
runtime_cache/reform_impacts.py), each for at most 30 days. The cache version (constants._build_runtime_cache_version) and the economy options hash (_build_options_hash) both include the .py version, so after the raise no request reads a result calculated on 6.x, and each such result expires within 30 days of being written. Nothing is deleted by hand.Changes
tests/unit/test_constants.py: a new test checks thatPOLICYENGINE_VERSION, the version API v1 sends aspolicyengine_version, is at leastFIRST_RELEASE_RECORDING_DATASET_INPUTS(6.20.5 until the release is published), the first release that records dataset inputs. A neighbouring test from Update PolicyEngine bundle to 6.20.4 #4377 already checks that this version equals the installed one, which the/v2/routes read.changelog.d/py-dataset-inputs.fixed.md: the fix, for people who use or run API v1. Its name differs from the bundle workflow'supdate-policyengine-bundle-<version>.changed.md.pyproject.toml,docker/Dockerfile,uv.lock.Tests
tests/unit/test_constants.py::TestPolicyEngineBundleVersions::test__requests_name_a_release_that_records_dataset_inputs. On the 6.20.4 pin (c6eab652) it fails on its assertion:assert <Version('6.20.4')> >= <Version('6.20.5')>. It's run again after the raise.make quality(the commit hook) passed on every commit;check_changelog_fragment.shagainstmasterpasses. No other tests were run locally.Review
Two rounds of adversarial review, each by a subagent working only from the code (files kept outside the repository).
update-policyengine-bundle-6.20.5.fixed.md, matched the bundle workflow's fragment for the same release. Fixes: the constant's comment says 6.20.5 is expected and the pin raise sets it to the release that contains the fix; the labor supply claim is removed; the fragment is renamedpy-dataset-inputs.fixed.md; the docstring describesmarginal_tax_rate's branch exactly.FIRST_RELEASE_RECORDING_DATASET_INPUTS, the constant's comment names the fragment, and the wording names the adultsmarginal_tax_rateraises (the two with the highest market income).Environment variables
This PR adds or changes no environment variable, secret or workflow.
🤖 Generated with Claude Code