Skip to content

Self-improving AI Employees for everyone

fix(tests+nodes): unbreak CI plugin discovery on Linux

trohitg7ba62735e8d5
diff --git a/server/nodes/location/__init__.py b/server/nodes/location/__init__.py
index e2eeead7..02341502 100644
--- a/server/nodes/location/__init__.py
+++ b/server/nodes/location/__init__.py
@@ -14,43 +14,18 @@ Self-registration on import:
belt-and-braces approach makes the registration deterministic.
"""
-from core.logging import get_logger
from services.plugin.service_factories import register_service_factory
from ._service import MapsService
-logger = get_logger(__name__)
-
-# Diagnostic block: the previous CI run silently dropped the three
-# gmaps registrations even though the eager imports below appeared
-# to run. Log NODE_METADATA membership on either side of the eager
-# imports so the next CI run reveals which side of the registration
-# is broken. Remove once diagnosed.
-import sys as _sys
-
-logger.info(
- "[location] pre-eager-import sys.modules: "
- "gmaps_create=%s gmaps_locations=%s gmaps_nearby_places=%s",
- "nodes.location.gmaps_create" in _sys.modules,
- "nodes.location.gmaps_locations" in _sys.modules,
- "nodes.location.gmaps_nearby_places" in _sys.modules,
-)
-try:
- from . import gmaps_create as _gmaps_create # noqa: F401 — registers GmapsCreateNode
- from . import gmaps_locations as _gmaps_locations # noqa: F401 — registers GmapsLocationsNode
- from . import gmaps_nearby_places as _gmaps_nearby_places # noqa: F401 — registers GmapsNearbyPlacesNode
- logger.info("[location] eager imports succeeded")
-except Exception:
- logger.exception("[location] eager imports raised")
-
-from models.node_metadata import NODE_METADATA as _NM
-
-logger.info(
- "[location] post-eager-import NODE_METADATA: "
- "gmaps_create=%s gmaps_locations=%s gmaps_nearby_places=%s",
- "gmaps_create" in _NM,
- "gmaps_locations" in _NM,
- "gmaps_nearby_places" in _NM,
-)
+# Eager-import the three gmaps subpackages so their ``BaseNode``
+# subclasses auto-register regardless of ``pkgutil.walk_packages``
+# recursion quirks on CI Linux. The factory call below runs
+# unconditionally after these — if any eager import raises, the
+# exception propagates and ``nodes/__init__.py:_discover`` catches +
+# logs it (and the factory test will catch the missing registration).
+from . import gmaps_create as _gmaps_create # noqa: F401 — registers GmapsCreateNode
+from . import gmaps_locations as _gmaps_locations # noqa: F401 — registers GmapsLocationsNode
+from . import gmaps_nearby_places as _gmaps_nearby_places # noqa: F401 — registers GmapsNearbyPlacesNode
register_service_factory("maps", MapsService)
diff --git a/server/tests/conftest.py b/server/tests/conftest.py
index b9d72efd..0d196c40 100644
--- a/server/tests/conftest.py
+++ b/server/tests/conftest.py
@@ -91,6 +91,7 @@ _make_submodule(
)
_make_submodule("core", "container", {"container": MagicMock()})
_make_submodule("core", "database", {"Database": MagicMock})
+_make_submodule("core", "credentials_database", {"CredentialsDatabase": MagicMock})
_make_submodule("core", "config", {"Settings": MagicMock})
_make_submodule("core", "cache", {"CacheService": MagicMock})
@@ -104,6 +105,8 @@ _TEST_MACHINA_ROOT = Path(__file__).parent / "_test_machina_root"
_make_submodule("core", "paths", {
"project_root": lambda: _TEST_MACHINA_ROOT.parent,
"machina_root": lambda: _TEST_MACHINA_ROOT,
+ "packages_dir": lambda: _TEST_MACHINA_ROOT / "packages",
+ "package_dir": lambda name: _TEST_MACHINA_ROOT / "packages" / name,
"claude_config_dir": lambda: _TEST_MACHINA_ROOT / "claude",
"claude_npm_dir": lambda: _TEST_MACHINA_ROOT / "claude" / "npm",
"workspaces_dir": lambda: _TEST_MACHINA_ROOT / "workspaces",
diff --git a/server/tests/test_workflow_validator.py b/server/tests/test_workflow_validator.py
index 68a6b4d2..6a655462 100644
--- a/server/tests/test_workflow_validator.py
+++ b/server/tests/test_workflow_validator.py
@@ -393,11 +393,12 @@ class TestRemapNodeIds:
import glob
import json
- from services.example_loader import EXAMPLES_DIR
+ from core.paths import example_workflows_dir
from services.workflow_import import remap_node_ids
+ examples_dir = example_workflows_dir()
all_ids = collections.defaultdict(list)
- for path in sorted(glob.glob(str(EXAMPLES_DIR / "*.json"))):
+ for path in sorted(glob.glob(str(examples_dir / "*.json"))):
with open(path, encoding="utf-8") as fh:
wf = json.load(fh)
nodes, _, _ = remap_node_ids(