Skip to content

Architecture Validation: 5 critical violations found (2026-04-23) #464

Closed as not planned

Description

@vybe

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, DELETE on process_schedules
  • src/backend/routers/voice.py:176-178 — UPDATE agent_ownership directly
  • src/backend/routers/triggers.py:252-255 — SELECT * FROM process_schedules directly
  • src/backend/routers/git.py:298 — calls non-existent db.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_schedules table created ad-hoc in router
  • src/backend/services/process_engine/services/templates.py:117 — process_templates table created in service
  • src/backend/services/process_engine/services/alerts.py:163,178 — cost_thresholds and cost_alerts tables 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 NULL stores 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 direct api.get/post() calls
  • ProcessList.vue — 1 direct api.get() call
  • ProcessWizard.vue — 2 direct API calls

INV-10: Process Engine DDD Isolation — FAIL (P2)

Domain objects leaking into 4 routers:

  • routers/executions.py:19 — imports ProcessDefinition, ProcessExecution, etc. from domain
  • routers/processes.py:17 — imports from process_engine.domain
  • routers/triggers.py:21 — imports from process_engine.domain
  • routers/approvals.py:17 — imports ApprovalRequest, ApprovalStatus from 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)

  1. [P0] Move process_schedules, process_templates, cost_thresholds, cost_alerts DDL to db/schema.py + db/migrations.py; remove all inline CREATE TABLE
  2. [P0] Encrypt Slack bot tokens in slack_link_connections table using AES-256-GCM
  3. [P1] Refactor SQL in processes.py, voice.py, triggers.py into proper db/ layer classes
  4. [P1] Fix broken db.execute_query() call in git.py
  5. [P2] Move Process views' direct API calls to Pinia stores
  6. [P2] Route process engine domain objects through service interfaces, not directly into routers

Generated by scheduled /validate-architecture run

Activity

  1. added
    priority-p1
    type-bug
    automated
    on Apr 23, 2026
  2. vybe commented on Apr 25, 2026

    @vybe
    ContributorAuthor

    Superseded by newer auto-validation snapshot. Closing as part of grooming session 2026-04-25.

  3. added
    complexity-low
    theme-reliability
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    automatedcomplexity-lowpriority-p1theme-reliabilitytype-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions