|
21 | 21 | from django.utils.translation import gettext_lazy as _ |
22 | 22 | from snuba_sdk import Column, Condition, Op |
23 | 23 |
|
24 | | -from sentry import eventstore, eventtypes, features, options, tagstore |
| 24 | +from sentry import eventstore, eventtypes, options, tagstore |
25 | 25 | from sentry.backup.scopes import RelocationScope |
26 | 26 | from sentry.constants import DEFAULT_LOGGER_NAME, LOG_LEVELS, MAX_CULPRIT_LENGTH |
27 | 27 | from sentry.db.models import ( |
@@ -370,32 +370,27 @@ def by_qualified_short_id_bulk( |
370 | 370 | groups = list(base_group_queryset.filter(short_id_lookup)) |
371 | 371 | group_lookup: set[int] = {group.short_id for group in groups} |
372 | 372 |
|
373 | | - organization = Organization.objects.get_from_cache(id=organization_id) |
374 | | - has_insensitive_lookup = features.has( |
375 | | - "organizations:group-case-insensitive-short-id-lookup", organization |
376 | | - ) |
377 | | - |
378 | 373 | # If any requested short_ids are missing after the exact slug match, |
379 | 374 | # fallback to a case-insensitive slug lookup to handle legacy/mixed-case slugs. |
380 | | - if has_insensitive_lookup: |
381 | | - missing_by_slug = defaultdict(list) |
382 | | - for sid in short_ids: |
383 | | - if sid.short_id not in group_lookup: |
384 | | - missing_by_slug[sid.project_slug].append(sid.short_id) |
385 | | - |
386 | | - if len(missing_by_slug) > 0: |
387 | | - ci_short_id_lookup = reduce( |
388 | | - or_, |
389 | | - [ |
390 | | - Q(project__slug__iexact=slug, short_id__in=sids) |
391 | | - for slug, sids in missing_by_slug.items() |
392 | | - ], |
393 | | - ) |
| 375 | + # Handles legacy project slugs that may not be entirely lowercase. |
| 376 | + missing_by_slug = defaultdict(list) |
| 377 | + for sid in short_ids: |
| 378 | + if sid.short_id not in group_lookup: |
| 379 | + missing_by_slug[sid.project_slug].append(sid.short_id) |
| 380 | + |
| 381 | + if len(missing_by_slug) > 0: |
| 382 | + ci_short_id_lookup = reduce( |
| 383 | + or_, |
| 384 | + [ |
| 385 | + Q(project__slug__iexact=slug, short_id__in=sids) |
| 386 | + for slug, sids in missing_by_slug.items() |
| 387 | + ], |
| 388 | + ) |
394 | 389 |
|
395 | | - fallback_groups = list(base_group_queryset.filter(ci_short_id_lookup)) |
| 390 | + fallback_groups = list(base_group_queryset.filter(ci_short_id_lookup)) |
396 | 391 |
|
397 | | - groups.extend(fallback_groups) |
398 | | - group_lookup.update(group.short_id for group in fallback_groups) |
| 392 | + groups.extend(fallback_groups) |
| 393 | + group_lookup.update(group.short_id for group in fallback_groups) |
399 | 394 |
|
400 | 395 | for short_id in short_ids: |
401 | 396 | if short_id.short_id not in group_lookup: |
|
0 commit comments