Drop temporary CPS take-up anchors from H5 outputs#964
Merged
Conversation
5bbd373 to
d1ce64f
Compare
d1ce64f to
19d9bda
Compare
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.
Summary
Where this broke
The prior production data run was Run Pipeline 25751771946, for commit
d4871933/ version1.112.3. That GitHub job completed because it only launched the Modal pipeline, but the Modal eCPS checkpoint from that run contained the temporary source anchorssnap_reportedandssi_reported.With this PR's validator, that checkpointed H5 fails before upload:
The root cause is that
Dataset.save_datasetappends/overwrites H5 keys but does not delete keys that were popped from the in-memory dict.Tests
uv run ruff format policyengine_us_data/datasets/cps/cps.py policyengine_us_data/storage/upload_completed_datasets.py policyengine_us_data/stage_contracts/dataset_build.py modal_app/data_build.py tests/integration/test_cps_generation.py tests/unit/test_upload_completed_datasets.py tests/unit/test_modal_data_build.py tests/unit/test_dataset_build_stage_contract.pyuv run ruff check policyengine_us_data/datasets/cps/cps.py policyengine_us_data/storage/upload_completed_datasets.py policyengine_us_data/stage_contracts/dataset_build.py modal_app/data_build.py tests/integration/test_cps_generation.py tests/unit/test_upload_completed_datasets.py tests/unit/test_modal_data_build.py tests/unit/test_dataset_build_stage_contract.pyuv run pytest tests/integration/test_cps_generation.py::test_add_takeup_removes_temporary_source_anchors_from_saved_h5 tests/integration/test_cps_generation.py::test_drop_persisted_dataset_variables_removes_stale_h5_keys tests/unit/test_upload_completed_datasets.py::test_validate_dataset_rejects_temporary_reported_source_variables -quv run pytest tests/unit/test_dataset_build_stage_contract.py tests/unit/test_modal_data_build.py tests/unit/test_upload_completed_datasets.py tests/integration/test_cps_generation.py tests/unit/datasets/test_cps_takeup.py -q