Elevate MiroFish/CrowdSight from single-container dev to a SaaS foundation: - Local memory backend (Zep-compatible): memory services/models, local graph builder + updater, AgentActivity seam, import-boundary isolation; Zep stays default, local is opt-in behind MEMORY_BACKEND. Semantic parity not yet proven. - Durable product persistence: projects/simulations/reports schema (migration 0007) + tenant/owner-scoped ProductRepository + dual-write + scoped_project read-first + ArtifactStore abstraction; durable JobQueue + worker.py. - SaaS hardening: durable RateLimiter (wired to login), UsageService (LLM accounting), redacted AuditService, idempotency, CORS allowlist, safe API errors, single-use PasswordResetService + endpoints (covers invite-pending). - Exactly 3 roles (super_admin/admin/user) with tenant authz policy. - Admin UI: GET/POST/PATCH /api/admin/users + GET/PUT /api/admin/settings (super-admin only, encrypted/masked); AdminView.vue + SettingsView.vue with admin/super-admin route guards, th/en i18n. - Production deploy topology: multi-stage Dockerfile (frontend build + gunicorn wsgi + nginx SPA-proxy + supervisord worker), backend/wsgi.py, gunicorn dep. Backend 197 passed; frontend 10 tests + build green. ruff unavailable (gap). No commit of credentials; secrets handled via env/.env.example. Deferred: Zep semantic A/B parity, object storage cutover, mobile QA, EasyPanel container build of deploy topology.
28 lines
861 B
Python
28 lines
861 B
Python
import pytest
|
|
|
|
from app.config import Config
|
|
from app.services.simulation_manager import SimulationManager
|
|
|
|
|
|
def test_simulation_manager_uses_injected_entity_reader_factory():
|
|
sentinel = object()
|
|
calls = []
|
|
|
|
def factory(graph_id):
|
|
calls.append(graph_id)
|
|
return sentinel
|
|
|
|
manager = SimulationManager(entity_reader_factory=factory)
|
|
assert manager.create_entity_reader("graph-local") is sentinel
|
|
assert calls == ["graph-local"]
|
|
|
|
|
|
def test_local_backend_refuses_unscoped_zep_reader_fallback(monkeypatch, tmp_path):
|
|
monkeypatch.setattr(Config, "MEMORY_BACKEND", "local")
|
|
monkeypatch.setattr(SimulationManager, "SIMULATION_DATA_DIR", str(tmp_path))
|
|
|
|
manager = SimulationManager()
|
|
|
|
with pytest.raises(ValueError, match="local_entity_reader_factory_required"):
|
|
manager.create_entity_reader("graph-local")
|