The final diff of gitlab-org/gitlab!270142 is tiny: a handful of lines in the service and a few more in its spec. But getting it merged took a database review with real production query plans, two spec improvements from a reviewer who tested them by breaking the code on purpose, and a Danger failure I caused myself.
This post covers what the issue was, why each_batch was the wrong tool here, how the specs got stronger in review, and what database review looks like when you're a community contributor without access to GitLab's production database tools.
The issue: a batch loop over something already batched
The issue was gitlab-org/gitlab#639257 , opened by Tim Rizzi. It came from a suggestion by Daniyal Arshad in the review of an earlier MR ( !266409 ), which added a Maven snapshot pass to the package cleanup policy.
Some background. Packages::Cleanup::ExecutePolicyService runs a project's package cleanup policy.…