From 3de29104eefd446d5c66bf6de29ecfbbff2a96ae Mon Sep 17 00:00:00 2001 From: lda Date: Sat, 29 Aug 2026 18:13:02 +0700 Subject: [PATCH] type: annotate context analysis and workflow example --- examples/mcp_workflow_surface.py | 3 ++- tests/core/test_context_scopes.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/mcp_workflow_surface.py b/examples/mcp_workflow_surface.py index 7c379dac..f25ff7a8 100644 --- a/examples/mcp_workflow_surface.py +++ b/examples/mcp_workflow_surface.py @@ -3,6 +3,7 @@ from __future__ import annotations from pathlib import Path from typing import Any +from wf_api.models import RunResult from wf_artifacts import ( FileDraftWorkspaceStore, FileRunStore, @@ -198,7 +199,7 @@ def build_echo_draft() -> dict[str, Any]: } -async def create_and_run_echo_deployment(root: Path, *, text: str) -> dict[str, Any]: +async def create_and_run_echo_deployment(root: Path, *, text: str) -> RunResult: """Create an artifact/deployment from the draft and run it once.""" service = await prepare_demo_service(root) handlers = WorkflowSurfaceHandlers(service) diff --git a/tests/core/test_context_scopes.py b/tests/core/test_context_scopes.py index ba8bff20..645dc286 100644 --- a/tests/core/test_context_scopes.py +++ b/tests/core/test_context_scopes.py @@ -2,10 +2,12 @@ from __future__ import annotations from wf_core import END, Edge, ForeachNode, NodeUse, SchemaRef, StateSchema, Workflow from wf_core.analysis.context_scopes import ( + ContextFieldAvailability, context_analysis_warnings, context_fields_by_node, ) from wf_core.context_contracts import STANDARD_CONTEXT_FIELDS, foreach_context_fields +from wf_core.models.steps import Step from wf_core.run_state import ExecutionFrame from wf_core.runtime.ops.frames import frame_context_values @@ -36,7 +38,7 @@ def _foreach( def _workflow( *, start: str, - nodes: list[object], + nodes: list[Step], edges: list[dict[str, str]], state_schema: dict[str, object] | None = None, ) -> Workflow: @@ -57,7 +59,7 @@ def _workflow( ) -def _field_map(workflow: Workflow, node_id: str) -> dict[str, object]: +def _field_map(workflow: Workflow, node_id: str) -> dict[str, ContextFieldAvailability]: return { field.contract.name: field for field in context_fields_by_node(workflow)[node_id]