misc fix: only 1 shall pass
This commit is contained in:
@@ -237,7 +237,11 @@ class WorkflowDeployment(BaseModel):
|
|||||||
data = dict(value)
|
data = dict(value)
|
||||||
# MCP tools consistently ask for deployment_id. Persisted artifact
|
# MCP tools consistently ask for deployment_id. Persisted artifact
|
||||||
# records still use the shorter canonical model field `id`.
|
# records still use the shorter canonical model field `id`.
|
||||||
if "deployment_id" in data and "id" not in data:
|
if "deployment_id" in data and "id" in data:
|
||||||
|
raise ValueError(
|
||||||
|
"deployment fields 'id' and 'deployment_id' are mutually exclusive"
|
||||||
|
)
|
||||||
|
if "deployment_id" in data:
|
||||||
data["id"] = data.pop("deployment_id")
|
data["id"] = data.pop("deployment_id")
|
||||||
bindings = data.get("bindings")
|
bindings = data.get("bindings")
|
||||||
if not isinstance(bindings, dict):
|
if not isinstance(bindings, dict):
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from wf_artifacts import FileWorkflowArtifactStore, WorkflowDeployment
|
from wf_artifacts import FileWorkflowArtifactStore, WorkflowDeployment
|
||||||
|
|
||||||
from ..test_support import local_temp_root
|
from ..test_support import local_temp_root
|
||||||
@@ -84,6 +86,29 @@ def test_workflow_surface_save_deployment_accepts_deployment_id_alias() -> None:
|
|||||||
assert saved.id == "echo.personal"
|
assert saved.id == "echo.personal"
|
||||||
|
|
||||||
|
|
||||||
|
def test_workflow_surface_save_deployment_rejects_id_and_deployment_id() -> None:
|
||||||
|
artifact_store = FileWorkflowArtifactStore(local_temp_root() / "surface_alias_xor")
|
||||||
|
h = handlers(artifact_store)
|
||||||
|
|
||||||
|
with pytest.raises(ValueError, match="mutually exclusive"):
|
||||||
|
asyncio.run(
|
||||||
|
h.save_deployment(
|
||||||
|
{
|
||||||
|
"id": "echo.personal",
|
||||||
|
"deployment_id": "echo.other",
|
||||||
|
"artifact_id": "echo",
|
||||||
|
"artifact_version": 1,
|
||||||
|
"bindings": [
|
||||||
|
{
|
||||||
|
"logical_source": "demo",
|
||||||
|
"concrete_source": "demo.personal",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_workflow_surface_lists_compact_deployment_summaries_and_inspects_detail() -> (
|
def test_workflow_surface_lists_compact_deployment_summaries_and_inspects_detail() -> (
|
||||||
None
|
None
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user