sched: checkpoint-first reconcile across torn checkpoint/summary writes (F2)

This commit is contained in:
lda
2026-09-08 11:43:37 +07:00 Verified
parent 5a6056b144
commit f7533c00e5
3 changed files with 538 additions and 3 deletions
+21
View File
@@ -88,3 +88,24 @@ class ScriptedDispatcher:
def finish(self, admission: RunAdmission, outcome: str) -> RunState:
"""Build the stopped state that settles a hanging run."""
return stopped_state(admission, outcome)
class WorkflowDispatcher:
"""Execution double driving a real workflow to its first stopped state.
Dispatch runs the workflow through the genuine ``wf_core`` runtime and
returns the resulting stopped state, so scheduler tests exercise real
execution (including durable interruptions) without enabling any server.
"""
def __init__(self, workflow: Any, registry: dict[str, Any] | None = None) -> None:
self.workflow = workflow
self.registry = registry or {}
def dispatch(self, *, admission: RunAdmission, now: datetime) -> DispatchResult:
from wf_core import execute_workflow
state = execute_workflow(
self.workflow, dict(admission.resolved_input), self.registry
)
return Stopped(result=state)