fix: add status_update to step_type CHECK constraint
The generate_status_update service inserted AISessionStep with step_type='status_update' which violated the DB CHECK constraint, causing a 500 error. Also fix incorrect field name confidence_score (should be confidence_at_step) and remove nonexistent confidence_tier. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
backend/alembic/versions/069_add_status_update_step_type.py
Normal file
31
backend/alembic/versions/069_add_status_update_step_type.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""add status_update to ai_session_steps step_type constraint
|
||||
|
||||
Revision ID: 069
|
||||
Revises: 068
|
||||
Create Date: 2026-03-29
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision = "069"
|
||||
down_revision = "068"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_constraint("ck_ai_session_steps_step_type", "ai_session_steps", type_="check")
|
||||
op.create_check_constraint(
|
||||
"ck_ai_session_steps_step_type", "ai_session_steps",
|
||||
"step_type IN ('question', 'action', 'script_generation', 'verification', "
|
||||
"'info_request', 'note', 'intake_analysis', 'fork', 'status_update')",
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_constraint("ck_ai_session_steps_step_type", "ai_session_steps", type_="check")
|
||||
op.create_check_constraint(
|
||||
"ck_ai_session_steps_step_type", "ai_session_steps",
|
||||
"step_type IN ('question', 'action', 'script_generation', 'verification', "
|
||||
"'info_request', 'note', 'intake_analysis', 'fork')",
|
||||
)
|
||||
@@ -36,7 +36,7 @@ class AISessionStep(Base):
|
||||
__table_args__ = (
|
||||
CheckConstraint(
|
||||
"step_type IN ('question', 'action', 'script_generation', 'verification', "
|
||||
"'info_request', 'note', 'intake_analysis', 'fork')",
|
||||
"'info_request', 'note', 'intake_analysis', 'fork', 'status_update')",
|
||||
name="ck_ai_session_steps_step_type",
|
||||
),
|
||||
)
|
||||
|
||||
@@ -992,8 +992,7 @@ async def generate_status_update(
|
||||
"generated_content": raw_response.strip(),
|
||||
"client_name": client_name,
|
||||
},
|
||||
confidence_score=1.0,
|
||||
confidence_tier="high",
|
||||
confidence_at_step=1.0,
|
||||
)
|
||||
db.add(step)
|
||||
session.step_count += 1
|
||||
|
||||
Reference in New Issue
Block a user