From 82d465d9c2ed79a3b7b8a615e5e57638a923e761 Mon Sep 17 00:00:00 2001 From: Charles Paul Date: Tue, 11 Nov 2025 13:08:53 -0800 Subject: [PATCH] chore(snuba): test no mutating filter_keys Hotlined the fix in #103177 because it was causing problems. Best practice is to add a test here to ensure we don't regress in the future. --- tests/sentry/utils/test_snuba.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/sentry/utils/test_snuba.py b/tests/sentry/utils/test_snuba.py index 5043824a57e7ce..b50763d3148255 100644 --- a/tests/sentry/utils/test_snuba.py +++ b/tests/sentry/utils/test_snuba.py @@ -360,6 +360,18 @@ def test_preprocess_group_redirects(self) -> None: assert params.conditions[0] == ["foo", "=", "bar"] assert len(params.conditions) == 1 + # Should not mutate inputs + filter_keys = {"group_id": {g4.id}} + conditions = [["group_id", "IN", [g1.id, g4.id]]] + + SnubaQueryParams( + dataset=Dataset.Events, + filter_keys=filter_keys, + conditions=conditions, + ) + assert filter_keys == {"group_id": {g4.id}} + assert conditions == [["group_id", "IN", [g1.id, g4.id]]] + class QuantizeTimeTest(unittest.TestCase): def setUp(self) -> None: