From e542d390496e99dce19a053a8787bbc1d26db320 Mon Sep 17 00:00:00 2001 From: Charles Paul Date: Tue, 11 Nov 2025 11:58:20 -0800 Subject: [PATCH] fix(snuba): don't mutate filter_keys Some callsites are re-using the same dictionary. It causes problems when we `del filter_keys["group_id"]` (because that mutates the input dict). This PR runs a copy before mutating, so the original input should not be mutated. --- src/sentry/utils/snuba.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sentry/utils/snuba.py b/src/sentry/utils/snuba.py index 8aac0b2ada5a37..6f1dc953b0d690 100644 --- a/src/sentry/utils/snuba.py +++ b/src/sentry/utils/snuba.py @@ -940,6 +940,7 @@ def _preprocess_group_id_redirects(self): in_groups = None out_groups: set[int | str] = set() if "group_id" in self.filter_keys: + self.filter_keys = self.filter_keys.copy() in_groups = get_all_merged_group_ids(self.filter_keys["group_id"]) del self.filter_keys["group_id"]