Conversation
restore_simulation rebuilt each group entity's count from members_entity_id (max + 1) and the persons' count from the members of the last group entity restored. A group entity with no member was silently dropped from the restored count while still listed in ids, so calculations on the restored simulation returned arrays with missing entities — or, when a value had been stored for the group entity, restoring failed with a ValueError. A tax-benefit system with no group entity at all could not be restored (UnboundLocalError). Each entity's count is now restored from its own dumped ids, which also removes the person_count plumbing and the ordering constraint between the two restore passes. Same defect and fix as openfisca/openfisca-core#1387, from which this module was forked. Fixes PolicyEngine#547
This branch has not been 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 #547. Same defect and fix as openfisca/openfisca-core#1387, from which this module was forked.
restore_simulationrebuilt each group entity'scountfrommembers_entity_id(max + 1) and the persons'countfrom the members of the last group entity restored. A group entity with no member was silently dropped from the restoredcountwhile still listed inids, so calculations on the restored simulation returned arrays with missing entities — or, when a value had been stored for the group entity, restoring failed with aValueError. A tax-benefit system with no group entity at all could not be restored (UnboundLocalError).Each entity's
countis now restored from its own dumpedids, which also removes theperson_countplumbing and the ordering constraint between the two restore passes.Tests and checks run: two new tests in
tests/core/test_dump_restore.py, both failing before the fix; fulltests/suite (698 passed — 3 pre-existing failures intest_yaml.pyshell-script tests, environmental: thepolicyengine-coreCLI is not on PATH in my sandbox, failing identically without this change);ruff formatandruff checkclean; towncrier fragment added. Also run since opening:mypy --config-file mypy.inion the two changed files — no issues. The full-codebase run reports 83 pre-existing errors in 20 untouched files (possibly stub-related in my minimal environment). Not run:make documentation.Note on process: I don't have push access to the canonical repository, so this comes from a fork as offered in #547.