When submitting a comment on unchanged lines it fails with "can't be blank" error (422)

Summary

Bug when adding a suggestion to a file in a merge request.

Steps to reproduce

  1. Open the diffs tab of the merge request gitlab-com/www-gitlab-com!60677 (diffs)
  2. Expand the lines to show line 567/566 (it will have a grey background)
  3. Select a line 567/566 to add a comment. (the error occurs for both inline and parallel modes)
  4. Add a comment and click Add Comment Now
  5. A red banner saying there's an error "Saving the comment failed" appears at the top of the page. Comment is gone.

Notes:

  • The file chosen is huge: it's a Yaml file > 1MB, 26600+ lines.
  • The comment was added to a line that hasn't been edited in the merge request.

Example Project

Happened on gitlab-com/www-gitlab-com!60677 (merged).

What is the current bug behavior?

  • Cannot add a comment with a suggestion.
  • Cannot add a comment without a suggestion.

What is the expected correct behavior?

  • Able to add a comment with or without a suggestion.

Relevant logs and/or screenshots

  1. Clicked a non-edited line to comment.
  2. Added a suggestion.
  3. Clicked "Add comment now".

bug_suggestion

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info
  • macOS Catalina version 10.15.6 (19G73)
  • Chrome version 84.0.4147.135 (Official Build) (64-bit)
  • GitLab.com running GitLab Enterprise Edition 13.4.0-pre 038a53e8
  • www project
  • team.yml file

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

(If you can, link to the line of code that might be responsible for the problem)

Edited by Jay McCure