Guard against nil pipeline in codequality reports comparer

What does this MR do and why?

codequalityReportsComparer can be absent (no head pipeline / no codequality report), but two spots accessed it unguarded:

  • app/assets/javascripts/diffs/components/app.vue read codequalityReportsComparer.status directly — now optional-chained.
  • CodequalityReportsComparerResolver#resolve called authorize!(object.diff_head_pipeline) with no nil check — now returns early when diff_head_pipeline is nil.

Both prevent a crash when a merge request has no head pipeline.

Closes #594017

(Replaces the stale !228354 (closed), which had drifted ~24k commits behind master.)

How to set up and validate locally

  1. Ensure your GDK is running.
  2. In a test project, create a new branch and make a small change (e.g. modify a README.md).
  3. Ensure there is no CI/CD configured (no .gitlab-ci.yml) for this project, so that no pipeline runs for the commit.
  4. Open a Merge Request for this branch.
  5. Navigate to the Changes tab on the Merge Request.
  6. Verify the page loads successfully without any crashes (previously, attempting to read codequalityReportsComparer from a nil pipeline would cause a crash).
Edited by Olayinka Vaughan

Merge request reports

Loading