Comment on MR diff shown attached to another line on commit-diff view
Summary
Reviewing a MR on several tabs, one with the overall diff where I post comments, and another tab for per-commit diffs, when I post a comment for a concrete line of the overall diff related to a certain function call, the other tab (with a single-commit diff) starts showing that comment on that line, but now associated quite different code than what it was intended for.
Steps to reproduce
(I hope this can be reproduced like this. I have managed to reproduce starting from step 2.)
- Open a MR comprising multiple commits that modify overlapping ranges of code of the same file.
- Open the overall MR diff in one browser tab, and the diff for one of the included commits on another tab, one of the older ones.
- Add a comment to the review on the overall MR diff tab, associated with line xyz of file f, one of lines that was modified by multiple commits in the MR.
- Reload the other tab, showing the single-commit diff.
- Observe the comment to appear on the line with the same number where posted in step 3, but line that now presumably has other contents.
Example Project
What is the current bug behavior?
The comment is shown associated with a line which it doesn't apply to.
What is the expected correct behavior?
The comment should not be shown on the single-commit diff view when it was posted for the MR diff. Maybe except if the relevant line range in the given commit (and maybe a few lines surrounding it, too) are the same as in the diff where the comment was originally posted.
Relevant logs and/or screenshots
MR diff view:
Single-commit view after reloading:
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \\\`sudo gitlab-rake gitlab:env:info\\\`) (For installations from source run and paste the output of: \\\`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\\\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:check SANITIZE=true\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true\`) (we will only investigate if the tests are passing)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

