Skip to content

Stops semantic diff if file is truncated

Eduardo Bonet requested to merge does-not-generate-diff-when-truncated into master

Why

While exploring #360283 (closed), we noticed that diffs were not being generated because the file was invalid, even though they are actually valid notebooks. The reason being the notebook is too large, so gitlab truncates the blob and the parsing breaks. We could load the entire data, but then it would hit the timeouts, so we would just do more computation for nothing.

How to test

There's no visual testing on this, only making sure it doesn't break

  1. Enable the Feature Flags
    Feature.enable(:ipynb_semantic_diff)
    Feature.enable(:rendered_diffs_viewer)
  2. Import the test repo https://gitlab.com/Vulwsztyn/jupyter-notebook-test
  3. Open the logs tail -f log/application.log
  4. Visit commit https://<your gdk>/jupyter-notebook-test/-/commit/a27b77b74b87b8d9522204a7e76bbd33466c241e.
    1. Without changes you should see IPYNB_DIFF_INVALID on the logs
    2. With changes you should see IPYNB_DIFF_TRUNCATED on the logs
Edited by Eduardo Bonet

Merge request reports