[BUG] Code Suggestion for .ipynb MR breaks the file
The following discussion from !73743 (merged) should be addressed:
-
@stanhu started a discussion: (+1 comment) @eduardobonet This merge request looks good to me, but I had a side question about !71477 (merged). If someone applies a suggestion to the diff, what happens? Does this completely break the file?
The Bug
Since the displayed blob is different than the original blob, the suggestion is broken. First, the line count is different, so applied a change to a line will actually change a different line. Second the user is changing based on how it is displayed (markdown) not on how it is store (ipynb) which ends up breaking the file. See screenshots below:
-
Here applying the change to the line 72 would actually affect a completely different line in the beginning.
-
Applying the change will create a broken notebook
Mitigation
It seems ok to disable suggestions for now for .ipynb notebooks, given that code reviews and diffs are not happening either way.
Fixing
To solve this, we would need a mapping between the original and the new file, as well as what was the conversion of that cell, and how to convert back. This can be tackled in the implementation of richer diffs