Repository navigation
Revert "Refuse dataset years the country model does not project to (#730)" - #742
Merged
Merged
Conversation
)" This reverts commit 1858172. The supported dataset years will be defined as constants in the Public API, which refuses any other year with a 400 response before a job starts, so .py no longer checks requested years itself (#741). This removes policyengine.provenance.supported_years, UnsupportedDatasetYearError, refuse_unsupported_years and the allow_unsupported_years argument of the UK and US create_datasets and ensure_datasets. Those functions create year files for any requested year again, including US years before a dataset's data year, such as 2022 and 2023 for populace_us_2024, which holds almost no data for them. The UK qualification check and execution receipts go back to their own copies of the UK year rule, and docs/microsim.md no longer has a "Supported years" section. Adds changelog.d/741.removed.md. 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 #741
Reverts #730 (issue #729), released in .py 6.13.0 and 6.14.0. The supported dataset years will be defined as constants in the Public API, which refuses any other year with a 400 response before a job starts, so .py goes back to creating year files for any requested year.
Summary
git revert 18581729applied tomainwithout conflicts. Every file #730 changed is now identical to its state before #730, except #730's two changelog fragments, which the 6.13.0 release had already removed.Removed:
policyengine.provenance.dataset_years, withsupported_years(country_id, dataset_path),refuse_unsupported_yearsandUnsupportedDatasetYearError, and their exports frompolicyengine.provenance;allow_unsupported_yearsargument of the UK and UScreate_datasetsandensure_datasets, and the year check those functions ran before creating year files;docs/microsim.md;tests/test_dataset_years.py, and theallow_unsupported_yearskeyword in thecreate_datasetsmocks intests/test_release_manifests.pyandtests/test_us_year_file_stamp.py.Added
changelog.d/741.removed.md.Behaviour change for .py users
create_datasetsandensure_datasetsno longer raiseUnsupportedDatasetYearError. Code that imports it, callssupported_yearsor passesallow_unsupported_yearshas to drop those.populace_us_2024those are 2022 and 2023, for which the certified dataset holds almost no data (see Refuse dataset years the country model does not project the dataset to #729). Years after the end of policyengine-us's projection are also created again, from inputs policyengine-core carries forward or uprates.No dataset found for year ...instead ofUnsupportedDatasetYearError.uk_candidate.projected_years_from_modeland thesupported_yearscheck that uses it) and execution receipts (receipt._projected_years) go back to their own year rules from before Refuse dataset years the country model does not project to #730. Like Refuse dataset years the country model does not project to #730's UK rule, they build the projection with policyengine-uk'sextend_single_year_datasetand keep the years from the data year onwards, so the years they record do not change.supported_yearsstill appears inqualification.py,uk_candidate.py,receipt.py, the execution-receipt and replay-receipt schemas,docs/receipts.md,replay_policy.mdand their tests and fixtures. All 157 matching lines insrc/,scripts/,docs/andtests/are identical to the tree before #730, so none of them came from #730.Related
#735 (issue #734) builds on #730 and will be closed.
Environment variables
No environment variables are added or changed, and no workflow, Dockerfile or deployment file changes. The deleted
tests/test_dataset_years.pywas the only reader of the optionalPOLICYENGINE_UK_DEFAULT_DATASETandPOLICYENGINE_US_DEFAULT_DATASET, which no workflow sets.Tests
Run locally in the locked environment (
uv sync --frozen --extra dev, Python 3.14.6), each test selected by node ID:tests/test_release_manifests.py::TestReleaseManifests::test__given_us_ensure_datasets_without_dataset__then_uses_certified_default: passed. The revert removedallow_unsupported_years=Falsefrom its expectedcreate_datasetscall.tests/test_us_year_file_stamp.py::test_ensure_cuts_again_exactly_when_load_would_refuse: passed. It checks thatensure_datasetsrecreates year files exactly whenload_datasetswould refuse them, and it is the only user of_create_current_files, thecreate_datasetsstand-in whoseallow_unsupported_yearsparameter the revert removed.Other checks:
python -c "import policyengine; import policyengine.provenance"succeeds.policyengine.provenanceno longer hassupported_yearsorUnsupportedDatasetYearError, andpolicyengine.provenance.dataset_yearsno longer exists.uv run ruff format --checkon the seven changed Python files passes.uv run ruff check(locked ruff 0.12.11) on them reports only the 42UP038findings inreceipt.pythatmainalso has;ruff check --ignore UP038passes.towncrier check --compare-with origin/mainfindschangelog.d/741.removed.md, and.github/check-agent-notes.sh HEADpasses.tests/test_dataset_years.pyis deleted, so it was not run. No other tests were run locally.🤖 Generated with Claude Code