Skip to content

Schema Validation: 25 critical drift issues — schema.py incomplete (11 tables + 14 columns missing) #655

Closed as not planned

Description

@vybe

Automated Schema Validation Report

Date: 2026-05-05
Result: 25 critical schema drift issues — schema.py is incomplete relative to db/migrations.py


Background

schema.py declares itself as containing "all CREATE TABLE and CREATE INDEX statements" and is referenced by Architectural Invariant #3. However, 11 tables and 14 columns that exist in running databases are absent from schema.py. The system works correctly at runtime due to the double-pass migration pattern (migrations run before and after init_schema), but schema.py is not the authoritative reference it claims to be.


Critical Finding 1: 11 tables exist only in migrations (not in schema.py)

Table Migration Feature
agent_notifications agent_notifications NOTIF-001
subscription_credentials subscription_credentials SUB-001
subscription_rate_limit_events subscription_rate_limit_tracking SUB-003
telegram_bindings telegram_bindings TELEGRAM-001
telegram_chat_links telegram_bindings TELEGRAM-001
telegram_group_configs telegram_group_configs TGRAM-GROUP
slack_workspaces slack_channel_agents SLACK-002
slack_channel_agents slack_channel_agents SLACK-002
slack_active_threads slack_channel_agents SLACK-002
whatsapp_bindings whatsapp_bindings WHATSAPP-001
whatsapp_chat_links whatsapp_bindings WHATSAPP-001

Critical Finding 2: 14 columns exist only in migrations (not in schema.py DDL)

agent_ownership (3 columns):

  • full_capabilities INTEGER DEFAULT 0
  • voice_system_prompt TEXT (VOICE-005)
  • max_backlog_depth INTEGER DEFAULT 50 (BACKLOG-001)

agent_schedules (2 columns):

  • webhook_token TEXT (WEBHOOK-001)
  • webhook_enabled INTEGER DEFAULT 0 (WEBHOOK-001)

schedule_executions (9 columns):

  • source_user_id INTEGER, source_user_email TEXT, source_agent_name TEXT, source_mcp_key_id TEXT, source_mcp_key_name TEXT (AUDIT-001)
  • claude_session_id TEXT (EXEC-023)
  • queued_at TEXT, backlog_metadata TEXT (BACKLOG-001)
  • fan_out_id TEXT (FANOUT-001)

Recommended Fix

For each migration-only table: add a matching entry to schema.py TABLES.
For each migration-only column: add it to the relevant schema.py table DDL.

The migration functions remain unchanged (they handle existing databases). The fix is purely additive to schema.py to bring it back in sync with what migrations produce on fresh installs.

Rule going forward: Every new table or column addition must be made in both schema.py (for fresh installs) and migrations.py (for existing installs).


Generated by scheduled /validate-schema run — 2026-05-05

Activity

  1. added
    priority-p1
    type-bug
    on May 5, 2026
  2. added
    complexity-medium
    theme-reliability
    on Jun 3, 2026
  3. vybe commented on Jun 10, 2026

    @vybe
    ContributorAuthor

    Duplicate of #721 — same automated Schema Validation report (11 tables + 14 columns missing from schema.py). Consolidating tracking under #721, which is linked as a sub-issue of the orchestration-invariant epic #411. Closing as duplicate.

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

    complexity-mediumpriority-p1theme-reliabilitytype-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions