fix: bind json rpc list params
This commit is contained in:
@@ -38,6 +38,10 @@ wf --url http://127.0.0.1:8765/rpc admin registry list
|
||||
registry. `--store-root` is for the local/static server path and cannot be
|
||||
combined with `--mcp-config`.
|
||||
|
||||
`admin registry` shows desired persisted source entries. It is separate from
|
||||
workflow artifacts and deployments, so it can be empty even when the server has
|
||||
runtime sources and saved workflows.
|
||||
|
||||
## Output Policy
|
||||
|
||||
JSON is the default output format for every command.
|
||||
@@ -78,6 +82,10 @@ wf cap list --source wf.std --format ids
|
||||
wf cap list --query echo --format compact
|
||||
```
|
||||
|
||||
`--source` filters by the exact source id shown by `wf source list`. For
|
||||
example, `echo` is usually an MCP tool such as `everything.default.echo`, not a
|
||||
`wf.std` builtin.
|
||||
|
||||
Inspect one capability:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -2,14 +2,13 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_server import WorkflowServer
|
||||
|
||||
from .errors import WorkflowRpcError, raise_workflow_rpc_error
|
||||
from .models import InspectArtifactParams, ListArtifactsParams, SaveArtifactParams
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def register_methods(
|
||||
@@ -20,7 +19,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.artifacts.save", errors=[WorkflowRpcError])
|
||||
async def workflow_artifacts_save(
|
||||
params: SaveArtifactParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: SaveArtifactParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.save_artifact(params.artifact)
|
||||
@@ -29,7 +28,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.artifacts.list", errors=[WorkflowRpcError])
|
||||
async def workflow_artifacts_list(
|
||||
params: ListArtifactsParams = Body(default_factory=ListArtifactsParams),
|
||||
params: ListArtifactsParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.list_artifacts(
|
||||
@@ -43,7 +42,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.artifacts.inspect", errors=[WorkflowRpcError])
|
||||
async def workflow_artifacts_inspect(
|
||||
params: InspectArtifactParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: InspectArtifactParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.inspect_artifact(
|
||||
|
||||
@@ -2,14 +2,13 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_server import WorkflowServer
|
||||
|
||||
from .errors import WorkflowRpcError, raise_workflow_rpc_error
|
||||
from .models import InspectCapabilityParams, ListCapabilitiesParams
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def register_methods(
|
||||
@@ -20,7 +19,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.capabilities.list", errors=[WorkflowRpcError])
|
||||
async def workflow_capabilities_list(
|
||||
params: ListCapabilitiesParams = Body(default_factory=ListCapabilitiesParams),
|
||||
params: ListCapabilitiesParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.list_capabilities(
|
||||
@@ -34,7 +33,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.capabilities.inspect", errors=[WorkflowRpcError])
|
||||
async def workflow_capabilities_inspect(
|
||||
params: InspectCapabilityParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: InspectCapabilityParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.inspect_capability(
|
||||
|
||||
@@ -2,9 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_server import WorkflowServer
|
||||
|
||||
@@ -16,6 +14,7 @@ from .models import (
|
||||
SaveDeploymentParams,
|
||||
ValidateDeploymentParams,
|
||||
)
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def register_methods(
|
||||
@@ -26,7 +25,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.deployments.save", errors=[WorkflowRpcError])
|
||||
async def workflow_deployments_save(
|
||||
params: SaveDeploymentParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: SaveDeploymentParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.save_deployment(params.deployment)
|
||||
@@ -35,7 +34,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.deployments.validate", errors=[WorkflowRpcError])
|
||||
async def workflow_deployments_validate(
|
||||
params: ValidateDeploymentParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: ValidateDeploymentParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.validate_deployment(
|
||||
@@ -47,7 +46,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.deployments.list", errors=[WorkflowRpcError])
|
||||
async def workflow_deployments_list(
|
||||
params: ListDeploymentsParams = Body(default_factory=ListDeploymentsParams),
|
||||
params: ListDeploymentsParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.list_deployments()
|
||||
@@ -56,7 +55,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.deployments.inspect", errors=[WorkflowRpcError])
|
||||
async def workflow_deployments_inspect(
|
||||
params: InspectDeploymentParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: InspectDeploymentParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.inspect_deployment(
|
||||
@@ -67,7 +66,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.deployments.delete", errors=[WorkflowRpcError])
|
||||
async def workflow_deployments_delete(
|
||||
params: DeleteDeploymentParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: DeleteDeploymentParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.delete_deployment(
|
||||
|
||||
@@ -2,9 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_server import WorkflowServer
|
||||
|
||||
@@ -20,6 +18,7 @@ from .models import (
|
||||
ValidateDraftParams,
|
||||
ValidateDraftWorkspaceParams,
|
||||
)
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def register_methods(
|
||||
@@ -32,7 +31,7 @@ def register_methods(
|
||||
name="workflow.drafts.create_from_capability", errors=[WorkflowRpcError]
|
||||
)
|
||||
async def workflow_drafts_create_from_capability(
|
||||
params: CreateDraftFromCapabilityParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: CreateDraftFromCapabilityParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await _create_from_capability(server, params)
|
||||
@@ -41,7 +40,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.drafts.patch", errors=[WorkflowRpcError])
|
||||
async def workflow_drafts_patch(
|
||||
params: PatchDraftParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: PatchDraftParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.patch_draft(draft=params.draft, patch=params.patch)
|
||||
@@ -50,7 +49,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.drafts.validate", errors=[WorkflowRpcError])
|
||||
async def workflow_drafts_validate(
|
||||
params: ValidateDraftParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: ValidateDraftParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.validate_draft(draft=params.draft)
|
||||
@@ -59,9 +58,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.draft_workspaces.list", errors=[WorkflowRpcError])
|
||||
async def workflow_draft_workspaces_list(
|
||||
params: ListDraftWorkspacesParams = Body(
|
||||
default_factory=ListDraftWorkspacesParams
|
||||
),
|
||||
params: ListDraftWorkspacesParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.list_draft_workspaces()
|
||||
@@ -70,7 +67,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.draft_workspaces.get", errors=[WorkflowRpcError])
|
||||
async def workflow_draft_workspaces_get(
|
||||
params: GetDraftWorkspaceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: GetDraftWorkspaceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.get_draft_workspace(
|
||||
@@ -85,7 +82,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_draft_workspaces_create_from_capability(
|
||||
params: CreateDraftFromCapabilityParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: CreateDraftFromCapabilityParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await _create_from_capability(server, params)
|
||||
@@ -96,7 +93,7 @@ def register_methods(
|
||||
name="workflow.draft_workspaces.patch", errors=[WorkflowRpcError]
|
||||
)
|
||||
async def workflow_draft_workspaces_patch(
|
||||
params: PatchDraftWorkspaceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: PatchDraftWorkspaceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.patch_draft_workspace(
|
||||
@@ -111,7 +108,7 @@ def register_methods(
|
||||
name="workflow.draft_workspaces.validate", errors=[WorkflowRpcError]
|
||||
)
|
||||
async def workflow_draft_workspaces_validate(
|
||||
params: ValidateDraftWorkspaceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: ValidateDraftWorkspaceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.validate_draft_workspace(
|
||||
@@ -124,7 +121,7 @@ def register_methods(
|
||||
name="workflow.draft_workspaces.create_artifact", errors=[WorkflowRpcError]
|
||||
)
|
||||
async def workflow_draft_workspaces_create_artifact(
|
||||
params: CreateArtifactFromWorkspaceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: CreateArtifactFromWorkspaceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.create_artifact_from_workspace(
|
||||
@@ -146,7 +143,7 @@ def register_methods(
|
||||
name="workflow.draft_workspaces.create_wrapper", errors=[WorkflowRpcError]
|
||||
)
|
||||
async def workflow_draft_workspaces_create_wrapper(
|
||||
params: CreateWrapperFromWorkspaceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: CreateWrapperFromWorkspaceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.create_wrapper_from_workspace(
|
||||
|
||||
@@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_server import WorkflowServer
|
||||
|
||||
@@ -14,6 +13,7 @@ from .models import (
|
||||
ResumeRunParams,
|
||||
StartRunParams,
|
||||
)
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def register_methods(
|
||||
@@ -24,7 +24,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.runs.start", errors=[WorkflowRpcError])
|
||||
async def workflow_runs_start(
|
||||
params: StartRunParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: StartRunParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.run_deployment(
|
||||
@@ -41,7 +41,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.runs.inspect", errors=[WorkflowRpcError])
|
||||
async def workflow_runs_inspect(
|
||||
params: InspectRunParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: InspectRunParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.inspect_run(run_id=params.run_id)
|
||||
@@ -50,7 +50,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.runs.trace", errors=[WorkflowRpcError])
|
||||
async def workflow_runs_trace(
|
||||
params: ReadRunTraceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: ReadRunTraceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.read_run_trace(
|
||||
@@ -62,7 +62,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.runs.resume", errors=[WorkflowRpcError])
|
||||
async def workflow_runs_resume(
|
||||
params: ResumeRunParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: ResumeRunParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.api.resume_run(
|
||||
|
||||
@@ -2,9 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_api import WorkflowSourceRegistrySurface
|
||||
from wf_server import WorkflowServer
|
||||
@@ -17,6 +15,7 @@ from .models import (
|
||||
RegistryEntryIdParams,
|
||||
UpdateRegistryEntryParams,
|
||||
)
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def _require_source_registry_admin(
|
||||
@@ -49,9 +48,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_list(
|
||||
params: ListRegistryEntriesParams = Body(
|
||||
default_factory=ListRegistryEntriesParams,
|
||||
),
|
||||
params: ListRegistryEntriesParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="reads")
|
||||
try:
|
||||
@@ -67,7 +64,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_inspect(
|
||||
params: InspectRegistryEntryParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: InspectRegistryEntryParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="reads")
|
||||
try:
|
||||
@@ -82,7 +79,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_add(
|
||||
params: AddRegistryEntryParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: AddRegistryEntryParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="mutations")
|
||||
try:
|
||||
@@ -97,7 +94,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_update(
|
||||
params: UpdateRegistryEntryParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: UpdateRegistryEntryParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="mutations")
|
||||
try:
|
||||
@@ -113,7 +110,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_enable(
|
||||
params: RegistryEntryIdParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: RegistryEntryIdParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="mutations")
|
||||
try:
|
||||
@@ -128,7 +125,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_disable(
|
||||
params: RegistryEntryIdParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: RegistryEntryIdParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="mutations")
|
||||
try:
|
||||
@@ -143,7 +140,7 @@ def register_methods(
|
||||
errors=[WorkflowRpcError],
|
||||
)
|
||||
async def workflow_admin_source_registry_remove(
|
||||
params: RegistryEntryIdParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: RegistryEntryIdParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
admin = _require_source_registry_admin(server, operation="mutations")
|
||||
try:
|
||||
|
||||
@@ -2,14 +2,13 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import Body
|
||||
import fastapi_jsonrpc as jsonrpc
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
from wf_server import WorkflowServer
|
||||
|
||||
from .errors import WorkflowRpcError, raise_workflow_rpc_error
|
||||
from .models import InspectSourceParams, ListSourcesParams
|
||||
from .params import RpcParams
|
||||
|
||||
|
||||
def register_methods(
|
||||
@@ -20,7 +19,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.sources.list", errors=[WorkflowRpcError])
|
||||
async def workflow_sources_list(
|
||||
params: ListSourcesParams = Body(default_factory=ListSourcesParams),
|
||||
params: ListSourcesParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.source_admin.list_sources(
|
||||
@@ -32,7 +31,7 @@ def register_methods(
|
||||
|
||||
@entrypoint.method(name="workflow.sources.inspect", errors=[WorkflowRpcError])
|
||||
async def workflow_sources_inspect(
|
||||
params: InspectSourceParams = Params(...), # type: ignore[reportArgumentType]
|
||||
params: InspectSourceParams = RpcParams(),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return await server.source_admin.inspect_source(source_id=params.source_id)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi.datastructures import _Unset
|
||||
from fastapi_jsonrpc import Params
|
||||
|
||||
|
||||
class _RpcParams(Params):
|
||||
def __init__(self, default: Any = ..., **extra: Any) -> None:
|
||||
super().__init__(default, example=_Unset, **extra)
|
||||
|
||||
|
||||
def RpcParams(default: Any = ...) -> Any:
|
||||
"""Bind JSON-RPC method params without fastapi-jsonrpc's warning-prone wrapper.
|
||||
|
||||
``fastapi_jsonrpc.Params`` currently forwards ``example=Undefined`` into
|
||||
FastAPI's ``Body``. FastAPI treats that as the deprecated ``example``
|
||||
argument being explicitly provided, so every method registration emits a
|
||||
deprecation warning. Keep the upstream subclass so fastapi-jsonrpc still
|
||||
recognises method params, but pass FastAPI's real "unset" sentinel.
|
||||
"""
|
||||
return _RpcParams(default)
|
||||
@@ -258,19 +258,19 @@ def _interrupt_plan() -> RawWorkflowPlan:
|
||||
|
||||
def test_wf_cap_commands_use_rpc_url_override(monkeypatch, tmp_path) -> None:
|
||||
server = build_local_static_workflow_server(tmp_path / "store")
|
||||
rpc_app = create_rpc_app(server)
|
||||
transport = httpx.ASGITransport(app=rpc_app)
|
||||
original_client = httpx.AsyncClient
|
||||
monkeypatch.setattr(
|
||||
"wf_transport_rpc_http.client.httpx.AsyncClient",
|
||||
lambda *args, **kwargs: original_client(
|
||||
transport=transport, base_url="http://test"
|
||||
transport=httpx.ASGITransport(app=create_rpc_app(server)),
|
||||
base_url="http://test",
|
||||
),
|
||||
)
|
||||
config_path = tmp_path / "wf.json"
|
||||
config_path.write_text('{"version": 1}', encoding="utf-8")
|
||||
|
||||
result = CliRunner().invoke(
|
||||
runner = CliRunner()
|
||||
inspected = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"--config",
|
||||
@@ -282,8 +282,30 @@ def test_wf_cap_commands_use_rpc_url_override(monkeypatch, tmp_path) -> None:
|
||||
"wf.std.constant",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert '"name": "wf.std.constant"' in result.output
|
||||
listed = runner.invoke(
|
||||
app,
|
||||
[
|
||||
"--config",
|
||||
str(config_path),
|
||||
"--url",
|
||||
"http://test/rpc",
|
||||
"cap",
|
||||
"list",
|
||||
"--source",
|
||||
"wf.std",
|
||||
"--limit",
|
||||
"100",
|
||||
],
|
||||
)
|
||||
|
||||
assert inspected.exit_code == 0, inspected.output
|
||||
assert '"name": "wf.std.constant"' in inspected.output
|
||||
assert listed.exit_code == 0, listed.output
|
||||
listed_payload = json.loads(listed.output)
|
||||
assert listed_payload["capabilities"]
|
||||
assert {
|
||||
capability["source_id"] for capability in listed_payload["capabilities"]
|
||||
} == {"wf.std"}
|
||||
|
||||
|
||||
def test_wf_source_commands_use_rpc_url_override(monkeypatch, tmp_path) -> None:
|
||||
|
||||
@@ -45,6 +45,9 @@ async def test_rpc_health_and_capability_methods(tmp_path) -> None:
|
||||
assert health_response.json()["status"] == "ok"
|
||||
assert health["result"]["status"] == "ok"
|
||||
assert listed["result"]["capabilities"]
|
||||
assert {
|
||||
capability["source_id"] for capability in listed["result"]["capabilities"]
|
||||
} == {"wf.std"}
|
||||
assert inspected["result"]["name"] == "wf.std.constant"
|
||||
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ async def test_rpc_workflow_client_lists_and_inspects_capabilities(tmp_path) ->
|
||||
)
|
||||
|
||||
assert listed["capabilities"]
|
||||
assert {capability["source_id"] for capability in listed["capabilities"]} == {
|
||||
"wf.std"
|
||||
}
|
||||
assert inspected["name"] == "wf.std.constant"
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +60,27 @@ async def test_mcp_backed_rpc_lists_and_mutates_source_registry(tmp_path) -> Non
|
||||
assert inspected["entry"]["enabled"] is False
|
||||
|
||||
|
||||
async def test_mcp_backed_rpc_capability_list_filters_by_source(tmp_path) -> None:
|
||||
config = BrokerConfig(store_root=tmp_path / "store", connections=[])
|
||||
server = build_workflow_server_from_config(config)
|
||||
app = create_rpc_app(server)
|
||||
transport = httpx.ASGITransport(app=app)
|
||||
|
||||
async with httpx.AsyncClient(
|
||||
transport=transport, base_url="http://test"
|
||||
) as http_client:
|
||||
client = RpcWorkflowApiClient(
|
||||
url="http://test/rpc",
|
||||
http_client=http_client,
|
||||
)
|
||||
listed = await client.list_capabilities(source_id="wf.std", limit=100)
|
||||
|
||||
assert listed["capabilities"]
|
||||
assert {capability["source_id"] for capability in listed["capabilities"]} == {
|
||||
"wf.std"
|
||||
}
|
||||
|
||||
|
||||
async def test_mcp_backed_rpc_reports_connections_and_events(tmp_path) -> None:
|
||||
config = BrokerConfig(
|
||||
store_root=tmp_path / "store",
|
||||
|
||||
Reference in New Issue
Block a user