Repository navigation
Description
Automated Architecture Validation Report
Date: 2026-04-23
Result: 5 violations across P0-P1 invariants require immediate attention
Critical Findings (P0-P1)
INV-1: Three-Layer Backend — FAIL (P1)
Routers contain raw SQL that must live in the db/ layer:
src/backend/routers/processes.py:780-865—CREATE TABLE,INSERT,DELETEonprocess_schedulessrc/backend/routers/voice.py:176-178—UPDATE agent_ownershipdirectlysrc/backend/routers/triggers.py:252-255—SELECT * FROM process_schedulesdirectlysrc/backend/routers/git.py:298— calls non-existentdb.execute_query()method (broken code)
Fix: Move all SQL into db/ layer classes. Create db/process_schedules.py with ProcessScheduleOperations.
INV-3: Schema in schema.py/migrations.py — FAIL (P0)
CREATE TABLE statements found outside schema/migrations:
src/backend/routers/processes.py:781—process_schedulestable created ad-hoc in routersrc/backend/services/process_engine/services/templates.py:117—process_templatestable created in servicesrc/backend/services/process_engine/services/alerts.py:163,178—cost_thresholdsandcost_alertstables created in service
Fix: Move all DDL to db/schema.py. Add versioned migrations in db/migrations.py. Remove inline CREATE TABLE IF NOT EXISTS calls.
INV-13: Credentials Never Stored in DB — PARTIAL FAIL (P0)
Plaintext credential stored in database:
src/backend/db/schema.py:537—slack_link_connections.slack_bot_token TEXT NOT NULLstores Slack bot token in plaintext
Fix: Encrypt Slack bot tokens using AES-256-GCM (same approach as .credentials.enc in CRED-002). Store encrypted_bot_token instead.
Secondary Findings (P2-P3, informational)
INV-6: Frontend Views Direct API Calls — FAIL (P2)
8 API calls in 3 view files (should go through stores):
ProcessEditor.vue— 6 directapi.get/post()callsProcessList.vue— 1 directapi.get()callProcessWizard.vue— 2 direct API calls
INV-10: Process Engine DDD Isolation — FAIL (P2)
Domain objects leaking into 4 routers:
routers/executions.py:19— importsProcessDefinition,ProcessExecution, etc. from domainrouters/processes.py:17— imports fromprocess_engine.domainrouters/triggers.py:21— imports fromprocess_engine.domainrouters/approvals.py:17— importsApprovalRequest,ApprovalStatusfrom domain
INV-11: WebSocket vs Polling — FAIL (P2)
10+ setInterval loops polling API endpoints instead of using WebSocket push (stores/network.js, stores/executions.js, etc.)
INV-15: Pydantic Models Centralized — FAIL (P3)
87 Pydantic model classes scattered across 29 router files; only 26 in models.py
Recommended Actions (Priority Order)
- [P0] Move
process_schedules,process_templates,cost_thresholds,cost_alertsDDL todb/schema.py+db/migrations.py; remove all inlineCREATE TABLE - [P0] Encrypt Slack bot tokens in
slack_link_connectionstable using AES-256-GCM - [P1] Refactor SQL in
processes.py,voice.py,triggers.pyinto properdb/layer classes - [P1] Fix broken
db.execute_query()call ingit.py - [P2] Move Process views' direct API calls to Pinia stores
- [P2] Route process engine domain objects through service interfaces, not directly into routers
Generated by scheduled /validate-architecture run
Activity
vybe commentedon Apr 25, 2026
Superseded by newer auto-validation snapshot. Closing as part of grooming session 2026-04-25.