Fix LFS pointer checks only verifying first reference
What does this MR do?
Right now, all Git checks we have are implemented on top of the ChangeAccess class, which provides the infrastructure to check a single reference update. This is not a good fit for all checks though, given that some may be computed much more efficiently if all changes were batched together into a single call.
One of these examples are the LFS checks, which have been retrofitted to match that interface by only executing them for the first reference. This may lead to wrong results (e.g. the user may arrange ref updates such that only the second ref introduced new dangling LFS pointers) and make for code that is hard to understand.
To fix this issue, create new infrastructure for batched checks in the form of a new ChangesAccess class. In contrast to the ChangeAccess class, it hands over all changes at once to the respective checks instead of only passing over single references.
As a proof of concept, this MR also moves over the LFS checks to use the new infrastructure. This does indeed also fix a bug where only the first reference was ever checked for LFS pointers. With the new batched interface, we can efficiently compute new LFS pointers across all changed refs at once.
It's only the first user though: a second user is going to be the DiffCheck, which can also be converted to compute all newly introduced commits in a similar fashion.
Closes #330324 (closed)
Does this MR meet the acceptance criteria?
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
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