From 626e7bd9fadf2375c26f59cb9efbee2b189beb6f Mon Sep 17 00:00:00 2001 From: priyabrata-stack Date: Wed, 14 Jan 2026 16:46:26 +0530 Subject: [PATCH] fix: add safety check to metrics cleanup to prevent accidental deletion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/ui-testing/pages/apiCleanup.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ui-testing/pages/apiCleanup.js b/tests/ui-testing/pages/apiCleanup.js index ad2d142407..2e62a2a64e 100644 --- a/tests/ui-testing/pages/apiCleanup.js +++ b/tests/ui-testing/pages/apiCleanup.js @@ -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();