Skip to content

Fix uprating of cloned parameter subtrees#492

Merged
MaxGhenis merged 1 commit into
masterfrom
fix/uprating-cloned-subtrees
May 14, 2026
Merged

Fix uprating of cloned parameter subtrees#492
MaxGhenis merged 1 commit into
masterfrom
fix/uprating-cloned-subtrees

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

@MaxGhenis MaxGhenis commented May 14, 2026

Summary

  • Follow-up to Anthony's comment on Fix cache preservation and uprating order #491: Fix cache preservation and uprating order #491 (comment)
  • Tracks uprating dependency sort traversal by parameter object identity so cloned subtrees with duplicate .name values are not skipped.
  • Builds actual parameter paths from the root tree so cloned descendants resolve uprating metadata inside their current clone path when the dependency belonged to the cloned original prefix.
  • Keeps root-scoped external dependencies root-scoped for reattached non-root clones, so clone-local parameter names do not silently shadow absolute upraters outside the cloned subtree.
  • Avoids treating ordinary ParameterNodes with a child named brackets as scale objects during path traversal.
  • Adds regressions for duplicate-name cloned subtrees, divergent baseline upraters after root mutation, reattached child-subtree clones preserving original parameter names, absolute external uprater paths inside reattached clones, and nodes with a brackets child name.

TDD / verification

  • Confirmed the duplicate-name cloned-subtree regression failed before the first patch.
  • Confirmed the divergent baseline-uprater regression failed before the scoped-resolution patch.
  • Confirmed the reattached child-subtree clone regression failed before the original-to-current path mapping patch.
  • Confirmed the external-root-uprater regression failed before limiting remaps to the original cloned prefix.
  • Confirmed the brackets child-name regression matched the downstream policyengine-us CI failure before the path traversal fix.
  • uv run --no-sync pytest tests/core/parameters/operations/test_uprating.py::test_parameter_uprating_processes_cloned_subtrees_with_duplicate_names -q
  • uv run --no-sync pytest tests/core/parameters/operations/test_uprating.py::test_parameter_uprating_uses_cloned_subtree_upraters -q
  • uv run --no-sync pytest tests/core/parameters/operations/test_uprating.py::test_parameter_uprating_uses_reattached_cloned_subtree_upraters -q
  • uv run --no-sync pytest tests/core/parameters/operations/test_uprating.py::test_parameter_uprating_keeps_external_upraters_root_scoped_in_clones -q
  • uv run --no-sync pytest tests/core/parameters/operations/test_uprating.py::test_parameter_uprating_handles_nodes_with_brackets_child_name -q
  • uv run --no-sync pytest tests/core/parameters/operations/test_uprating.py -q
  • uv run --no-sync ruff check policyengine_core/parameters/operations/uprate_parameters.py tests/core/parameters/operations/test_uprating.py
  • uv run --no-sync ruff format --check policyengine_core/parameters/operations/uprate_parameters.py tests/core/parameters/operations/test_uprating.py
  • uv run --no-sync --with policyengine-us --with policyengine-uk --with pytest-rerunfailures python -m pytest -m smoke --reruns 2 --reruns-delay 5 -v -s tests/smoke/test_country_init.py
  • uv run --no-sync pytest -q

@MaxGhenis MaxGhenis force-pushed the fix/uprating-cloned-subtrees branch 3 times, most recently from e3cf919 to 2589894 Compare May 14, 2026 23:20
@MaxGhenis MaxGhenis force-pushed the fix/uprating-cloned-subtrees branch from 2589894 to 1887743 Compare May 14, 2026 23:26
@MaxGhenis MaxGhenis merged commit f492657 into master May 14, 2026
23 checks passed
@MaxGhenis MaxGhenis deleted the fix/uprating-cloned-subtrees branch May 14, 2026 23:32
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.

1 participant