My diff-coverage and total-coverage statuses are hanging on my PR

Occasionally, users may experience hanging test coverage statuses on a PR in GitHub.

1644

Causes

The calculations for the diff-coverage and total-coverage statuses are done by comparing test coverage for the branch head of the PR to the coverage for the merge base of the PR. If we're missing either, we'll be unable to produce the numbers necessary for the commit statuses, thus leaving them in a hanging state.

Typically, the absence of coverage for either is caused by:

A) A failed CI build of the branch head commit and/or merge base commit prevented the test report from being uploaded.

or

B) Code Climate received the test coverage info, but the report was malformed.

or

C) The PR was opened before coverage info was available for the merge base. This is a race condition where the new PR is opened and Code Climate attempts to generate the coverage comparison before the CI has finished building the most recent merge base. If the coverage info isn't available when the PR is opened, you'll need to push a new commit to the PR to retrigger the comparison, fetching that merge base coverage info once it's available.

How to fix

As an immediate fix, try:

  • pushing a new commit to the open PR(s) with a hanging status
  • confirm in your CI output that "test report uploaded successfully"
  • If that fails to get the diff-coverage and total-coverage statuses populating, then it's likely that Code Climate is missing the coverage info (or has malformed coverage info) for the merge base.
  • To troubleshoot, take a look at the CI logs for the merge base commit to verify that the build completed successfully.

If it appears that the CI failed on this build (even when reporting "test report uploaded successfully"), try:

  • retriggering the CI build for this commit.
  • Then, push a new commit to the open PR with the hanging status.
  • The subsequent analysis should then complete, allowing the diff-coverage status to populate.

Contact Us for Help

After taking these steps, if you're still not seeing the statuses populate, then please contact support. With your message, please include the following:

  • Repo name
  • CI config file
  • PR name/number
  • CI logs (for the entire build, including the test coverage section) for the merge base and branch head commits