feat(CF-580): Add schema support and metadata tracking for session notes recovery

- Migration 025: Add 'abandoned' status to sessions CHECK constraint (fixes blocking issue)
- Migration 026: Add recovery metadata columns (recovered_from, recovered_at) to track note recovery source
- Update sessionRecoverOrphaned to recover notes from temp files when marking sessions abandoned
- Update notes-parser to track recovery source and timestamp for analytics

These changes complete Priority 3, 5 and part of Priority 1 for CF-572 Session Notes Loss fix.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-29 17:12:21 +02:00
parent 64e90376f7
commit 30650cf47f
4 changed files with 50 additions and 4 deletions

View File

@@ -0,0 +1,13 @@
-- Migration 025: Add 'abandoned' status to sessions
-- Purpose: Fix CF-572 schema constraint issue preventing orphan recovery
-- Context: sessionRecoverOrphaned() tries to set status='abandoned' but constraint only allows 'active', 'completed', 'interrupted'
ALTER TABLE sessions
DROP CONSTRAINT IF EXISTS sessions_status_check;
ALTER TABLE sessions
ADD CONSTRAINT sessions_status_check
CHECK (status IN ('active', 'completed', 'interrupted', 'abandoned'));
COMMENT ON CONSTRAINT sessions_status_check ON sessions
IS 'Valid session statuses including abandoned for orphaned sessions (CF-572)';