Fix nil position error in UpdateDiffPositionService
What does this MR do?
Fixes a NoMethodError that occurs when UpdateDiffPositionService tries to create a system note for outdated diff discussions with a nil position.
https://log.gprd.gitlab.net/app/r/s/bLbsG
Related issues
Resolves the error: undefined method 'diff_refs' for nil:NilClass in the stack trace provided.
How to test
This error occurs during merge request diff updates when the position tracer returns a nil position. The fix prevents the system note creation when position is nil.
What are the relevant issue numbers?
N/A - Bug fix based on error stack trace
Does this MR meet the acceptance criteria?
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guidelines (if applicable) -
Separation of EE specific content (if applicable)
Availability and Testing
-
Review by a SET -
Added tests -
End-to-end tests
Risk Assessment
Low risk - This is a defensive fix that prevents a crash by adding a nil check. The behavior when position is nil is to skip creating the system note, which is the appropriate fallback behavior.
Edited by Marc Shaw