feat(iswf): Adds Issue label, org label coarse data model #114925
2 issues
sentry-backend-bugs: Found 2 issues (2 medium)
Medium
IssueLabel.update() raises DoesNotExist on missing/deleted record - `src/sentry/issues/services/issue_label/service.py:47`
IssueLabel.objects.get(id=issue_label_id) is called without handling IssueLabel.DoesNotExist. If the label was deleted concurrently or the ID is stale/invalid (e.g., from an API request), this raises an unhandled exception that propagates as a 500. Service-layer mutation entry points should surface a graceful error so callers can return 404.
Also found at:
src/sentry/issues/services/issue_label/service.py:65src/sentry/issues/services/issue_label/service.py:99
create() and create_org_label() do not handle unique constraint violations - `src/sentry/issues/services/issue_label/service.py:28-32`
IssueLabel.objects.create() and OrganizationLabel.objects.create() are called without handling IntegrityError. If unique constraints exist (likely for (group_id, label_id) on IssueLabel and (organization_id, label_name) on OrganizationLabel based on typical label data models), duplicate creation requests will raise an unhandled IntegrityError resulting in a 500. This is Check 7 (Database Constraint Violations).
Duration: 40.3s · Tokens: 129.9k in / 2.3k out · Cost: $1.04 (+extraction: $0.01, +merge: $0.00)
Annotations
Check warning on line 47 in src/sentry/issues/services/issue_label/service.py
sentry-warden / warden: sentry-backend-bugs
IssueLabel.update() raises DoesNotExist on missing/deleted record
`IssueLabel.objects.get(id=issue_label_id)` is called without handling `IssueLabel.DoesNotExist`. If the label was deleted concurrently or the ID is stale/invalid (e.g., from an API request), this raises an unhandled exception that propagates as a 500. Service-layer mutation entry points should surface a graceful error so callers can return 404.
Check warning on line 65 in src/sentry/issues/services/issue_label/service.py
sentry-warden / warden: sentry-backend-bugs
[M4X-WM4] IssueLabel.update() raises DoesNotExist on missing/deleted record (additional location)
`IssueLabel.objects.get(id=issue_label_id)` is called without handling `IssueLabel.DoesNotExist`. If the label was deleted concurrently or the ID is stale/invalid (e.g., from an API request), this raises an unhandled exception that propagates as a 500. Service-layer mutation entry points should surface a graceful error so callers can return 404.
Check warning on line 99 in src/sentry/issues/services/issue_label/service.py
sentry-warden / warden: sentry-backend-bugs
[M4X-WM4] IssueLabel.update() raises DoesNotExist on missing/deleted record (additional location)
`IssueLabel.objects.get(id=issue_label_id)` is called without handling `IssueLabel.DoesNotExist`. If the label was deleted concurrently or the ID is stale/invalid (e.g., from an API request), this raises an unhandled exception that propagates as a 500. Service-layer mutation entry points should surface a graceful error so callers can return 404.
Check warning on line 32 in src/sentry/issues/services/issue_label/service.py
sentry-warden / warden: sentry-backend-bugs
create() and create_org_label() do not handle unique constraint violations
`IssueLabel.objects.create()` and `OrganizationLabel.objects.create()` are called without handling `IntegrityError`. If unique constraints exist (likely for `(group_id, label_id)` on IssueLabel and `(organization_id, label_name)` on OrganizationLabel based on typical label data models), duplicate creation requests will raise an unhandled `IntegrityError` resulting in a 500. This is Check 7 (Database Constraint Violations).