Skip to content

Attempt to fix errors reading properties from null `mergeRequest`

What does this MR do and why?

For #412874

Problem

According to the linked issue, Sentry reports many thousands of errors when attempting to read a property from a null mergeRequest.

Unfortunately (? fortunately?), this is not actually happening with any consistency any more: https://new-sentry.gitlab.net/organizations/gitlab/issues/?environment=gprd&project=4&query=is%3Aunresolved+Cannot+read+properties+of+null+%28reading+%27mergeRequest%27%29&referrer=issue-list&sort=freq&statsPeriod=14d

There are a handful (9) of these events from 1 user on the MR Show page, and a hundred or so in the Issuable MR Popover component (I'm not sure what this is) in the last two weeks.

Replication

The major problem here is one of replication.
We don't have consistent steps to cause this error (in fact, the way it was reproduced previously and fixed did not result in a significant change in the error reporting).
Without being able to reproduce the issue, any fixes are just guesses.

Fix

These are just guesses.

Given the problem, these are three possible places that this error might be occurring.

We know that the two ways this error occurs is in the Issuable MR Popover and in the MR widgets, so these three fixes address those two locations.

One small upside here is that all three locations already had fallback code for when the project was null, so these fixes just additionally check for if the mergeRequest is null. Ideally, no other changes need to be made as everything should (🤞🏻) work the same as before.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

All backstage

How to set up and validate locally

As noted, we don't have reliable replication steps, so this is a set of changes that hopefully improves possible sources of errors.

Edited by Thomas Randolph

Merge request reports