This commit is contained in:
lda
2026-05-22 18:03:32 +07:00 Verified
parent b4623beb1d
commit f4b650f78f
9 changed files with 223 additions and 110 deletions
@@ -95,11 +95,11 @@ Patch creation and commit must extract/reuse the existing node output
validation, output binding, and reducer logic. Concurrent foreach must not
create a second write system.
Current sync V1 implements the barrier commit path only for `loop -> one node ->
END` item bodies. The runtime includes an explicit no-op overlay seam
(`state_view_for_frame`) so the next slice can add lineage-local reads without
rewiring node execution. Until that seam becomes real, multi-step concurrent
item bodies are rejected instead of reading stale parent state.
Current sync execution supports item-local read overlays for concurrent foreach
item frames. `RunState.state` remains committed parent state, while
`state_view_for_frame` overlays the current item's buffered writes for reads by
later nodes in the same item lineage. Sibling overlays remain invisible until
the foreach barrier commits.
## Merge and Reducer Rules
@@ -287,6 +287,8 @@ Expected before implementation:
FAILED with "already recorded"
```
After this plan is implemented, both tests should pass.
- [ ] **Step 3: Replace duplicate rejection with patch merge**
In `src/wf_core/runtime/foreach_state.py`, change `add_success_patch(...)` to merge changes for the same item:
@@ -24,10 +24,9 @@ Already implemented:
- `ForeachBarrierState`, `PendingItemResult`, and `ItemErrorRecord` exist.
- Serial foreach progress now uses `ForeachBarrierState`.
- Sync `foreach(mode="concurrent")` runs with fail-only item policy, bounded
admission, deterministic interleaving, and barrier commits for single-node
item bodies.
- Item-local overlays are not implemented yet, so multi-step concurrent item
bodies remain rejected until Slice 2.
admission, deterministic interleaving, item-local overlays, and barrier
commits.
- Multi-step concurrent item bodies are supported for fail-only item policy.
## Non-Goals For Phase 4
@@ -58,9 +57,10 @@ Plan:
## Slice 2: Item-Local Overlays
Implement next because Slice 1 intentionally supports only `loop -> one node ->
END` item bodies. Overlays let later nodes in one item read earlier buffered
writes from the same item without exposing those writes to siblings.
Implemented after Slice 1 because fail-only concurrent foreach needed
lineage-local reads before multi-step item bodies could be supported. Overlays
let later nodes in one item read earlier buffered writes from the same item
without exposing those writes to siblings.
Scope: