Repository navigation
Description
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 0voice_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
feat(db): configurable backend seam + PostgreSQL schema bootstrap (#300)
feat(db): configurable backend seam + PostgreSQL schema bootstrap (#300)
vybe commentedon Jun 10, 2026
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.
feat(db): configurable backend seam + PostgreSQL schema bootstrap (#300)
feat(db): configurable backend seam + PostgreSQL schema bootstrap (#300)
feat(db): configurable database backend — experimental PostgreSQL sup…