Repository navigation
Conversation
…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.77% -0.14%
==========================================
Files 459 459
Lines 26172 26644 +472
Branches 4047 4149 +102
==========================================
+ Hits 24578 24986 +408
- Misses 909 954 +45
- Partials 685 704 +19
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:
|
Raise policyengine[models] from 6.20.4 to 6.20.5 in pyproject.toml and docker/Dockerfile and relock (uv lock --upgrade-package policyengine). 6.20.5 holds only PolicyEngine/policyengine.py#783, which lists a US dataset's stored columns in input_variables; the bundle's other package versions and data releases are unchanged. Cite #783 in the test's constant and name the labor supply change in the changelog fragment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The only conflict was uv.lock's policyengine-api requirements: it keeps this branch's .py 6.20.5 pin and master's simulation client 0.20261202.458. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch had an error being 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
Summary
This raises API v1's .py pin (
policyengine[models]) from 6.20.4 to 6.20.5. 6.20.5 holds only PolicyEngine/policyengine.py#783, which lists a US dataset's stored columns ininput_variables. 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 most of them. policyengine-us'smarginal_tax_raterecalculates household net 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 once API v1 sends 6.20.5, which is what this PR does. API v1's/v2/routes read the model catalog for the same installed version.This PR replaces the bundle workflow's PR for the same release (#4390), which is closed without merging.
What 6.20.5 changes for API v1
marginal_tax_ratekeeps the household's inputs, sotarget=cliffresults no longer count lost income as cliff gaps. In .py's example, a 67-year-old in Wake County, North Carolina, with $15,000 of earnings and $24,000 of Social Security in 2026 had acliff_gapof $22,645; it is now policyengine-us's $0.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.20.4 or earlier, and each such result expires within 30 days of being written. Nothing is deleted by hand./v2/model catalog: themasterdeploy's "Seed and validate the v2 metadata catalog" step publishes the 6.20.5 catalog before Cloud Run deploys, as for every bundle update.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.Changes
pyproject.toml,docker/Dockerfile,uv.lock: .py 6.20.4 → 6.20.5 (uv lock --upgrade-package policyengine). The lock'spolicyenginechanges are the same as the bundle workflow's (Update PolicyEngine bundle to 6.20.5 #4390).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), 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.Tests
tests/unit/test_constants.py::TestPolicyEngineBundleVersions::test__requests_name_a_release_that_records_dataset_inputs, run by its node ID:c6eab652), where it fails on its assertion:assert <Version('6.20.4')> >= <Version('6.20.5')>. CI's shard 6 at24815f9cfailed on the same assertion, and only on it (2,150 other tests passed);5491248f), it passes.make quality(the commit hook) passed on every commit, anduv lock --checkpasses.check_changelog_fragment.shagainstmasterpasses. No other tests were run locally.Review
Two rounds of adversarial review before the PR opened, 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 version stayed an assumption until the raise, which checked that 6.20.5 holds Update PolicyEngine US to 0.479.1 #783 and nothing else; the labor supply claim was removed until .py's 6.20.5 changelog measured it; the fragment was renamedpy-dataset-inputs.fixed.md; the docstring describesmarginal_tax_rate's branch exactly.FIRST_RELEASE_RECORDING_DATASET_INPUTS, and the wording names the adultsmarginal_tax_rateraises (the two with the highest market income).5491248f) was added after the review rounds, as planned; its lock change matches the bundle workflow's.Environment variables
This PR adds or changes no environment variable, secret or workflow. After merging, the deploy's catalog step reads the same variables as every bundle update (
V2_DATA_WRITE_DATABASE_URL,HUGGING_FACE_TOKENfromPE_UK_PRIVATE_HF_READ_TOKEN,SIMULATION_ENTRYPOINT_URL; GitHub Actions secrets wired throughpush.yml'ssecrets: inherit), and 6.20.5 changes no data release they read.🤖 Generated with Claude Code