Return false when change_position is not in correct format
What does this MR do and why?
On production, there are some old DiffNote records with change_position set to JSON string in the DB so rails can't serialize it back to Gitlab::Diff::Position.
This results to error on discussions endpoint when loading a MR.
undefined method `on_file?' for an instance of String (NoMethodError)
return false if change_position&.on_file?This seems to be legacy data error. To fix the endpoint to not error out, we return false early when change_position isn't in the correct format we expect.
References
gitlab-com/gl-infra/production#22194
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.