Automated Architecture Validation Report
Date : 2026-04-28
Result : 5 violations found — 2 critical (P0-P1), 3 moderate
Critical Findings (P0-P1)
Invariant #1 — Three-Layer Backend: Router → Service → DB
Raw SQL found in router files (routers must not contain SQL):
routers/telegram.py
routers/public.py
routers/auth.py
routers/fan_out.py
routers/slack.py
routers/triggers.py
routers/voice.py
routers/processes.py
routers/git.py
Fix : Move all SQL into db/ layer modules.
Invariant #3 — Schema in db/schema.py, Migrations in db/migrations.py
CREATE TABLE statements found outside schema.py/migrations.py:
routers/processes.py — CREATE TABLE IF NOT EXISTS process_schedules
services/process_engine/services/templates.py — CREATE TABLE IF NOT EXISTS process_templates
services/process_engine/services/alerts.py — CREATE TABLE IF NOT EXISTS cost_thresholds, cost_alerts
Fix : Move DDL to db/schema.py and add versioned migrations in db/migrations.py.
Moderate Findings
Invariant #6 — Frontend: Store = Domain, View = Page
Direct api.get/post calls in view components (should go through Pinia stores):
ProcessList.vue:404
ProcessWizard.vue:522, 600
ProcessEditor.vue:1100, 1181, 1230, 1339, 1500
Invariant #10 — Process Engine: DDD Isolation
Router files import directly from process_engine.domain and process_engine.repositories (should only interact via service facades):
routers/executions.py — multiple domain/engine imports
routers/processes.py — multiple domain/repository imports
routers/approvals.py, routers/audit.py, routers/triggers.py, routers/alerts.py
Invariant #15 — Pydantic Models Centralized in models.py
87 model classes defined in routers vs 26 in models.py (77% scattered):
Heaviest offenders: settings.py (8), processes.py (8), telegram.py (6), executions.py (6)
Recommended Actions
P0 : Move SQL out of all router files into db/ layer modules (Fix: Add missing Docker labels to system agent container #1 )
P0 : Move ad-hoc CREATE TABLE into schema.py + migrations.py (Feature/vector log retention #3 )
P1 : Refactor Process Engine router imports to use service facades only (Feature/process engine #10 )
P2 : Move view-level API calls into Pinia stores (Feature/process engine #6 )
P2 : Migrate scattered Pydantic models to models.py (Security: Agent Credential Leakage in Execution Logs [FIXED] #15 )
Generated by scheduled /validate-architecture run
Automated Architecture Validation Report
Date: 2026-04-28
Result: 5 violations found — 2 critical (P0-P1), 3 moderate
Critical Findings (P0-P1)
Invariant #1 — Three-Layer Backend: Router → Service → DB
Raw SQL found in router files (routers must not contain SQL):
routers/telegram.pyrouters/public.pyrouters/auth.pyrouters/fan_out.pyrouters/slack.pyrouters/triggers.pyrouters/voice.pyrouters/processes.pyrouters/git.pyFix: Move all SQL into
db/layer modules.Invariant #3 — Schema in
db/schema.py, Migrations indb/migrations.pyCREATE TABLEstatements found outsideschema.py/migrations.py:routers/processes.py—CREATE TABLE IF NOT EXISTS process_schedulesservices/process_engine/services/templates.py—CREATE TABLE IF NOT EXISTS process_templatesservices/process_engine/services/alerts.py—CREATE TABLE IF NOT EXISTS cost_thresholds,cost_alertsFix: Move DDL to
db/schema.pyand add versioned migrations indb/migrations.py.Moderate Findings
Invariant #6 — Frontend: Store = Domain, View = Page
Direct
api.get/postcalls in view components (should go through Pinia stores):ProcessList.vue:404ProcessWizard.vue:522, 600ProcessEditor.vue:1100, 1181, 1230, 1339, 1500Invariant #10 — Process Engine: DDD Isolation
Router files import directly from
process_engine.domainandprocess_engine.repositories(should only interact via service facades):routers/executions.py— multiple domain/engine importsrouters/processes.py— multiple domain/repository importsrouters/approvals.py,routers/audit.py,routers/triggers.py,routers/alerts.pyInvariant #15 — Pydantic Models Centralized in
models.py87 model classes defined in routers vs 26 in
models.py(77% scattered):settings.py(8),processes.py(8),telegram.py(6),executions.py(6)Recommended Actions
db/layer modules (Fix: Add missing Docker labels to system agent container #1)CREATE TABLEintoschema.py+migrations.py(Feature/vector log retention #3)models.py(Security: Agent Credential Leakage in Execution Logs [FIXED] #15)Generated by scheduled /validate-architecture run