docs(thesis): resolve review findings and verify examples

This commit is contained in:
lda
2026-09-14 13:40:11 +07:00 Verified
parent 5495dc5656
commit 396caa63d6
8 changed files with 273 additions and 45 deletions
@@ -10,9 +10,11 @@ from typing import Any, cast
import pytest
from wf_client import App, Deployment, Run
from wf_api.durable_context import durable_workflow_api
from wf_client import App, Deployment, Run, Schedule
from wf_client.protocols import WorkflowClientPort
from wf_config import load_workflow_config
from wf_scheduling.store import FileScheduleStore
from wf_server.config import build_workflow_server_from_workflow_config
ROOT = Path(__file__).resolve().parents[2]
@@ -32,7 +34,11 @@ async def test_thesis_python_session_preserves_report_and_repair(
config = load_workflow_config(ROOT / "examples/report_workflow/wf.config.json")
config.server.store.root = tmp_path / "store"
server = build_workflow_server_from_workflow_config(config)
app = App._from_port(cast(WorkflowClientPort, server.api))
# Enable real schedule persistence without starting a background scheduler:
# this session verifies registration, while another test exercises dispatch.
schedule_store = FileScheduleStore(config.server.store.root)
api = durable_workflow_api(server.context, schedule_store=schedule_store)
app = App._from_port(cast(WorkflowClientPort, api))
monkeypatch.chdir(ROOT)
manuscript = THESIS.read_text(encoding="utf-8")
@@ -84,3 +90,14 @@ async def test_thesis_python_session_preserves_report_and_repair(
for displayed in displayed_outputs:
assert displayed in diagnostic, "Displayed output differs from the session"
assert namespace["trace"].frames
schedule = namespace["schedule"]
assert isinstance(schedule, Schedule)
assert schedule.deployment_id == deployment.deployment_id
assert schedule.max_steps == 100
assert schedule.trigger["kind"] == "oneshot"
persisted = schedule_store.get_schedule(schedule.schedule_id)
assert persisted is not None
expression = persisted.input_bindings[0].expression
assert expression.kind == "literal"
assert expression.value == namespace["notes"]
assert namespace["history"]["occurrences"] == []