more code review and plans
This commit is contained in:
@@ -92,6 +92,7 @@ def test_sync_concurrent_foreach_respects_max_active_by_refill_trace() -> None:
|
||||
]
|
||||
assert loop_entries[0].resolved_input["active_count"] == 0
|
||||
assert loop_entries[1].resolved_input["active_count"] == 1
|
||||
assert any(entry.resolved_input["active_count"] > 0 for entry in loop_entries)
|
||||
assert all(entry.resolved_input["active_count"] < 2 for entry in loop_entries)
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,13 @@ def test_foreach_barrier_tracks_active_and_outstanding_children() -> None:
|
||||
barrier = ForeachBarrierState()
|
||||
|
||||
barrier.start_child("child-0")
|
||||
assert barrier.active_frame_ids == ("child-0",)
|
||||
assert barrier.outstanding_frame_ids == ("child-0",)
|
||||
|
||||
barrier.start_child("child-1")
|
||||
assert barrier.active_frame_ids == ("child-0", "child-1")
|
||||
assert barrier.outstanding_frame_ids == ("child-0", "child-1")
|
||||
|
||||
barrier.finish_child("child-0")
|
||||
|
||||
assert barrier.active_frame_ids == ("child-1",)
|
||||
@@ -85,6 +91,23 @@ def test_foreach_barrier_rejects_duplicate_child_start() -> None:
|
||||
barrier.start_child("child-0")
|
||||
|
||||
|
||||
def test_foreach_barrier_rejects_finishing_unknown_child() -> None:
|
||||
barrier = ForeachBarrierState()
|
||||
|
||||
with pytest.raises(WorkflowExecutionError, match="not active"):
|
||||
barrier.finish_child("child-0")
|
||||
|
||||
|
||||
def test_foreach_barrier_rejects_duplicate_item_result() -> None:
|
||||
barrier = ForeachBarrierState()
|
||||
patch = StatePatch(changes={"state.count": 1})
|
||||
|
||||
barrier.add_success_patch(index=0, frame_id="child-0", patch=patch)
|
||||
|
||||
with pytest.raises(WorkflowExecutionError, match="already recorded"):
|
||||
barrier.add_success_patch(index=0, frame_id="child-0", patch=patch)
|
||||
|
||||
|
||||
def test_item_error_record_rejects_negative_index() -> None:
|
||||
with pytest.raises(WorkflowExecutionError, match="index"):
|
||||
ItemErrorRecord.from_metadata(
|
||||
|
||||
Reference in New Issue
Block a user