Repository navigation
fix: handle non-dict string line data safely in v1 report processor - #2573
Open
sentry[bot] wants to merge 1 commit into
Open
sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2573 +/- ##
==========================================
- Coverage 91.64% 91.64% -0.01%
==========================================
Files 1341 1341
Lines 53339 53341 +2
Branches 1649 1649
==========================================
+ Hits 48885 48886 +1
- Misses 4133 4134 +1
Partials 321 321
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Contributor
Author
|
The Sentry GitHub App installation for this repository is missing permissions it needs to keep iterating on this pull request to get CI passing. Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
In
apps/worker/services/report/languages/v1.py,_list_to_dictwas updated to explicitly verify thatlinesis adictbefore checking"lines" in linesand returning it. Unexpected types like strings (e.g.'1 1 1 0') now fall through toreturn {}instead of being returned as a string.Why
When a v1 report contains space-separated line coverage strings instead of lists or dicts,
"lines" in lineswas evaluated as a substring check on the string (evaluating toFalse), andlines or {}returned the raw string. Calling.items()on that string infrom_jsonthen raisedAttributeError: 'str' object has no attribute 'items', failing the upload task (WORKER-ZAV).Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness 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 Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes WORKER-ZAV
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.
Note
Low Risk
Localized defensive typing in v1 report parsing; valid list/dict formats are unchanged, with only unexpected types now mapped to empty coverage.
Overview
Hardens
_list_to_dictin the v1 coverage report path so malformed per-file line payloads (e.g. space-separated strings like'1 1 1 0') no longer propagate as strings intofrom_json, which previously causedAttributeErrorwhen calling.items()on coverage data (WORKER-ZAV).The function now requires a
dictbefore treating"lines"as a nested key (avoiding substring checks on strings), keeps the existing list /{"lines": [...]}/ plain dict behavior, and returns{}for any other type so uploads degrade to empty line coverage instead of failing the worker task.Reviewed by Cursor Bugbot for commit ac1b55a. Bugbot is set up for automated code reviews on this repo. Configure here.