Skip to content

Disable CodeCov expired reports validation#6251

Merged
wzieba merged 1 commit intotrunkfrom
codecov/disable_expired_reports_validation
Apr 19, 2022
Merged

Disable CodeCov expired reports validation#6251
wzieba merged 1 commit intotrunkfrom
codecov/disable_expired_reports_validation

Conversation

@wzieba
Copy link
Copy Markdown
Contributor

@wzieba wzieba commented Apr 13, 2022

Description

The majority of code coverage reports are considered incorrect by CodeCov (see here).

As valid reports exist (see e.g. #6241 ) I'm leaning toward the theory that the problem is with time-based validation from CodeCov (docs).

How CodeCov knows when a report has been generated?

At the beginning of the XML report, there's a piece of information about the sessions that created the report. Usually, there are two of them (because of two .exec files I suppose). There's timestamp for session creation and "dump" there. This is the only time-based information (I could find) that we send to CodeCov so I believe they take one of those values. You can find it by opening any failed report for e.g. commit, on the right under Uploads there's Download section to see payload. Then, look for start=" phrase.

If you convert those milliseconds to date, you can see that sometimes those point to a date a few days back. Also, I'm not sure if session dump means exactly the time of generating the report - I have a feeling that it's more like time of generating .exec file.

Why are the reports outdated?

Probably Gradle Build cache or cached up-to-date checks for generating .exec file (artifact from tests task). Just disabling cache for jacocoTestReport doesn't solve the issue. I'm not 100% sure how it works under the hood though, but I decided to timebox my time for that as it's still an experiment.

How does that influence CodeCov?

CodeCov by default doesn't accept reports than were generated 12h+ before sending payload. While this might work for other frameworks, I'm not sure if it's a good fit for JaCoCo (and Gradle).

I'm suggesting removing this validation - if our reports will happen to be invalid, we have a problem in our cache configuration and not with CodeCov.

See similar CodeCov issue:
https://community.codecov.com/t/reports-are-not-displayed-there-was-an-error-processing-coverage-reports/750

@wzieba wzieba added the category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. label Apr 13, 2022
@wzieba wzieba requested a review from ParaskP7 April 13, 2022 13:14
@peril-woocommerce
Copy link
Copy Markdown

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-woocommerce
Copy link
Copy Markdown

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

@wpmobilebot
Copy link
Copy Markdown
Collaborator

You can test the changes on this Pull Request by downloading an installable build, or scanning this QR code:

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 13, 2022

Codecov Report

Merging #6251 (4016719) into trunk (1ea8bee) will increase coverage by 24.55%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             trunk    #6251       +/-   ##
============================================
+ Coverage         0   24.55%   +24.55%     
- Complexity       0     2552     +2552     
============================================
  Files            0      786      +786     
  Lines            0    45301    +45301     
  Branches         0     5692     +5692     
============================================
+ Hits             0    11125    +11125     
- Misses           0    33154    +33154     
- Partials         0     1022     +1022     
Impacted Files Coverage Δ
...mmerce/android/ui/refunds/RefundSummaryFragment.kt 0.00% <0.00%> (ø)
...inglabels/creation/ShippingCarrierRatesFragment.kt 0.00% <0.00%> (ø)
...id/ui/products/settings/ProductSettingsFragment.kt 0.00% <0.00%> (ø)
...ders/cardreader/receipt/ReceiptPreviewViewModel.kt 95.55% <0.00%> (ø)
...tlin/com/woocommerce/android/ui/main/MainModule.kt 0.00% <0.00%> (ø)
...com/woocommerce/android/widgets/WCWarningBanner.kt 0.00% <0.00%> (ø)
...rce/android/ui/prefs/UnifiedAboutScreenActivity.kt 0.00% <0.00%> (ø)
.../shippinglabels/creation/ShippingCustomsAdapter.kt 0.00% <0.00%> (ø)
...ippinglabels/creation/MoveShippingItemViewModel.kt 85.41% <0.00%> (ø)
...roid/ui/products/viewholders/PropertyViewHolder.kt 0.00% <0.00%> (ø)
... and 776 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ea8bee...4016719. Read the comment docs.

@wzieba wzieba marked this pull request as draft April 14, 2022 08:56
@wzieba
Copy link
Copy Markdown
Contributor Author

wzieba commented Apr 14, 2022

An update: I've asked the CodeCov team how they determine JaCoCo report creation time. Because if it's time of generating JaCoCo .xml file, maybe disabling cache/up-to-date checks for the task will resolve the issue.

https://community.codecov.com/t/how-codecov-knows-time-of-jacoco-report-generation/3571

For now, let's keep this PR as a draft 🙂.

@ParaskP7
Copy link
Copy Markdown
Contributor

👋 @wzieba !

An update: I've asked the CodeCov team how they determine JaCoCo report creation time. Because if it's time of generating JaCoCo .xml file, maybe disabling cache/up-to-date checks for the task will resolve the issue.

Thank you for this update! 👍

For now, let's keep this PR as a draft 🙂.

👍

PS: I'll be AFK from next week, for 2 weeks, so please don't wait on me to review this change, that is if you end up making it ready for review as some next week.

@wzieba
Copy link
Copy Markdown
Contributor Author

wzieba commented Apr 14, 2022

Gotcha, thanks for the heads up @ParaskP7 ! 🙌

@wzieba
Copy link
Copy Markdown
Contributor Author

wzieba commented Apr 19, 2022

We got the answer from the CodeCov team:

Q: how CodeCov determines the time of JaCoCo report generation for the “Expired Reports” 2 check?

A: it is taken from all instances of sessioninfo > start. If any of those values are longer than the max_report_age, it will be considered expired.

I also checked how JaCoCo sessions are created and it looks like there's a separate session for each .exec file. Sessions have timestamps from .exec files and those files are cachable.

So what happens eventually is that when PR e.g. doesn't change anything in cardreader module, JaCoCo will use the cached .exec file of the module, which has an old timestamp. Then, CodeCov will drop this report because it's considered too old.


So, in conclusion, as we trust the Gradle Cache system for our tests, the more we should have it for code coverage. Hence, we don't need additional validation from CodeCov.

@wzieba wzieba marked this pull request as ready for review April 19, 2022 09:18
Copy link
Copy Markdown
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationale in above discussion (especially last comments around trusting our cache) make sense to me 👍

@wzieba wzieba merged commit 8166d37 into trunk Apr 19, 2022
@wzieba wzieba deleted the codecov/disable_expired_reports_validation branch April 19, 2022 09:41
wzieba added a commit to wordpress-mobile/WordPress-Android that referenced this pull request Jan 12, 2024
To disable PR checks on GitHub.

`max_report_age: off` has this context: woocommerce/woocommerce-android#6251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants