sudden coderabbit review fixes

This commit is contained in:
lda
2026-05-21 17:08:26 +07:00 Verified
parent 7eff7cda2a
commit abf41677a6
8 changed files with 68 additions and 6 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ def execute_workflow(
run = create_run_state(workflow, workflow_input)
try:
run = prepare_new_run(workflow, workflow_input)
prepare_new_run(workflow, workflow_input, run)
return resume_workflow(workflow, run, registry, reducers=reducers)
except Exception as exc:
run.status = RunStatus.FAILED
@@ -46,7 +46,7 @@ async def execute_workflow_async(
run = create_run_state(workflow, workflow_input)
try:
run = prepare_new_run(workflow, workflow_input)
prepare_new_run(workflow, workflow_input, run)
return await resume_workflow_async(workflow, run, registry, reducers=reducers)
except Exception as exc:
run.status = RunStatus.FAILED
+5 -3
View File
@@ -9,15 +9,17 @@ from wf_core.runtime.ops.frames import collapse_completed_frames
from wf_core.runtime.ops.index import WorkflowIndex, build_workflow_index
from wf_core.runtime.ops.interrupts import resume_interrupt
from wf_core.runtime.ops.merges import ReducerDefinition
from wf_core.runtime.ops.runs import create_run_state
from wf_core.runtime.ops.schemas import validate_payload_against_schema
from wf_core.run_state import FrameStatus, RunState, RunStatus
from wf_core.tokens import END
def prepare_new_run(workflow: Workflow, workflow_input: dict[str, Any]) -> RunState:
def prepare_new_run(
workflow: Workflow,
workflow_input: dict[str, Any],
run: RunState,
) -> RunState:
"""Create and validate a fresh run state for a workflow invocation."""
run = create_run_state(workflow, workflow_input)
workflow.validate_structure().raise_for_errors()
validate_payload_against_schema(
workflow.input_schema, workflow_input, "workflow input"