-
Notifications
You must be signed in to change notification settings - Fork 10
fix: make retriable uploads retriable even if no error #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: TypeError when resending upload with null upload_ids
The _resend_upload method crashes when breadcrumb.upload_ids is None because it attempts len(breadcrumb.upload_ids) at line 695 and passes it to filter(id__in=breadcrumb.upload_ids) at line 700. Both operations fail with TypeError on None values. The removed _is_failed_upload check previously prevented this by requiring upload_ids to be present. The method needs validation to handle breadcrumbs without upload IDs before attempting these operations.
libs/shared/shared/django_apps/upload_breadcrumbs/admin.py#L694-L700
umbrella/libs/shared/shared/django_apps/upload_breadcrumbs/admin.py
Lines 694 to 700 in 6cbc94f
| log.info( | |
| f"Collecting upload data for {len(breadcrumb.upload_ids)} uploads", | |
| extra={"upload_ids": breadcrumb.upload_ids}, | |
| ) | |
| uploads = ( | |
| ReportSession.objects.filter(id__in=breadcrumb.upload_ids) |
CodSpeed Performance ReportMerging #578 will not alter performanceComparing Summary
Footnotes |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #578 +/- ##
==========================================
- Coverage 93.85% 93.83% -0.02%
==========================================
Files 1284 1284
Lines 46432 46417 -15
Branches 1524 1522 -2
==========================================
- Hits 43578 43557 -21
- Misses 2545 2550 +5
- Partials 309 310 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: TypeError when resending breadcrumbs with null upload_ids
The _resend_upload method calls len(breadcrumb.upload_ids) at line 695 and filters with id__in=breadcrumb.upload_ids at line 700, but upload_ids can be None (as seen when creating breadcrumbs at line 779). Removing the _is_failed_upload validation allows resending breadcrumbs with null upload_ids, causing a TypeError when attempting to get the length of or filter by None. The method needs null checks before accessing upload_ids.
libs/shared/shared/django_apps/upload_breadcrumbs/admin.py#L693-L700
umbrella/libs/shared/shared/django_apps/upload_breadcrumbs/admin.py
Lines 693 to 700 in ca37f9c
| log.info( | |
| f"Collecting upload data for {len(breadcrumb.upload_ids)} uploads", | |
| extra={"upload_ids": breadcrumb.upload_ids}, | |
| ) | |
| uploads = ( | |
| ReportSession.objects.filter(id__in=breadcrumb.upload_ids) |
| return ( | ||
| False, | ||
| "This breadcrumb has no associated upload IDs. It may be a resend breadcrumb that hasn't been processed yet.", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Empty upload IDs list not handled properly
The check if breadcrumb.upload_ids is None only catches None values but not empty lists []. Since upload_ids can be either None or an empty list (both representing no upload IDs), the condition should be if not breadcrumb.upload_ids to handle both cases consistently. Currently, empty lists fall through to a less helpful error message at line 720 instead of the clearer message about breadcrumbs that haven't been processed yet.
maxweng-sentry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. Was wondering if it might be good to allow retried uploads when there aren't upload_ids tied to it though. Maybe like searching the commit from the db?
Makes uploads retriable even if there is no error. This helps us retry the upload if there was another issue that isn't caught by our system.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Note
Enables resending uploads from the admin UI regardless of failure status, adds a safeguard when
upload_idsisNone, and updates tests accordingly.resend_upload_buttonand enableresend_upload_actionregardless of failure state.resend_upload_view; proceed to resend for any breadcrumb._resend_uploadguard: return error ifbreadcrumb.upload_idsisNone.Written by Cursor Bugbot for commit 3727ba0. This will update automatically on new commits. Configure here.