the Stores
This commit is contained in:
@@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import shutil
|
||||
|
||||
from wf_artifacts import FileDraftWorkspaceStore
|
||||
from wf_authoring import NodeSpec
|
||||
from wf_core import RunStatus
|
||||
from wf_mcp.broker import WfMcpService
|
||||
@@ -65,12 +64,13 @@ def test_service_installs_builtin_stdlib_specs_by_default() -> None:
|
||||
assert "wf.mcp" not in service.capability_sources
|
||||
|
||||
|
||||
def test_service_installs_default_draft_workspace_store() -> None:
|
||||
root = local_temp_root() / "service_default_draft_workspace_store"
|
||||
def test_service_does_not_install_workflow_stores_implicitly() -> None:
|
||||
root = local_temp_root() / "service_no_implicit_workflow_stores"
|
||||
service = WfMcpService(store=FileStore(root))
|
||||
|
||||
assert isinstance(service.draft_workspace_store, FileDraftWorkspaceStore)
|
||||
assert service.draft_workspace_store.root == root
|
||||
assert service.artifact_store is None
|
||||
assert service.draft_workspace_store is None
|
||||
assert service.run_store is None
|
||||
|
||||
|
||||
def test_service_registers_empty_source_for_connection_without_catalog() -> None:
|
||||
|
||||
@@ -5,6 +5,8 @@ import json
|
||||
from typing import Any, cast
|
||||
|
||||
from wf_artifacts import (
|
||||
FileDraftWorkspaceStore,
|
||||
FileRunStore,
|
||||
FileWorkflowArtifactStore,
|
||||
RequiredCapability,
|
||||
WorkflowArtifact,
|
||||
@@ -352,6 +354,7 @@ def test_broker_runs_non_interrupting_workflow_deployment() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "broker_run_mcp_store"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "broker_run_mcp_store"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -431,6 +434,7 @@ def test_broker_run_deployment_pauses_and_resumes_interrupting_artifacts() -> No
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "broker_run_interrupt_mcp_store"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "broker_run_interrupt_mcp_store"),
|
||||
)
|
||||
server = create_broker_server(service)
|
||||
|
||||
@@ -467,17 +471,18 @@ def test_broker_run_deployment_pauses_and_resumes_interrupting_artifacts() -> No
|
||||
assert resumed["resume_readiness"] == "not_applicable"
|
||||
|
||||
|
||||
def test_build_service_from_config_uses_store_root_for_artifacts() -> None:
|
||||
store_root = local_temp_root() / "broker_config_artifact_store"
|
||||
service = build_service_from_config(
|
||||
BrokerConfig(
|
||||
store_root=store_root,
|
||||
connections=[],
|
||||
)
|
||||
)
|
||||
def test_build_service_from_config_uses_store_root_for_workflow_stores() -> None:
|
||||
store_root = local_temp_root() / "broker_config_workflow_stores"
|
||||
config = BrokerConfig(store_root=store_root, connections=[])
|
||||
|
||||
service = build_service_from_config(config)
|
||||
|
||||
assert isinstance(service.artifact_store, FileWorkflowArtifactStore)
|
||||
assert isinstance(service.draft_workspace_store, FileDraftWorkspaceStore)
|
||||
assert isinstance(service.run_store, FileRunStore)
|
||||
assert service.artifact_store.root == store_root
|
||||
assert service.draft_workspace_store.root == store_root
|
||||
assert service.run_store.root == store_root
|
||||
|
||||
|
||||
def _artifact() -> WorkflowArtifact:
|
||||
|
||||
@@ -4,6 +4,7 @@ import asyncio
|
||||
from typing import Any
|
||||
|
||||
from wf_artifacts import (
|
||||
FileRunStore,
|
||||
FileWorkflowArtifactStore,
|
||||
RequiredCapability,
|
||||
ResumeReadiness,
|
||||
@@ -381,9 +382,11 @@ def _deployment(*, bindings: dict[str, str] | None = None) -> WorkflowDeployment
|
||||
|
||||
|
||||
def _handlers(artifact_store: FileWorkflowArtifactStore) -> WorkflowSurfaceHandlers:
|
||||
mcp_root = local_temp_root() / f"{artifact_store.root.name}_mcp"
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / f"{artifact_store.root.name}_mcp"),
|
||||
store=FileStore(mcp_root),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(mcp_root),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
|
||||
@@ -5,6 +5,8 @@ from typing import Any
|
||||
from pydantic import BaseModel
|
||||
|
||||
from wf_artifacts import (
|
||||
FileDraftWorkspaceStore,
|
||||
FileRunStore,
|
||||
FileWorkflowArtifactStore,
|
||||
RequiredCapability,
|
||||
WorkflowArtifact,
|
||||
@@ -159,9 +161,12 @@ def multiply(current: int | None, incoming: int) -> int:
|
||||
|
||||
|
||||
def handlers(artifact_store: FileWorkflowArtifactStore) -> WorkflowSurfaceHandlers:
|
||||
mcp_root = artifact_store.root / "surface_mcp" / str(id(artifact_store))
|
||||
service = WfMcpService(
|
||||
store=FileStore(artifact_store.root / "surface_mcp" / str(id(artifact_store))),
|
||||
store=FileStore(mcp_root),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(mcp_root),
|
||||
run_store=FileRunStore(mcp_root),
|
||||
)
|
||||
return WorkflowSurfaceHandlers(service)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
|
||||
from wf_artifacts import FileWorkflowArtifactStore
|
||||
from wf_artifacts import FileWorkflowArtifactStore, FileDraftWorkspaceStore
|
||||
from wf_mcp.broker import WfMcpService
|
||||
from wf_mcp.models import ConnectionConfig
|
||||
from wf_mcp.storage import FileStore
|
||||
@@ -102,6 +102,9 @@ def test_workflow_surface_does_not_auto_map_raw_mcp_content_blocks() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_content_only_content_hint_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_content_only_content_hint_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(
|
||||
|
||||
@@ -2,7 +2,11 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
|
||||
from wf_artifacts import FileWorkflowArtifactStore, WorkflowDeployment
|
||||
from wf_artifacts import (
|
||||
FileWorkflowArtifactStore,
|
||||
FileDraftWorkspaceStore,
|
||||
WorkflowDeployment,
|
||||
)
|
||||
from wf_mcp.broker import WfMcpService
|
||||
from wf_mcp.models import ConnectionConfig
|
||||
from wf_mcp.storage import FileStore
|
||||
@@ -122,6 +126,9 @@ def test_workflow_surface_validates_draft_workspace_with_live_outcomes() -> None
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_validate_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_workspace_validate_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -153,6 +160,9 @@ def test_workflow_surface_creates_minimal_draft_workspace_with_error_route() ->
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_minimal_workspace_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_minimal_workspace_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -201,6 +211,9 @@ def test_workflow_surface_minimal_draft_honors_explicit_error_message_source() -
|
||||
artifact_store=FileWorkflowArtifactStore(
|
||||
local_temp_root() / "surface_minimal_explicit_error"
|
||||
),
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_minimal_explicit_error_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -259,6 +272,9 @@ def test_workflow_surface_accepts_canonical_bindings_for_minimal_workspace() ->
|
||||
artifact_store=FileWorkflowArtifactStore(
|
||||
local_temp_root() / "surface_minimal_canonical"
|
||||
),
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_minimal_canonical_mcp"
|
||||
),
|
||||
)
|
||||
h = WorkflowSurfaceHandlers(service)
|
||||
|
||||
@@ -309,6 +325,9 @@ def test_workflow_surface_creates_draft_workspace_from_capability_hints() -> Non
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_from_capability_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_workspace_from_capability_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -362,6 +381,9 @@ def test_workflow_surface_creates_artifact_from_workspace() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_artifact_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_workspace_artifact_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -404,6 +426,9 @@ def test_workflow_surface_workspace_artifact_infers_raw_concrete_dependency() ->
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_artifact_raw_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_workspace_artifact_raw_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -441,6 +466,9 @@ def test_workflow_surface_creates_wrapper_from_workspace() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_wrapper_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_workspace_wrapper_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -478,6 +506,9 @@ def test_workflow_surface_low_confidence_draft_returns_patch_guidance() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_workspace_low_confidence_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
draft_workspace_store=FileDraftWorkspaceStore(
|
||||
local_temp_root() / "surface_workspace_low_confidence_mcp"
|
||||
),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
|
||||
from wf_artifacts import FileWorkflowArtifactStore, WorkflowDeployment
|
||||
from wf_artifacts import FileWorkflowArtifactStore, FileRunStore, WorkflowDeployment
|
||||
from wf_mcp.broker import WfMcpService
|
||||
from wf_mcp.models import ConnectionConfig
|
||||
from wf_mcp.storage import FileStore
|
||||
@@ -51,6 +51,7 @@ def test_workflow_surface_runs_non_interrupting_deployment() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_run_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_run_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -112,6 +113,7 @@ def test_workflow_surface_failed_deployment_exposes_error_on_run_and_inspect() -
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_failed_run_error_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_failed_run_error_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -153,6 +155,7 @@ def test_workflow_surface_run_deployment_can_include_trace_detail() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_run_trace_detail_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_run_trace_detail_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -201,6 +204,7 @@ def test_workflow_surface_run_deployment_can_read_empty_trace_range() -> None:
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_run_trace_empty_range_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_run_trace_empty_range_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -237,6 +241,7 @@ def test_workflow_surface_runs_deployment_with_bound_node_spec_dependency() -> N
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_bound_node_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_bound_node_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -263,6 +268,7 @@ def test_workflow_surface_runs_artifact_created_from_concrete_node_ref() -> None
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_created_bound_node_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_created_bound_node_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
@@ -390,6 +396,7 @@ def test_workflow_surface_runs_deployment_with_bound_reducer_dependency() -> Non
|
||||
service = WfMcpService(
|
||||
store=FileStore(local_temp_root() / "surface_reducer_mcp"),
|
||||
artifact_store=artifact_store,
|
||||
run_store=FileRunStore(local_temp_root() / "surface_reducer_mcp"),
|
||||
)
|
||||
service.register_connection(
|
||||
ConnectionConfig(id="demo.personal", server="demo", account="personal")
|
||||
|
||||
Reference in New Issue
Block a user