Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(tests): unbreak 7 pre-existing failures so CI predeploy goes green
trohitgc4f0c4575d6a
diff --git a/server/services/example_loader.py b/server/services/example_loader.pyindex da4bd445..adda70d7 100644--- a/server/services/example_loader.py+++ b/server/services/example_loader.py@@ -14,6 +14,12 @@ from core.paths import example_workflows_dirlogger = logging.getLogger(__name__)+# Module-level alias so callers (and the workflow-validator contract+# test in ``tests/test_workflow_validator.py``) can ``glob(EXAMPLES_DIR /+# "*.json")`` without re-resolving the path on every call.+EXAMPLES_DIR = example_workflows_dir()++def get_example_workflows() -> List[Dict[str, Any]]:"""Load all example workflow JSON files from disk."""examples = []diff --git a/server/tests/credentials/test_credential_broadcasts.py b/server/tests/credentials/test_credential_broadcasts.pyindex 12d21278..df8469ea 100644--- a/server/tests/credentials/test_credential_broadcasts.py+++ b/server/tests/credentials/test_credential_broadcasts.py@@ -260,20 +260,29 @@ class TestCredentialRuntimeFailureBroadcast:)def test_basenode_permission_branch_broadcasts(self):- """BaseNode.execute's PermissionError branch must call+ """BaseNode's PermissionError branch must callbroadcast_credential_event (CloudEvents path) so the wire emits- a credential.<auth>.runtime_failed event the frontend can route."""+ a credential.<auth>.runtime_failed event the frontend can route.++ The actual try/except + broadcast lives in ``_execute_body``;+ ``execute`` is a thin shell that opens the log-context + OTEL+ span and delegates. Inspect both so the contract holds regardless+ of which method owns the branch.+ """from services.plugin import base as base_module- src = inspect.getsource(base_module.BaseNode.execute)+ src = (+ inspect.getsource(base_module.BaseNode.execute)+ + inspect.getsource(base_module.BaseNode._execute_body)+ )assert _BROADCAST_PATTERN.search(src), (- "BaseNode.execute must broadcast on PermissionError so missing "+ "BaseNode must broadcast on PermissionError so missing ""credentials surface to the Credentials modal. Reuses the ""existing broadcast contract — same regex as mutation handlers.")# Type string convention: credential.<auth>.runtime_failedassert "runtime_failed" in src, (- "BaseNode.execute should emit credential.<auth>.runtime_failed "+ "BaseNode should emit credential.<auth>.runtime_failed ""(matches the credential.oauth.connected naming convention).")diff --git a/server/tests/nodes/test_telegram_social.py b/server/tests/nodes/test_telegram_social.pyindex d821dad0..c33bd789 100644--- a/server/tests/nodes/test_telegram_social.py+++ b/server/tests/nodes/test_telegram_social.py@@ -355,7 +355,16 @@ class TestSocialSend:return_value={"success": True, "message_id": "wamid.xyz"})- with patch("nodes.whatsapp._service.handle_whatsapp_send", whatsapp_send):+ # The social node resolves the platform handler via the+ # social_provider_registry (Wave 11.I plugin self-registration).+ # Patching nodes.whatsapp._service.handle_whatsapp_send does NOT+ # affect the registered handler — the registry captured a strong+ # ref to the original function object at import time. Patch the+ # registry lookup instead.+ with patch(+ "services.plugin.social_provider_registry.get_social_send_handler",+ return_value=whatsapp_send,+ ):result = await harness.execute("socialSend",{@@ -425,7 +434,12 @@ class TestSocialSend:return_value={"success": False, "error": "rpc boom"})- with patch("nodes.whatsapp._service.handle_whatsapp_send", whatsapp_send):+ # See test_whatsapp_text_happy_path: patch the registry lookup,+ # not the module attribute the registry already captured.+ with patch(+ "services.plugin.social_provider_registry.get_social_send_handler",+ return_value=whatsapp_send,+ ):result = await harness.execute("socialSend",{diff --git a/server/tests/nodes/test_twitter.py b/server/tests/nodes/test_twitter.pyindex ffc267ed..20a34c10 100644--- a/server/tests/nodes/test_twitter.py+++ b/server/tests/nodes/test_twitter.py@@ -598,8 +598,8 @@ class TestTwitterReceive:waiter = _make_waiter_stub(canned_event=self.CANNED)with patched_broadcaster(), patch(- "services.node_executor.event_waiter", waiter- ), patch("services.handlers.triggers.event_waiter", waiter):+ "services.handlers.triggers.event_waiter", waiter+ ):result = await harness.execute("twitterReceive",{"trigger_type": "mentions", "poll_interval": 60},@@ -619,8 +619,8 @@ class TestTwitterReceive:waiter.wait_for_event = AsyncMock(side_effect=asyncio.CancelledError())with patched_broadcaster(), patch(- "services.node_executor.event_waiter", waiter- ), patch("services.handlers.triggers.event_waiter", waiter):+ "services.handlers.triggers.event_waiter", waiter+ ):result = await harness.execute("twitterReceive", {"trigger_type": "mentions"})@@ -634,8 +634,8 @@ class TestTwitterReceive:waiter.get_trigger_config = MagicMock(return_value=None)with patched_broadcaster(), patch(- "services.node_executor.event_waiter", waiter- ), patch("services.handlers.triggers.event_waiter", waiter):+ "services.handlers.triggers.event_waiter", waiter+ ):result = await harness.execute("twitterReceive", {"trigger_type": "mentions"})@@ -649,8 +649,8 @@ class TestTwitterReceive:waiter.wait_for_event = AsyncMock(side_effect=RuntimeError("boom"))with patched_broadcaster(), patch(- "services.node_executor.event_waiter", waiter- ), patch("services.handlers.triggers.event_waiter", waiter):+ "services.handlers.triggers.event_waiter", waiter+ ):result = await harness.execute("twitterReceive", {"trigger_type": "mentions"})