Add system note on new commit when a change is made on one of the lines in multi-line comments
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=393489) </details> <!--IssueSummary end--> <!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary <!-- Summarize the bug encountered concisely. --> After a multi-line comment is added to an MR diff, and a new commit is made on one of the selected lines, the system note on the new commit added does not appear in the comment. The system note on the commit is only added when there is a code change to **all** lines of the multi-line comment. Users have difficulty knowing if there are changes on the MR diff section that is showing up in the comment, unless they are told, review the Activity or check on the commits made. ### Steps to reproduce <!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. --> 1. Create a new project and initialize repository with a README. 2. Make a change on 3 lines of code, commit to a new branch and create an MR. 3. Make a comment on the line 1 of changed code. 4. Make a multi-line comment on the line 2 and 3 of changed code. 5. Make a new commit on the same branch on line 1 and line 2 of the changed code. You should see the system note "XXX changed this line in version Y of the diff Z hours ago" within the single-line comment, but not within the multi-line comment. ### Example Project <!-- If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report. If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version. --> Multi-line comment: https://gitlab.com/gitlab-silver/kenneth-silver/zd377786/-/merge_requests/4 \ Single-line comment: https://gitlab.com/gitlab-silver/kenneth-silver/zd377786/-/merge_requests/7 ### What is the current behavior? <!-- Describe what actually happens. --> System note on new commit only appear in multi-line comments in a merge request diff when the code change is on **all** selected lines. ### What is the expected behavior? <!-- Describe what you should see instead. --> System note on new commit appear in multi-line comments in a merge request diff, when the change is on any of the selected lines. ### Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> ![image](/uploads/05b4c1089553d74e8e2729817ec44884/image.png){width=50%} ### Output of checks <!-- If you are reporting a bug on GitLab.com, uncomment below --> This happens on GitLab.com ### Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem. --> We see the system note on the commit changes in the comment does not get added when the diff note is not `outdated`: https://gitlab.com/gitlab-org/gitlab/-/blob/v15.9.0-ee/app/services/discussions/update_diff_position_service.rb#L31. The issue is possibly related to what constitute as an `outdated` for a diff note in a multi-line comment, where it is not detecting a diff note as `outdated` after a change, hence the system note for commit does not show up: https://gitlab.com/gitlab-org/gitlab/-/blob/v15.9.0-ee/lib/gitlab/diff/position_tracer/line_strategy.rb.
issue