Confusing message when Code Quality hasn't changed ("degraded on 0 points" with warning icon)

Summary

When there are no new errors, the Code Quality MR widget displays: "Code Quality degraded on 0 points" rather than "No changes to Code Quality".

The existing logic seems to assume that errorSummary.errored >= 1 means there are new degradations.

Steps to reproduce

  1. Open an MR in a repository that uses Code Quality scanning of some type. Don't make any quality-impacting changes. It's best to use a relatively quiet repository to avoid spurious changes being identified if the default branch keeps moving quickly.
  2. Open the MR.
  3. Reload the page so that the MR widget renders.

Example Project

Observed in !106856 (merged) but should be reproducible in any MR where relevant code is not changed.

What is the current bug behavior?

When I observed the behavior, the API response was:

{
  "status": "failed",
  "new_errors": [],
  "resolved_errors": [],
  "existing_errors": [],
  "summary": {
    "total": 6283,
    "resolved": 0,
    "errored": 6283
  }
}

The MR widget showed: "Code Quality degraded on 0 points" with a warning color instead of noting that there were no changes. It also had a "Show/hide details" button that did not actually do anything; this may or may not be related to this same problem.

Screenshot_2022-12-13_at_12.22.14_PM


The issue reporter shared this image:

image

What is the expected correct behavior?

The widget should not warn (because I didn't make any new issues) and should use the "No changes to Code Quality" text instead of reporting "degraded on 0 points".

Relevant logs and/or screenshots

See above.

Output of checks

This bug happens on GitLab.com

Possible fixes

  • Adjust logic in this conditional to only check for new errors being present.
  • Change indicator to Neutral in this case.
Edited by Connor Gilbert