Repository navigation
Share one population-aggregate list and one known-period walker (Route A follow-up) - #1028
Merged
Merged
Conversation
PR-4 (post-export scoring) and PR-5 (batched target materialization) each defined the same four-variable population-aggregate list and a walker over an engine's known periods. They now share US_POPULATION_AGGREGATE_VARIABLES and _engine_known_periods. The shared walker is the superset: live branches, the branches target materialization records before they are detached, and a reform= engine's baseline. policyengine-core sets baseline only when reform= is passed (simulation.py:247-253), and the post-export scorer passes the reform's tax_benefit_system alone, so post-export scoring behaves exactly as before. Both list-pinning scans are kept; they use different markers. Tests: - The known-period walker returns exactly what an independent breadth-first walk over random engine graphs (cycles allowed) finds. Dropping any of its three links fails the test. - Both refusal paths see a value held only on baseline. The docs now say an assembled table needs a complete, non-null <entity>_source_id (#992 round 8) and name the shared list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wheels CI job installs the built packages into a clean venv without test extras, so a module-level Hypothesis import failed collection of the whole post-export test file. The property test now imports it with pytest.importorskip: the workspace jobs (uv sync --all-packages, which brings Hypothesis through microcosm-graph) still run it, and an environment without it skips just that test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Sep 26, 2026
Brings in the 19 main merges since 6442030: the Route A remediation stack (#1016, #1018, #1017, #1025, #1024, #1028), #1029, #1005, #1008, #1004, #992, #1031, #1015, #1033, #994, #954, #966, #1006 and #1010. Eight conflicted paths, each recorded in docs/native-integration-20260923.md: - test.yml keeps the native sharded matrix (main's --durations=25 is already in every native pytest call); - the us_runtime facade stays lazy and gains main's three fiscal-target exclusion exports (the parent union, 920 names; the facade-union test is re-pinned to that union's digest); - reform_validation.py keeps main's _released_engine_state and the native explicit-constructor default_simulate_factory; - build_us_fiscal_refresh_release.py carries the native explicit consumer seams (formula metadata, dataset and microsimulation constructors, SPM selection) onto main's household-batched post-export scorer and batched base materialization; omitted seams keep main's exact calls, and _main supplies none. Three native test files that addressed the removed frame-based factory now address the scorer with the same assertions; - identity pins observed on the merged tree: five EXPECTED_HASHES entries, the regenerated F0 coverage report (42,239/42,239 fields, 41/41 checks), the US spec identity 2dfa51b8... and the loader golden f2047cb9... tools/generate_us_bundle_from_constants.py --check, tools/ci_test_groups.py --verify, the CI matrix contract and ruff pass. The fiscal consumer, formula-metadata, shared target/solve and calibration-attachment files pass; the rest of the fiscal battery and the known pre-existing failures are follow-up work on this branch. No actual-data native run, release certification or publication. 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.
Follow-up to PR-4 (#1025) and PR-5 (#1024), as #1025's body promised. It also fixes one docs sentence left stale by #992. No behaviour change for either scoring path.
What changes
US_POPULATION_AGGREGATE_VARIABLESis the single population-aggregate list.POST_EXPORT_POPULATION_AGGREGATE_VARIABLES, an identical tuple, is gone._engine_known_periodsserves both batched target materialization and post-export scoring;_post_export_known_periodsis gone.reform=engine'sbaseline.baselineonly whenreform=is passed (simulation.py:247-253), and the scorer passes the reform'stax_benefit_systemalone (_construct). So a post-export engine has nobaselineto follow, and it never carries the recorded-branch list.docs/us-release-build-rule.md):<entity>_source_id. This is whatrequire_assembled_support_provenancechecks since Handle the capital-gains tail clone in release stages on a PUF-support base #992 round 8.Invariant
For any graph of engines linked by live branches, recorded detached branches and
baseline, cycles included,_engine_known_periods(root, watched)returns exactly the known(variable, str(period))pairs of the watched variables in every engine reachable from the root.A Hypothesis test (
test_known_period_walker_matches_a_reference_traversal, 200 examples) checks this against an independent breadth-first walk. Dropping any one of the three links makes it fail, and each was tried.Tests
test_us_post_export_scoring.py: 35 passed (fast), plus 3 slow real-engine tests. The walker property and the baseline-only refusal test also pass on the final head.test_us_fiscal_refresh_builder.py: 313 passed, 2 skipped.test_target_materialization.py: 46 passed.test_us_batched_target_materialization.py: 41 passed, including the new baseline-only refusal test, which fails when the walker'sbaselinestep is removed.ruff check,ruff format --checkandtools/ci_test_groups.py --verifyare clean.pytest.importorskip. The wheels CI job installs no test extras and skips it; with a stubhypothesisthat raises ImportError, the file still collects.🤖 Generated with Claude Code