Skip to content

fix: handle non-dict string line data safely in v1 report processor - #2573

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/v1-processor-string-lines-attributeerror
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/v1-processor-string-lines-attributeerror

Conversation

@sentry

@sentry sentry Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

In apps/worker/services/report/languages/v1.py, _list_to_dict was updated to explicitly verify that lines is a dict before checking "lines" in lines and returning it. Unexpected types like strings (e.g. '1 1 1 0') now fall through to return {} 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 lines was evaluated as a substring check on the string (evaluating to False), and lines or {} returned the raw string. Calling .items() on that string in from_json then raised AttributeError: '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 run

This 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_dict in 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 into from_json, which previously caused AttributeError when calling .items() on coverage data (WORKER-ZAV).

The function now requires a dict before 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.

@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.64%. Comparing base (585ddae) to head (ac1b55a).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/services/report/languages/v1.py 66.66% 1 Missing ⚠️
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              
Flag Coverage Δ
workerintegration 58.48% <0.00%> (-0.01%) ⬇️
workerunit 90.54% <66.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@sentry

sentry Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Sentry needs additional GitHub App permissions

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants