diff --git a/src/sentry/api/endpoints/debug_files.py b/src/sentry/api/endpoints/debug_files.py index c10f9982e986..b2a5c3746476 100644 --- a/src/sentry/api/endpoints/debug_files.py +++ b/src/sentry/api/endpoints/debug_files.py @@ -69,7 +69,6 @@ from sentry.models.project import Project from sentry.models.release import Release, get_artifact_counts from sentry.models.releasefile import ReleaseFile -from sentry.options.rollout import in_random_rollout from sentry.roles import organization_roles from sentry.tasks.assemble import ( AssembleTask, @@ -254,7 +253,7 @@ def get(self, request: Request, project: Project) -> Response: ) -def code_id_queries(code_id: str, use_legacy: bool) -> list[Q]: +def code_id_queries(code_id: str) -> list[Q]: """Returns a list of queries that, for a given code ID: 1. compare it to the `code_id` field. 2. compare it to the `wasm_legacy_code_id` field. @@ -269,23 +268,17 @@ def code_id_queries(code_id: str, use_legacy: bool) -> list[Q]: Clauses (2) and (3) are only relevant for WASM files. No non-WASM file has a `wasm_legacy_code_id`, and the "legacy" code ID is extremely unlikely to be a match for any file that never suffered from the WASM build ID bug. - - The behavior is gated behind the `use_legacy` flag. - If it's turned off, only the first query is returned. """ - qs = [Q(code_id__exact=code_id)] - - if use_legacy: - qs.append(Q(wasm_legacy_code_id__exact=code_id)) + qs = [Q(code_id__exact=code_id), Q(wasm_legacy_code_id__exact=code_id)] - if legacy_id := wasm_legacy_code_id(code_id): - qs.append(Q(code_id__exact=legacy_id)) + if legacy_id := wasm_legacy_code_id(code_id): + qs.append(Q(code_id__exact=legacy_id)) return qs -def debug_id_queries(debug_id: str, use_legacy: bool) -> list[Q]: +def debug_id_queries(debug_id: str) -> list[Q]: """Returns a list of queries that, for a given debug ID: 1. compare it to the `debug_id` field. 2. compare it to the `wasm_legacy_debug_id` field. @@ -300,18 +293,12 @@ def debug_id_queries(debug_id: str, use_legacy: bool) -> list[Q]: Clauses (2) and (3) are only relevant for WASM files. No non-WASM file has a `wasm_legacy_debug_id`, and the "legacy" debug ID is extremely unlikely to be a match for any file that never suffered from the WASM build ID bug. - - The behavior is gated behind the `use_legacy` flag. - If it's turned off, only the first query is returned. """ - qs = [Q(debug_id__exact=debug_id)] + qs = [Q(debug_id__exact=debug_id), Q(wasm_legacy_debug_id__exact=debug_id)] - if use_legacy: - qs.append(Q(wasm_legacy_debug_id__exact=debug_id)) - - if legacy_id := wasm_legacy_debug_id(debug_id): - qs.append(Q(debug_id__exact=legacy_id)) + if legacy_id := wasm_legacy_debug_id(debug_id): + qs.append(Q(debug_id__exact=legacy_id)) return qs @@ -429,8 +416,6 @@ def get( ) q &= file_format_q - query_legacy_ids = in_random_rollout("debug-files.query-legacy-ids.rollout-rate") - # If we have at least one of debug_id or code_id, use them to build the queryset if debug_id or code_id: # Be lenient when searching for debug files, check either for a matching debug id @@ -443,14 +428,14 @@ def get( # will match. debug_id_qs = ProjectDebugFile.objects.none().select_related("file") if debug_id: - for debug_id_q in debug_id_queries(debug_id, query_legacy_ids): + for debug_id_q in debug_id_queries(debug_id): debug_id_qs = debug_id_qs.union( ProjectDebugFile.objects.filter(debug_id_q & q).select_related("file") ) code_id_qs = ProjectDebugFile.objects.none().select_related("file") if code_id: - for code_id_q in code_id_queries(code_id, query_legacy_ids): + for code_id_q in code_id_queries(code_id): code_id_qs = code_id_qs.union( ProjectDebugFile.objects.filter( code_id_q diff --git a/tests/sentry/api/endpoints/test_debug_files.py b/tests/sentry/api/endpoints/test_debug_files.py index daafbe155600..c88d465b97fa 100644 --- a/tests/sentry/api/endpoints/test_debug_files.py +++ b/tests/sentry/api/endpoints/test_debug_files.py @@ -201,20 +201,19 @@ def test_wasm_legacy_ids(self) -> None: ] # Try every combination of debug_id/code_id for the query. - with self.options({"debug-files.query-legacy-ids.rollout-rate": 1.0}): - for query in ( - [f"debug_id={id}" for id in debug_ids] - + [f"query={id}" for id in debug_ids] - + [f"code_id={id}" for id in code_ids] - + [f"debug_id={did}&code_id={cid}" for did in debug_ids for cid in code_ids] - + [f"query={did}&code_id={cid}" for did in debug_ids for cid in code_ids] - ): - response = self.client.get(f"{self.url}?{query}") + for query in ( + [f"debug_id={id}" for id in debug_ids] + + [f"query={id}" for id in debug_ids] + + [f"code_id={id}" for id in code_ids] + + [f"debug_id={did}&code_id={cid}" for did in debug_ids for cid in code_ids] + + [f"query={did}&code_id={cid}" for did in debug_ids for cid in code_ids] + ): + response = self.client.get(f"{self.url}?{query}") - assert response.status_code == 200, response.content + assert response.status_code == 200, response.content - # The file that we find should have the correct debug ID. - assert response.data[0]["debugId"] == "da03eb5d-63d7-50fa-ab0f-b8e7cc12a1c3" + # The file that we find should have the correct debug ID. + assert response.data[0]["debugId"] == "da03eb5d-63d7-50fa-ab0f-b8e7cc12a1c3" def test_wasm_legacy_ids_old_upload(self) -> None: self._upload_wasm_legacy() @@ -229,20 +228,19 @@ def test_wasm_legacy_ids_old_upload(self) -> None: ] # Try every combination of debug_id/code_id for the query. - with self.options({"debug-files.query-legacy-ids.rollout-rate": 1.0}): - for query in ( - [f"debug_id={id}" for id in debug_ids] - + [f"query={id}" for id in debug_ids] - + [f"code_id={id}" for id in code_ids] - + [f"debug_id={did}&code_id={cid}" for did in debug_ids for cid in code_ids] - + [f"query={did}&code_id={cid}" for did in debug_ids for cid in code_ids] - ): - response = self.client.get(f"{self.url}?{query}") - - assert response.status_code == 200, response.content - - # The file that we find should have the legacy debug ID. - assert response.data[0]["debugId"] == "10da03eb-5d63-d750-faab-0fb8e7cc12a1" + for query in ( + [f"debug_id={id}" for id in debug_ids] + + [f"query={id}" for id in debug_ids] + + [f"code_id={id}" for id in code_ids] + + [f"debug_id={did}&code_id={cid}" for did in debug_ids for cid in code_ids] + + [f"query={did}&code_id={cid}" for did in debug_ids for cid in code_ids] + ): + response = self.client.get(f"{self.url}?{query}") + + assert response.status_code == 200, response.content + + # The file that we find should have the legacy debug ID. + assert response.data[0]["debugId"] == "10da03eb-5d63-d750-faab-0fb8e7cc12a1" def _do_test_dsyms_by_debugid_and_codeid(self, query, files): for _, debug_id, code_id in files: