Skip to content

Commit 966e029

Browse files
Refresh analytics cache after delete-staged completes
After deletion execution completes, automatically rebuild the Parquet analytics cache with a full refresh. This ensures the cache reflects updated deleted_from_source_at timestamps, so subsequent MCP queries and TUI views correctly exclude deleted messages. Fixes issue where stage_deletion would include already-deleted messages because the Parquet cache was stale. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 211e96b commit 966e029

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmd/msgvault/cmd/deletions.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,19 @@ Examples:
472472
}
473473

474474
fmt.Println("\nDeletion complete!")
475+
476+
// Refresh analytics cache to reflect deleted messages
477+
analyticsDir := cfg.AnalyticsDir()
478+
if _, err := os.Stat(analyticsDir); err == nil {
479+
fmt.Println("\nRefreshing analytics cache...")
480+
if result, err := buildCache(dbPath, analyticsDir, true); err != nil {
481+
fmt.Fprintf(os.Stderr, "Warning: failed to refresh cache: %v\n", err)
482+
fmt.Fprintf(os.Stderr, "Run 'msgvault build-cache --full-rebuild' manually to update.\n")
483+
} else if !result.Skipped {
484+
fmt.Printf("Cache refreshed (%d messages).\n", result.ExportedCount)
485+
}
486+
}
487+
475488
return nil
476489
},
477490
}

0 commit comments

Comments
 (0)