fix: make boolean fields resilient to NULL values

Problem: Features with NULL values in passes/in_progress fields caused
Pydantic validation errors in the API.

Solution - defense in depth:
1. Database model: Add nullable=False to passes and in_progress columns
2. Migration: Auto-fix existing NULL values to False on database connect
3. API layer: Handle NULL gracefully in feature_to_response (treat as False)
4. MCP server: Explicitly set in_progress=False when creating features

This ensures:
- New databases cannot have NULL boolean fields
- Existing databases are auto-migrated on connect
- Even if NULL values exist, they're handled gracefully at runtime

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Quenos
2026-01-13 11:47:46 +01:00
parent 07c2010d32
commit 3c97051122
3 changed files with 28 additions and 8 deletions

View File

@@ -409,6 +409,7 @@ def feature_create_bulk(
description=feature_data["description"],
steps=feature_data["steps"],
passes=False,
in_progress=False,
)
session.add(db_feature)
created_count += 1
@@ -459,6 +460,7 @@ def feature_create(
description=description,
steps=steps,
passes=False,
in_progress=False,
)
session.add(db_feature)
session.commit()