Skip to content

Commit 2b8d903

Browse files
Fix critical issues from code review
- Fix SQL initialization: Use executescript() instead of execute() for multiple statements in message_store.py - Fix PROJECT_ROOT path: Reduce from 6 parents to 3 parents in server/api/mcp/config.py - Add backward compatibility shim: Support legacy dipeo_server imports in server/__init__.py - Remove hardcoded credentials: Use NGROK_AUTH environment variable in Makefile Co-authored-by: Seunghyun Ji <sorryhyun@users.noreply.github.com>
1 parent 25498f2 commit 2b8d903

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ dev-server:
162162
DIPEO_BASE_DIR="$(shell pwd)" python server/main.py 2>&1 | sed 's/^/[server] /' & \
163163
SERVER_PID=$$!; \
164164
sleep 3; \
165-
ngrok http 8000 --basic-auth "sorryhyun:sorrysorry" 2>&1 | sed 's/^/[ngrok] /' & \
165+
if [ -n "$$NGROK_AUTH" ]; then \
166+
ngrok http 8000 --basic-auth "$$NGROK_AUTH" 2>&1 | sed 's/^/[ngrok] /' & \
167+
else \
168+
ngrok http 8000 2>&1 | sed 's/^/[ngrok] /' & \
169+
fi; \
166170
NGROK_PID=$$!; \
167171
wait
168172

dipeo/infrastructure/storage/message_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, db_path: Path):
1414

1515
async def initialize(self):
1616
async with aiosqlite.connect(self.db_path) as db:
17-
await db.execute("""
17+
await db.executescript("""
1818
CREATE TABLE IF NOT EXISTS messages (
1919
id TEXT PRIMARY KEY,
2020
execution_id TEXT NOT NULL,

server/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,31 @@
1111
management, and integration with external services.
1212
"""
1313

14+
import sys
15+
from types import ModuleType
16+
1417
__version__ = "1.0.0"
18+
19+
# Backward compatibility: Make this module accessible as 'dipeo_server'
20+
# to support legacy imports (e.g., 'from dipeo_server import ...')
21+
# This allows a gradual migration from the old module structure
22+
_this_module = sys.modules[__name__]
23+
sys.modules["dipeo_server"] = _this_module
24+
25+
# Also create a dipeo_server namespace that mirrors this module's structure
26+
# This handles imports like 'from dipeo_server.api import ...'
27+
class _CompatModule(ModuleType):
28+
"""Compatibility module that redirects to the new server module."""
29+
30+
def __getattr__(self, name):
31+
# Import the actual module from server.*
32+
try:
33+
actual_module = __import__(f"server.{name}", fromlist=[name])
34+
return actual_module
35+
except ImportError:
36+
raise AttributeError(f"module 'dipeo_server' has no attribute '{name}'")
37+
38+
# Set up the compatibility module
39+
_compat_module = _CompatModule("dipeo_server")
40+
_compat_module.__path__ = _this_module.__path__ if hasattr(_this_module, '__path__') else []
41+
sys.modules["dipeo_server"] = _compat_module

server/api/mcp/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
DEFAULT_MCP_TIMEOUT = int(os.environ.get("MCP_DEFAULT_TIMEOUT", "300"))
99

10-
PROJECT_ROOT = Path(__file__).parent.parent.parent.parent.parent.parent
10+
PROJECT_ROOT = Path(__file__).parent.parent.parent
1111

1212
mcp_server = FastMCP(
1313
name="dipeo-mcp-server",

0 commit comments

Comments
 (0)