more map ->list moves: WorkflowDeployment / WorkflowArtifact

This commit is contained in:
lda
2026-05-20 21:13:26 +07:00 Verified
parent 9f265c3f80
commit 9c7c616212
20 changed files with 660 additions and 113 deletions
+20 -11
View File
@@ -204,7 +204,9 @@ def test_broker_validates_workflow_deployment_from_artifact_store() -> None:
id="summarize_docs.personal",
artifact_id="summarize_docs",
artifact_version=1,
bindings={"context7": "context7.personal"},
bindings=[
{"logical_source": "context7", "concrete_source": "context7.personal"}
],
)
)
service = WfMcpService(
@@ -290,7 +292,7 @@ def test_broker_creates_workflow_artifact_from_plan() -> None:
assert payload["saved"] is True
assert loaded.input_schema["properties"]["text"]["type"] == "string"
assert loaded.output_schema["properties"]["echoed"]["type"] == "string"
assert loaded.required_capabilities["demo.echo_tool"].logical_source == "demo"
assert loaded.required_capability_map()["demo.echo_tool"].logical_source == "demo"
def test_broker_saves_and_lists_workflow_deployments() -> None:
@@ -311,7 +313,12 @@ def test_broker_saves_and_lists_workflow_deployments() -> None:
id="summarize_docs.personal",
artifact_id="summarize_docs",
artifact_version=1,
bindings={"context7": "context7.personal"},
bindings=[
{
"logical_source": "context7",
"concrete_source": "context7.personal",
}
],
).model_dump(mode="json")
},
)
@@ -324,7 +331,9 @@ def test_broker_saves_and_lists_workflow_deployments() -> None:
assert save_payload["deployment_id"] == "summarize_docs.personal"
assert list_payload["deployments"][0]["id"] == "summarize_docs.personal"
assert list_payload["deployments"][0]["bindings"]["context7"] == "context7.personal"
binding = list_payload["deployments"][0]["bindings"][0]
assert binding["logical_source"] == "context7"
assert binding["concrete_source"] == "context7.personal"
def test_broker_runs_non_interrupting_workflow_deployment() -> None:
@@ -337,7 +346,7 @@ def test_broker_runs_non_interrupting_workflow_deployment() -> None:
id="echo.personal",
artifact_id="echo",
artifact_version=1,
bindings={"demo": "demo.personal"},
bindings=[{"logical_source": "demo", "concrete_source": "demo.personal"}],
)
)
service = WfMcpService(
@@ -379,7 +388,9 @@ def test_broker_run_deployment_returns_unrunnable_for_dependency_errors() -> Non
id="summarize_docs.personal",
artifact_id="summarize_docs",
artifact_version=1,
bindings={"context7": "context7.personal"},
bindings=[
{"logical_source": "context7", "concrete_source": "context7.personal"}
],
)
)
service = WfMcpService(
@@ -414,7 +425,7 @@ def test_broker_run_deployment_rejects_interrupting_artifacts() -> None:
id="approval.personal",
artifact_id="approval",
artifact_version=1,
bindings={},
bindings=[],
)
)
service = WfMcpService(
@@ -464,8 +475,7 @@ def _artifact() -> WorkflowArtifact:
plan={"name": "summarize_docs", "nodes": [], "edges": []},
required_capabilities={
"context7.query-docs": RequiredCapability(
logical_source="context7",
capability_name="query-docs",
ref="context7.query-docs",
kind="tool",
input_schema_hash="sha256:input",
output_schema_hash="sha256:output",
@@ -518,8 +528,7 @@ def _echo_artifact() -> WorkflowArtifact:
},
required_capabilities={
"demo.echo_tool": RequiredCapability(
logical_source="demo",
capability_name="echo_tool",
ref="demo.echo_tool",
kind="node_spec",
)
},
+19 -19
View File
@@ -189,7 +189,9 @@ def test_workflow_surface_validates_deployment_dependencies() -> None:
id="summarize_docs.personal",
artifact_id="summarize_docs",
artifact_version=1,
bindings={"context7": "context7.personal"},
bindings=[
{"logical_source": "context7", "concrete_source": "context7.personal"}
],
)
)
handlers = _handlers(artifact_store)
@@ -215,7 +217,9 @@ def test_workflow_surface_records_artifact_and_deployment_save_events() -> None:
id="echo.personal",
artifact_id="echo",
artifact_version=1,
bindings={"demo": "demo.personal"},
bindings=[
{"logical_source": "demo", "concrete_source": "demo.personal"}
],
).model_dump(mode="json")
)
)
@@ -274,7 +278,7 @@ def test_workflow_surface_creates_artifact_with_logical_node_refs() -> None:
artifact = artifact_store.get_artifact("echo_logical", 1)
assert artifact.plan["nodes"][0]["node"] == "demo.echo_tool"
assert artifact.required_capabilities["demo.echo_tool"].logical_source == "demo"
assert artifact.required_capability_map()["demo.echo_tool"].logical_source == "demo"
def test_workflow_surface_validates_draft_without_saving() -> None:
@@ -349,7 +353,7 @@ def test_workflow_surface_creates_artifact_from_draft_with_binding_suggestions()
assert payload["required_logical_sources"] == ["demo", "wf.std"]
assert payload["suggested_bindings"]["wf.std"] == "wf.std"
assert artifact.plan["nodes"][0]["node"] == "demo.echo_tool"
assert artifact.required_capabilities["demo.echo_tool"].logical_source == "demo"
assert artifact.required_capability_map()["demo.echo_tool"].logical_source == "demo"
def test_workflow_surface_draft_artifact_requires_std_self_binding() -> None:
@@ -373,7 +377,7 @@ def test_workflow_surface_draft_artifact_requires_std_self_binding() -> None:
id="draft_echo_missing_std.personal",
artifact_id="draft_echo_missing_std",
artifact_version=1,
bindings={"demo": "demo.personal"},
bindings=[{"logical_source": "demo", "concrete_source": "demo.personal"}],
)
)
@@ -733,7 +737,7 @@ def test_workflow_surface_runs_non_interrupting_deployment() -> None:
id="echo.personal",
artifact_id="echo",
artifact_version=1,
bindings={"demo": "demo.personal"},
bindings=[{"logical_source": "demo", "concrete_source": "demo.personal"}],
)
)
service = WfMcpService(
@@ -766,7 +770,7 @@ def test_workflow_surface_runs_deployment_with_bound_node_spec_dependency() -> N
id="echo.personal",
artifact_id="logical_echo",
artifact_version=1,
bindings={"demo": "demo.personal"},
bindings=[{"logical_source": "demo", "concrete_source": "demo.personal"}],
)
)
service = WfMcpService(
@@ -836,7 +840,7 @@ def test_workflow_surface_runs_artifact_created_from_concrete_node_ref() -> None
artifact = artifact_store.get_artifact("created_echo", 1)
assert artifact.plan["nodes"][0]["node"] == "demo.echo_tool"
assert artifact.required_capabilities["demo.echo_tool"].logical_source == "demo"
assert artifact.required_capability_map()["demo.echo_tool"].logical_source == "demo"
assert payload["status"] == "completed"
assert payload["output"]["echoed"] == "hello"
assert payload["diagnostics"] == []
@@ -881,7 +885,7 @@ def test_workflow_surface_detects_drift_from_saved_node_spec_snapshot() -> None:
required = artifact_store.get_artifact(
"created_echo_drift",
1,
).required_capabilities["demo.echo_tool"]
).required_capability_map()["demo.echo_tool"]
assert required.input_schema_hash is not None
service.register_connection(
@@ -1034,7 +1038,7 @@ def test_workflow_surface_calls_saved_wrapper_artifact_with_deployment_bindings(
id="logical_echo_wrapper.personal",
artifact_id="logical_echo_wrapper",
artifact_version=1,
bindings={"demo": "demo.personal"},
bindings=[{"logical_source": "demo", "concrete_source": "demo.personal"}],
)
)
service = WfMcpService(
@@ -1084,8 +1088,7 @@ def _artifact() -> WorkflowArtifact:
plan={"name": "summarize_docs", "nodes": [], "edges": []},
required_capabilities={
"context7.query-docs": RequiredCapability(
logical_source="context7",
capability_name="query-docs",
ref="context7.query-docs",
kind="tool",
input_schema_hash="sha256:input",
output_schema_hash="sha256:output",
@@ -1130,8 +1133,7 @@ def _echo_artifact() -> WorkflowArtifact:
plan=plan,
required_capabilities={
"demo.echo_tool": RequiredCapability(
logical_source="demo",
capability_name="echo_tool",
ref="demo.echo_tool",
kind="node_spec",
)
},
@@ -1196,7 +1198,7 @@ def _custom_reducer_artifact() -> WorkflowArtifact:
"type": "integer",
"reducer": "custom.multiply",
}
}
},
},
"output_schema": {
"type": "object",
@@ -1225,13 +1227,11 @@ def _custom_reducer_artifact() -> WorkflowArtifact:
plan=plan,
required_capabilities={
"demo.amount_tool": RequiredCapability(
logical_source="demo",
capability_name="amount_tool",
ref="demo.amount_tool",
kind="node_spec",
),
"custom.multiply": RequiredCapability(
logical_source="custom",
capability_name="multiply",
ref="custom.multiply",
kind="reducer",
),
},