Skip to content

Commit f843229

Browse files
committed
fix(client,langchain,tests): closed-loop guard, relationships TODO, remove dead fixture
- client.py: raise RuntimeError in _run() when event loop is closed (prevents obscure 'Event loop is closed' error when client reused after close()) - langchain graph.py: add TODO comment on empty relationships list explaining schema text lacks direction info; document Cypher introspection path - test_sdk.py: remove unused run fixture (manual event loop, never referenced by any test); remove orphaned asyncio import
1 parent cc786bb commit f843229

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

coordinode/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ def close(self) -> None:
365365
self._loop.close()
366366

367367
def _run(self, coro: Any) -> Any:
368+
if self._loop.is_closed():
369+
raise RuntimeError("CoordinodeClient has been closed and cannot be reused")
368370
if not self._connected:
369371
self._loop.run_until_complete(self._async.connect())
370372
self._connected = True

langchain-coordinode/langchain_coordinode/graph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def _parse_schema(schema_text: str) -> dict[str, Any]:
129129
"""
130130
node_props: dict[str, list[dict[str, str]]] = {}
131131
rel_props: dict[str, list[dict[str, str]]] = {}
132+
# TODO: CoordiNode's schema text does not include relationship direction info
133+
# (start_label → end_label). Populate via Cypher introspection when needed:
134+
# MATCH (a)-[r]->(b) RETURN DISTINCT labels(a)[0], type(r), labels(b)[0]
132135
relationships: list[dict[str, str]] = []
133136

134137
in_nodes = False

tests/integration/test_sdk.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from __future__ import annotations
99

10-
import asyncio
1110
import os
1211
import uuid
1312

@@ -27,13 +26,6 @@ def client():
2726
yield c
2827

2928

30-
@pytest.fixture(scope="module")
31-
def run():
32-
"""Run a coroutine synchronously (re-used event loop for the module)."""
33-
loop = asyncio.new_event_loop()
34-
yield loop.run_until_complete
35-
loop.close()
36-
3729

3830
def uid() -> str:
3931
return uuid.uuid4().hex[:8]

0 commit comments

Comments
 (0)