overlay reads + reducer write metadata

according to chat it is so i myself idk
This commit is contained in:
lda
2026-05-24 22:18:08 +07:00 Verified
parent 39b473ea25
commit 845fc7e921
4 changed files with 107 additions and 17 deletions
+2 -4
View File
@@ -3,7 +3,6 @@ from __future__ import annotations
from copy import deepcopy
from typing import Any
from wf_core.paths import StatePath
from wf_core.run_state import ExecutionFrame, RunState
from wf_core.runtime.foreach_state import ForeachBarrierState, item_frame_owner
from wf_core.runtime.ops.state import safe_set_nested_value
@@ -33,7 +32,6 @@ def state_view_for_frame(run: RunState, frame: ExecutionFrame) -> dict[str, Any]
# Correctness first: this full copy isolates sibling reads. If state grows
# large, replace this with a lazy/copy-on-write overlay.
state_view = deepcopy(run.state)
for destination, value in pending.patch.changes.items():
path = StatePath.parse(destination)
safe_set_nested_value(state_view, list(path.parts), value)
for write in pending.patch.writes:
safe_set_nested_value(state_view, list(write.path.parts), write.visible_value)
return state_view