Felipe Cardoso
26fd776927
fix(memory): address review findings from Issue #88
Fixes based on multi-agent review:
Model Improvements:
- Remove duplicate index ix_procedures_agent_type (already indexed via Column)
- Fix postgresql_where to use text() instead of string literal in Fact model
- Add thread-safety to Procedure.success_rate property (snapshot values)
Data Integrity Constraints:
- Add CheckConstraint for Episode: importance_score 0-1, duration >= 0, tokens >= 0
- Add CheckConstraint for Fact: confidence 0-1
- Add CheckConstraint for Procedure: success_count >= 0, failure_count >= 0
Migration Updates:
- Add check constraints creation in upgrade()
- Add check constraints removal in downgrade()
Note: SQLAlchemy Column default=list is correct (callable factory pattern)