even MORE code review

stateful to not deadhang, graph context -> output, more explicit state errors, other misc changes idfk any of those good thing theyre fixed tho
This commit is contained in:
lda
2026-05-26 02:33:41 +07:00 Verified
parent 9d11f78111
commit 95ec73d518
12 changed files with 159 additions and 14 deletions
+4 -2
View File
@@ -363,8 +363,10 @@ def _state_write_from_metadata(raw: object) -> StateWrite:
visible_value=visible_value,
reducer=ReducerRef.model_validate(reducer),
)
except Exception as exc:
raise WorkflowExecutionError("malformed pending foreach write") from exc
except WorkflowExecutionError:
raise
except (TypeError, ValueError) as exc:
raise WorkflowExecutionError(f"malformed pending foreach write: {exc}") from exc
def _state_write_to_metadata(write: StateWrite) -> dict[str, Any]:
+6
View File
@@ -216,7 +216,13 @@ def _lineage_chain(
) -> Iterator[LineageState]:
lineage = _lineage(run, scope_id=scope_id, lineage_id=lineage_id)
reverse_chain: list[LineageState] = []
seen: set[str] = set()
while True:
if lineage.id in seen:
raise WorkflowExecutionError(
f"cycle detected in lineage chain at {lineage.id!r}"
)
seen.add(lineage.id)
reverse_chain.append(lineage)
if lineage.parent_id is None:
break
+1
View File
@@ -253,6 +253,7 @@ def _finish_subgraph(
prepared.workflow,
child_scope.committed_state,
workflow_input=child_scope.workflow_input,
context=frame_context_values(child_frame),
)
validate_payload_against_schema(
prepared.workflow.output_schema,