Fix authoritative source of truth for diff files when loading batched diffs
What does this MR do?
For #197402 (closed)
This MR fixes a regression caused in the overlap of batched diffs and split diffs.
Problem
For split diffs, we can assume that whatever the API sends back is the full list of files in the diff. The files within will only have half of the diff (either inline or parallel lines) but it will be all of the files. In this case, we can always iterate over the API response and fill in the missing halves of any files in state, dropping any files in state that aren't matched (if the API isn't aware of that file, we shouldn't continue to display it).
However, for batched diffs, this is all incorrect: the API will be responding with pages of data. In a perfect world, these pages will never contain any files that have been loaded before. However, that's not necessarily guaranteed, and - more importantly - when loading batched and split diffs, a page of data may have the exact same set of files that has been loaded before, but the other half of their diffs.
Merge -> Deduplicate Solution
To avoid complicated logic and branching parsing behavior, all diff load types are simply added to a single master list. Every file is processed, and then the full list is deduplicated.
Screenshots
N/A, this is backstage work for the async load of diff data.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
~~Label as security and @ mention @gitlab-com/gl-security/appsec~~ -
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team