Skip to content

Fix subsampling with formula-backed structural IDs#499

Merged
anth-volk merged 1 commit into
masterfrom
fix/subsample-structural-ids
May 21, 2026
Merged

Fix subsampling with formula-backed structural IDs#499
anth-volk merged 1 commit into
masterfrom
fix/subsample-structural-ids

Conversation

@anth-volk
Copy link
Copy Markdown
Collaborator

Fixes #498

Summary

  • Use the full computed-variable export path inside Simulation.subsample() so internal dataset rebuilds preserve structural IDs such as formula-backed person_id.
  • Add a synthetic regression test where the safe public export drops person_id__2022, but subsampling still succeeds.
  • Add a towncrier bugfix fragment.

Tests

  • uv run --frozen pytest tests/core/test_subsample_invalidates_cache.py -v
  • uv run --frozen pytest tests/core/test_simulations.py::test__given_pseudo_input_in_dataset__then_input_dataframe_excludes_it -v
  • uv run --frozen ruff check policyengine_core/simulations/simulation.py tests/core/test_subsample_invalidates_cache.py
  • uv run --frozen ruff format --check policyengine_core/simulations/simulation.py tests/core/test_subsample_invalidates_cache.py

@anth-volk anth-volk marked this pull request as ready for review May 21, 2026 17:59
@anth-volk anth-volk merged commit faf5145 into master May 21, 2026
23 checks passed
@anth-volk anth-volk deleted the fix/subsample-structural-ids branch May 21, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix subsampling when structural IDs are formula-backed

1 participant