fix(report): remove Sentry capture for empty report uploads#653
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #653 +/- ##
==========================================
- Coverage 93.35% 93.35% -0.01%
==========================================
Files 1292 1292
Lines 47128 47143 +15
Branches 1567 1567
==========================================
+ Hits 43996 44010 +14
- Misses 2823 2824 +1
Partials 309 309
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Changes: 1. Remove Sentry capture for ReportEmptyError (expected user behavior) 2. Track which files were empty/had no coverage data 3. Include empty file names in the error message and logs When an upload fails because all coverage files were empty, the error message now tells you WHICH files were the problem: - 'No coverage files found in upload.' (no files at all) - 'No coverage data extracted. 3 of 20 file(s) were empty: f1.xml, f2.xml, f3.xml' The log warning also includes: - empty_files: list of up to 10 empty file names - empty_files_count: total count of empty files - total_files_count: total files in upload Fixes WORKER-WH2 (~480K Sentry events/month)
32b220d to
d73f770
Compare
6334352 to
38d143c
Compare
- Add unit tests for ReportEmptyError exception class - Test default message, all-files-empty case, partial-empty case - Test truncation of long file lists (>5 files) - Add process tests for empty file tracking
38d143c to
8199a1e
Compare
|
@sentry review |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| elif empty_files: | ||
| # Some files were empty, list them | ||
| files_list = ", ".join(empty_files[:5]) | ||
| if len(empty_files) > 5: |
There was a problem hiding this comment.
What's the criteria for us not doing coverage data if there are more than 5 files?
| "Report is empty", | ||
| extra={ | ||
| "reportid": e.reportid, | ||
| "reportid": reportid, |
There was a problem hiding this comment.
why is this no longer e.reportid?
|
Addressing the review feedback: Re: "What's the criteria for us not doing coverage data if there are more than 5 files?" The limit of 5 file names in the error message is purely a UX decision to prevent excessively long error messages. The actual coverage processing isn't affected - we still process all files. We just truncate the display of empty file names in the error message to keep it readable. The full count is still shown (e.g., "5 of 20 file(s) were empty: file1, file2, file3, file4, file5, (and 15 more)"). The log warning includes up to 10 file names via Re: "why is this no longer e.reportid?" We already have Re: None filenames bug (cursor[bot]) This was fixed in the second commit - lines 64-65 and 84-85 now check |
Summary
Improves error messaging for empty report uploads and removes unnecessary Sentry noise.
Changes
1. Remove Sentry capture for
ReportEmptyErrorEmpty reports are expected user behavior (e.g., no coverage data in upload). This was generating ~480K unnecessary Sentry events per month.
2. Track which files were empty
When processing an upload with multiple coverage files, we now track which files:
3. Include empty file names in error message and logs
Before:
After:
The log warning now also includes:
empty_files: list of up to 10 empty file namesempty_files_count: total count of empty filestotal_files_count: total files in uploadWhy This Matters
When a user uploads 20 coverage files and 3 are empty causing the upload to fail, they can now see WHICH files were the problem instead of searching through thousands of lines.
Impact
Note
Improves handling and observability of empty coverage uploads while reducing noise.
ReportEmptyErrorto includeempty_filesandtotal_files, with clearer, contextual messagesprocess_raw_uploadnow tracks files with no contents or no extracted coverage and raisesReportEmptyErrorwith detailsempty_files(truncated),empty_files_count, andtotal_files_count; removes Sentry capture forReportEmptyErrorWritten by Cursor Bugbot for commit 8199a1e. This will update automatically on new commits. Configure here.