Address all architecture review findings: P0 fixes: - Add API key authentication for admin endpoints (analytics, replay, openapi) and WebSocket connections via ADMIN_API_KEY env var - Add PostgreSQL-backed PgSessionManager and PgInterruptManager for multi-worker production deployments (in-memory defaults preserved) P1 fixes: - Implement actual tool generation in OpenAPI approve_job endpoint using generate_tool_code() and generate_agent_yaml() - Add missing clarification, interrupt_expired, and tool_result message handlers in frontend ChatPage P2 fixes: - Replace monkey-patching on CompiledStateGraph with typed GraphContext - Replace 9-param dispatch_message with WebSocketContext dataclass - Extract duplicate _envelope() into shared app/api_utils.py - Replace mutable module-level counter with crypto.randomUUID() - Remove hardcoded mock data from ReviewPage, use api.ts wrappers - Remove `as any` type escape from ReplayPage All 516 tests passing, 0 TypeScript errors.
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Tests for app.main module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from app.main import AGENTS_YAML, FRONTEND_DIST, app
|
|
|
|
|
|
@pytest.mark.unit
|
|
class TestMainModule:
|
|
def test_app_title(self) -> None:
|
|
assert app.title == "Smart Support"
|
|
|
|
def test_app_version(self) -> None:
|
|
assert app.version == "0.6.0"
|
|
|
|
def test_agents_yaml_path_exists(self) -> None:
|
|
assert AGENTS_YAML.name == "agents.yaml"
|
|
|
|
def test_frontend_dist_path(self) -> None:
|
|
assert "frontend" in str(FRONTEND_DIST)
|
|
assert "dist" in str(FRONTEND_DIST)
|
|
|
|
def test_websocket_route_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert "/ws" in routes
|
|
|
|
def test_replay_router_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert any("replay" in p or "conversations" in p for p in routes)
|
|
|
|
def test_analytics_router_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert any("analytics" in p for p in routes)
|
|
|
|
def test_health_route_registered(self) -> None:
|
|
routes = [r.path for r in app.routes if hasattr(r, "path")]
|
|
assert "/api/health" in routes
|
|
|
|
def test_app_version_is_0_5_0(self) -> None:
|
|
assert app.version == "0.6.0"
|