Stops semantic diff if file is truncated
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
- Enable the Feature Flags
Feature.enable(:ipynb_semantic_diff) Feature.enable(:rendered_diffs_viewer)
- Import the test repo https://gitlab.com/Vulwsztyn/jupyter-notebook-test
- Open the logs
tail -f log/application.log
- Visit commit
https://<your gdk>/jupyter-notebook-test/-/commit/a27b77b74b87b8d9522204a7e76bbd33466c241e
.- Without changes you should see
IPYNB_DIFF_INVALID
on the logs - With changes you should see
IPYNB_DIFF_TRUNCATED
on the logs
- Without changes you should see
Edited by Eduardo Bonet