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,16 @@
-- Migration 026: Add recovery metadata to session_notes
-- Purpose: Track which notes were recovered vs normally saved for CF-572 analytics
ALTER TABLE session_notes
ADD COLUMN IF NOT EXISTS recovered_from TEXT,
ADD COLUMN IF NOT EXISTS recovered_at TIMESTAMP WITH TIME ZONE;
CREATE INDEX IF NOT EXISTS idx_session_notes_recovered
ON session_notes(recovered_from)
WHERE recovered_from IS NOT NULL;
COMMENT ON COLUMN session_notes.recovered_from
IS 'Source of recovery: "recovered" (daemon/orphan), "manual" (MCP tool), NULL (normal save)';
COMMENT ON COLUMN session_notes.recovered_at
IS 'Timestamp when note was recovered (NULL for normal saves)';