Add diffs_stats endpoints Rapid Diffs

What does this MR do and why?

This MR implements new diffs_stats endpoints for the Rapid Diffs feature. It has been implemented across all controllers that use rapid diffs (MergeRequests, Commit, Compare, Merge Request Creation). It includes overflow information for handling large diffs.

How to set up and validate locally

  1. Enable the rapid diffs feature flag: Feature.enable(:rapid_diffs)

  2. Test the endpoint for each resource:

    • /projects/:project_id/merge_requests/:merge_request_iid/diffs_stats
    • /projects/:project_id/commit/:id/diffs_stats
    • /projects/:project_id/compare/:from...:to/diffs_stats
    • /projects/:project_id/merge_requests/new/diffs_stats
  3. Verify the response format:

    {
      "diffs_stats": {
        "added_lines": 10,
        "removed_lines": 5,
        "diffs_count": 3
      },
      "overflow": {
        "visible_count": 3,
        "email_path": "/path/to/email",
        "diff_path": "/path/to/diff"
      }
    }

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.

Related to #524593 (closed)

Edited by Gavin Hinfey

Merge request reports

Loading