fix: add safety check to metrics cleanup to prevent accidental deletion

Add validation to ensure patterns array is not empty before attempting
to clean up metrics streams. This prevents accidental deletion of all
metrics streams if the method is called without proper patterns.

Safety improvement for cleanupMetricsStreams() method.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
priyabrata-stack
2026-01-16 18:48:25 +05:30
co-authored by Claude Sonnet 4.5
parent 0a8d1e4312
commit 626e7bd9fa
+6
View File
@@ -1039,6 +1039,12 @@ class APICleanup {
protectedStreams
});
// Safety check: If no patterns provided, don't delete anything
if (patterns.length === 0) {
testLogger.info('No patterns provided for metrics cleanup - skipping');
return;
}
try {
// Fetch all metrics streams
const streams = await this.fetchMetricsStreams();