Display rapid diffs warning on the MR creation page

What does this MR do and why?

Related to: Diff limits overflow not sent on merge request ... (#535135 - closed)

This MR ensures that overflow warnings are displayed in the MR creation when files are collapsed due to GitLab's safe diff limits.

Previously, the warning did not appear in these views because the overflow flag was only set when Gitaly returned an overflow_marker (i.e., hard limit exceeded), and did not account for collapsed files due to soft limits.

Changes
  • Add new ivar @collapsed_safe_limits in Gitlab::Git::DiffCollection when a diff from Gitaly is marked as collapsed.

  • Add #collapsed_safe_limits? method to DiffCollection.

  • Update overflow_safe? logic in DiffsStatsEntity to check collapsed_safe_limits? in addition to existing flags.

Screenshots or screen recordings

Before After
Before After

How to set up and validate locally

  1. Enable rapid_diffs and rapid_diffs_on_mr_creation feature flags
  2. Go to merge requests list (ex.: https://gitlab.com/gitlab-org/gitlab/-/merge_requests)
  3. Click 'New merge request'
  4. Select branches (pick the ones that would show up many changes), proceed to the next page
  5. Select 'Changes' tab
  6. Observe no warning (assumes you have enough files/lines to trigger the warning)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Emma Park

Merge request reports

Loading