Skip to content

Commit 8ae73b0

Browse files
fix: add missing CheckpointRequest model for tests
- Added CheckpointRequest Pydantic model with session_id and phase fields - Added phase validation against ALLOWED_PHASES - Fixes test import error in test_summarize_and_phase.py
1 parent 5afce49 commit 8ae73b0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/contextforge_memory/main.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,21 @@ def _select_embeddings_provider() -> EmbeddingsProvider:
347347
ALLOWED_PHASES = {"planning", "execution", "review"}
348348

349349

350+
class CheckpointRequest(BaseModel):
351+
"""Request model for checkpoint operations."""
352+
353+
session_id: str = Field(..., description="Session identifier")
354+
phase: str = Field(..., description="Checkpoint phase")
355+
356+
@field_validator("phase")
357+
@classmethod
358+
def validate_phase(cls, v: str) -> str:
359+
"""Validate that phase is one of the allowed phases."""
360+
if v not in ALLOWED_PHASES:
361+
raise ValueError(f"Phase must be one of {sorted(ALLOWED_PHASES)}, got {v}")
362+
return v
363+
364+
350365
def _get_env_int(key: str, default: int) -> int:
351366
"""Get environment variable as integer with fallback to default.
352367

0 commit comments

Comments
 (0)