Teaches l1_walk_sessions a new session_kind='ai_build' for AI-generated decision-tree walks. FK shape matches adhoc: both flow_id and flow_proposal_id must be NULL. Drops and recreates the two affected CHECK constraints (session_kind allowlist + target_consistency). Migration beca7464b6b4 chains from b3358ba0e48c. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
17 lines
505 B
Python
17 lines
505 B
Python
import uuid
|
|
|
|
from app.models.l1_walk_session import L1WalkSession
|
|
|
|
|
|
def test_ai_build_session_kind_allowed_by_model_constraint():
|
|
"""ai_build is a valid session_kind with both target FKs null (like adhoc)."""
|
|
s = L1WalkSession(
|
|
account_id=uuid.uuid4(),
|
|
created_by_user_id=uuid.uuid4(),
|
|
ticket_id="t1",
|
|
ticket_kind="internal",
|
|
session_kind="ai_build",
|
|
)
|
|
assert s.session_kind == "ai_build"
|
|
assert s.flow_id is None and s.flow_proposal_id is None
|