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.vuereadcodequalityReportsComparer.statusdirectly — now optional-chained.CodequalityReportsComparerResolver#resolvecalledauthorize!(object.diff_head_pipeline)with no nil check — now returns early whendiff_head_pipelineis 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
- Ensure your GDK is running.
- In a test project, create a new branch and make a small change (e.g. modify a
README.md). - Ensure there is no CI/CD configured (no
.gitlab-ci.yml) for this project, so that no pipeline runs for the commit. - Open a Merge Request for this branch.
- Navigate to the Changes tab on the Merge Request.
- Verify the page loads successfully without any crashes (previously, attempting to read
codequalityReportsComparerfrom a nil pipeline would cause a crash).
Edited by Olayinka Vaughan