Skip to content

Architecture Validation: 5 critical violations found (2026-04-30) #603

Closed as not planned

Description

@vybe

Automated Architecture Validation Report

Date: 2026-04-30
Result: 5 critical violations require attention (4 P0-P1 invariants failing)

Critical Findings (P0-P1)

Invariant 1: Three-Layer Backend — Router → Service → DB (FAIL)

Routers contain raw SQL that belongs in the DB layer:

  • src/backend/routers/voice.py:177 — cursor.execute("UPDATE agent_ownership...")
  • src/backend/routers/voice.py:306 — cursor.execute("SELECT voice_system_prompt...")
  • src/backend/routers/triggers.py:254 — cursor.execute("SELECT * FROM process_schedules...")
  • src/backend/routers/processes.py:780 — CREATE TABLE IF NOT EXISTS process_schedules
  • src/backend/routers/processes.py:819 — INSERT OR REPLACE INTO process_schedules
  • src/backend/routers/processes.py:865 — DELETE FROM process_schedules

Invariant 3: Schema in db/schema.py, Migrations in db/migrations.py (FAIL)

CREATE TABLE statements found outside the designated schema files:

  • src/backend/routers/processes.py:780 — creates process_schedules table ad-hoc
  • src/backend/services/process_engine/services/templates.py:117 — creates process_templates table ad-hoc
  • src/backend/services/process_engine/services/alerts.py:163,178 — creates cost_thresholds and cost_alerts tables ad-hoc

Invariant 8: Auth Pattern — Missing authentication (FAIL)

Route handlers found without get_current_user, AuthorizedAgent, or OwnedAgentByName:

  • src/backend/routers/executions.py:320 — @router.post("/processes/{process_id}/execute") missing auth dependency (HIGH RISK — unauthenticated process execution)

Invariant 13: Credentials Never Stored in DB (FAIL)

Plaintext credential found in schema:

  • src/backend/db/schema.py:537 — slack_bot_token TEXT NOT NULL in slack_link_connections table stores Slack bot token as plaintext
  • src/backend/db/slack.py:38-42 — Direct INSERT without encryption
  • Should follow the subscription_credentials pattern using AES-256-GCM encryption

Additional Non-Critical Findings (P2-P3)

  • Invariant 6 (Frontend Store Pattern): ProcessList.vue, ProcessWizard.vue, ProcessEditor.vue import api directly instead of routing through Pinia stores
  • Invariant 7 (Single API Client): Multiple views use raw fetch() instead of api client (ApiKeys.vue, AgentDetail.vue, Approvals.vue, ExecutionTimeline.vue, ProcessEditor.vue, ProcessDocs.vue)
  • Invariant 15 (Pydantic Models Centralized): 91+ Pydantic models scattered across 25+ router files instead of centralized in models.py

Recommended Actions

  1. [P1] Fix SQL in routers — Move voice.py and triggers.py SQL to DB layer classes; refactor processes.py process_schedules operations into db/ module
  2. [P1] Fix ad-hoc CREATE TABLE — Move process_schedules, process_templates, cost_thresholds, cost_alerts DDL into db/schema.py with versioned migration in db/migrations.py
  3. [P1] Fix missing auth on process execute endpoint — Add current_user: CurrentUser dependency to executions.py:320
  4. [P0] Encrypt slack_bot_token — Use AES-256-GCM encryption (same pattern as subscription_credentials) for slack_link_connections.slack_bot_token
  5. [P2] Refactor Process views — Move API calls from ProcessList.vue, ProcessWizard.vue, ProcessEditor.vue into Pinia stores
  6. [P3] Replace fetch() with api client — Standardize views to use api.js Axios instance
  7. [P3] Centralize Pydantic models — Migrate models from router files to models.py

Generated by scheduled /validate-architecture run

Activity

  1. added
    priority-p1
    type-bug
    automated
    on Apr 30, 2026
  2. vybe commented on May 5, 2026

    @vybe
    ContributorAuthor

    Closing as duplicate of #654 (Architecture drift). The daily validation process should update a single tracking issue rather than creating new ones each run.

  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