feat: add backend validation for fallback steps (Task 16)

Validate fallback_steps in procedural flow validation: required fields,
no nested fallback_steps, no duplicate IDs. Add FallbackStepRecord schema
and fallback_decisions field to SessionResponse.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-16 01:13:34 -04:00
parent 5e4d323ef1
commit a0ba253428
3 changed files with 64 additions and 0 deletions

View File

@@ -98,6 +98,9 @@ class SessionResponse(BaseModel):
psa_ticket_id: Optional[str] = None
psa_connection_id: Optional[UUID] = None
# Fallback step decisions
fallback_decisions: list[dict[str, Any]] = Field(default_factory=list)
class Config:
from_attributes = True
@@ -123,6 +126,14 @@ class SessionComplete(BaseModel):
next_steps: Optional[str] = None
class FallbackStepRecord(BaseModel):
parent_step_id: str
fallback_step_id: str
completed_at: str | None = None
notes: str | None = None
outcome: Literal['resolved', 'not_resolved', 'skipped']
class SessionVariablesUpdate(BaseModel):
"""Partial update to session variables (dict merge)."""
variables: dict[str, str] = Field(..., description="Key-value pairs to merge into session_variables")