Skip to content

Self-improving AI Employees for everyone

test(scaling): adapt contract harness to plugin architecture

trohitg1c6b0c7cddbb
diff --git a/client/src/test/nodeDefinitionContract.ts b/client/src/test/nodeDefinitionContract.ts
index 4dc309bd..805d8998 100644
--- a/client/src/test/nodeDefinitionContract.ts
+++ b/client/src/test/nodeDefinitionContract.ts
@@ -19,10 +19,15 @@ export interface ContractIssue {
message: string;
}
+// Wave 10.B: `icon` is now backend-owned (served via NodeSpec from
+// server/models/node_metadata.NODE_METADATA and assembled in
+// services/node_spec.get_node_spec). The frontend type declares it as
+// `icon?: string` and every entry in client/src/nodeDefinitions/*.ts
+// has had its icon field stripped. Do NOT add `icon` back to this list --
+// the source of truth has moved. See docs-internal/schema_source_of_truth_rfc.md.
const REQUIRED_TOP_LEVEL: (keyof INodeTypeDescription)[] = [
'displayName',
'name',
- 'icon',
'group',
'version',
'description',
diff --git a/server/tests/nodes/_mocks.py b/server/tests/nodes/_mocks.py
index 1b4cb735..cd9d576f 100644
--- a/server/tests/nodes/_mocks.py
+++ b/server/tests/nodes/_mocks.py
@@ -21,13 +21,26 @@ def patched_container(
auth_api_keys: Optional[Dict[str, str]] = None,
auth_oauth_tokens: Optional[Dict[str, Dict[str, Any]]] = None,
database: Optional[MagicMock] = None,
+ ai_service: Optional[Any] = None,
+ android_service: Optional[Any] = None,
+ maps_service: Optional[Any] = None,
+ text_service: Optional[Any] = None,
) -> Iterator[MagicMock]:
"""Patch `core.container.container` so handlers see canned credentials and DB.
+ Scaling-branch plugins resolve services via
+ `from core.container import container; svc = container.X()` inside the
+ plugin body, so the NodeExecutor-injected services on `harness.X` are
+ orphaned unless we also wire them onto the container mock here.
+
Args:
auth_api_keys: Map of provider -> api_key string returned by get_api_key.
auth_oauth_tokens: Map of provider -> token dict returned by get_oauth_tokens.
database: Optional MagicMock to use as the database; defaults to a stub.
+ ai_service / android_service / maps_service / text_service: Optional
+ service instances that `container.X()` should return. Pass the
+ harness's pre-wired mocks so assertions on `harness.ai_service.
+ execute_chat.assert_awaited_once()` survive plugin dispatch.
Yields:
The patched container MagicMock so tests can inspect calls.
@@ -58,6 +71,15 @@ def patched_container(
container_mock.auth_service = MagicMock(return_value=auth_service)
container_mock.database = MagicMock(return_value=db_mock)
+ if ai_service is not None:
+ container_mock.ai_service = MagicMock(return_value=ai_service)
+ if android_service is not None:
+ container_mock.android_service = MagicMock(return_value=android_service)
+ if maps_service is not None:
+ container_mock.maps_service = MagicMock(return_value=maps_service)
+ if text_service is not None:
+ container_mock.text_service = MagicMock(return_value=text_service)
+
with patch("core.container.container", container_mock):
yield container_mock
@@ -99,6 +121,7 @@ def patched_broadcaster() -> Iterator[MagicMock]:
"update_node_status",
"update_workflow_status",
"broadcast_terminal_log",
+ "broadcast_console_log",
"send_custom_event",
"broadcast_message",
"_broadcast",