Skip to content

WIP: Resolve "Compare MR code coverage to target branch"

What does this MR do?

This is a spike toward the functionality described in #17265 (moved). Rather than follow @ayufan's proposal precisely, I simply added a base_pipeline method to the MR model and did the calculation in the controller. I did this because it is my first contribution to the codebase, and I didn't have very much time to work on it this week, so I wanted to see if I could address the issue without having to dig through the entirety of the gitlab codebase - from my perspective this was the best use of my time in learning the codebase and trying to address the issue without getting totally sidetracked. I understand there may be perf issues (e.g. additional DB queries), will investigate this when I next have time to work on this.

I haven't added the UI for this, or run it against real data, it's just tests + implementation based on my analysis as a newbie to the codebase. Emphatically not mergeable, but if I can get a little feedback on the approach and whether I'm even comparing the right pipelines, I'm happy to finish this up / squash&rebase and get it merged.

(Oh, and while writing tests for this, I noticed that the ci_status on the MR controller was untested, so that's another benefit of this MR - the coverage will increase :))

Todo:

  • test for MergeRequestsController#ci_status incl. coverage_delta
  • add coverage_delta to ci_status JSON response
  • test and impl for MergeRequest#base_pipeline
  • get review / guidance from other contributors re: direction
  • UI
  • acceptance criteria below

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Merge request reports