Repository navigation
Fix validation of saved multi-year datasets - #2420
Conversation
|
Handoff for independent hub review. Head: Tests: Impact: two schema validators only; Budget W1's The hub handoff in |
|
UK hub merge audit, head
|
Fixes #2416
Files saved by
UKMultiYearDataset.savewere rejected by the multi-year validator, then accepted as single-year tables, where loading raisedTypeError. Inpolicyengine_uk/data/dataset_schema.py:35, the single-year validator now requires pandas table metadata. Inpolicyengine_uk/data/dataset_schema.py:318, the multi-year validator walks each entity group's year-named pandas children instead of looking for slashes in top-level h5py keys.Invariants: saved single-year and multi-year layouts pass exactly one validator, including a multi-year layout containing only one year. Existing error text and
raise_exceptiondefaults are preserved. Ordinary single-year loading is retained. The formerly stubbed local-file test now exercises save, validation, dispatch, and calculated inputs; Hypothesis checks random year sets for both layouts.Ownership: Budget W1 owns
simulation.py; this fix leaves it untouched and limits production changes to the schema validators.Reproducer: policyengine_uk/tests/test_simulation_dataset_sources.py::test_build_from_file_loads_local_multi_year_dataset
Validation:
uv run --frozen --no-sync pytest policyengine_uk/tests/test_simulation_dataset_sources.py policyengine_uk/tests/test_dataset_fiscal_year.py -n 4 -q— 16 passed.uv run --frozen --no-sync make formatanduvx ruff format --check .pass.26b2f908d2e0f472b1703da75a8310b210951d4a803bd6839a6a53bba95857ff. The script and JSON evidence are retained in.job/for the hub handoff.No full suite or real-data microsimulation: this is schema dispatch and the MOCK default differential is unchanged. Documentation build omitted for the small prose addition to the existing dataset instructions.
axiom: n/a: H5 dataset schema validation infrastructure
Independent review is left to the hub. Do not merge as part of this job.