feat(k1): complete canonical control lifecycle
This commit is contained in:
@@ -361,6 +361,37 @@ def test_dispatcher_routes_allowlisted_action_to_xgrids_facade() -> None:
|
||||
assert service.calls == [("scan", 6.0)]
|
||||
|
||||
|
||||
def test_runtime_classifies_non_json_plugin_output_as_execution_failure(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
retained_marker = "must-not-appear-in-the-server-log"
|
||||
|
||||
class NonJsonAdapter:
|
||||
plugin_id = "example.non-json"
|
||||
action_ids = frozenset({"state.read"})
|
||||
|
||||
async def invoke(
|
||||
self,
|
||||
_invocation: RuntimeActionInvocation,
|
||||
) -> dict[str, Any]:
|
||||
return {"dialogue": {"response_evidence": (retained_marker,)}}
|
||||
|
||||
dispatcher = DevicePluginDispatcher(
|
||||
[
|
||||
_in_process_runtime(
|
||||
NonJsonAdapter(),
|
||||
plugin_version="0.1.0",
|
||||
host_api_version="missioncore.nodedc/v1alpha2",
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
with pytest.raises(PluginExecutionError, match="non-JSON"):
|
||||
asyncio.run(dispatcher.invoke("example.non-json", "state.read", {}))
|
||||
|
||||
assert retained_marker not in caplog.text
|
||||
|
||||
|
||||
def test_dispatcher_rejects_unknown_plugin_and_action() -> None:
|
||||
dispatcher = DevicePluginDispatcher(
|
||||
[_in_process_runtime(XgridsK1PluginFacade(FakeXgridsService()))]
|
||||
@@ -404,7 +435,7 @@ def test_facade_validates_payload_before_calling_service() -> None:
|
||||
"compatibility_attestation": {
|
||||
"firmware_version": "3.0.2",
|
||||
"topology": "direct-lan",
|
||||
"operator_confirmed": True,
|
||||
"verification": "live-device-info",
|
||||
},
|
||||
},
|
||||
"live",
|
||||
|
||||
Reference in New Issue
Block a user