Skip to content

Commit 30e2c4f

Browse files
MaxGhenisclaude
andcommitted
Fix clear_parent_cache to also clear root node's cache
clear_parent_cache only cleared self._at_instant_cache inside the `if self.parent is not None` block, so root nodes (parent=None) never had their cache cleared. Move the clear() before the conditional so all nodes in the chain are invalidated. Confirmed: test_clone_update_invalidates_cloned_cache fails without this fix and passes with it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 69f24c0 commit 30e2c4f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

policyengine_core/parameters/parameter_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,6 @@ def attach_to_parent(self, parent: "ParameterNode"):
244244
self.parent = parent
245245

246246
def clear_parent_cache(self):
247+
self._at_instant_cache.clear()
247248
if self.parent is not None:
248249
self.parent.clear_parent_cache()
249-
self._at_instant_cache.clear()

0 commit comments

Comments
 (0)