Add responsibility classification for code coverage

What does this MR do and why?

Describe in detail what your merge request does and why.

Adds responsibility classification to the code coverage export, enabling tracking of whether coverage comes from unit tests ("responsible") or integration/E2E tests ("dependent").

Problem: We can't distinguish between code tested directly by unit tests vs code only exercised through integration/E2E tests. This makes it hard to identify coverage gaps.

Solution: Add two boolean columns to coverage metrics:

is_responsible is_dependent Meaning
true true Has both unit AND integration tests
true false Has only unit tests
false true Coverage gap: no unit tests

Configuration

Patterns are project-specific and provided via YAML config:

# responsibility_patterns.yml
responsible:
  - "^spec/(models|controllers|services)/"
  - "^spec/frontend/"

dependent:
  - "^spec/(requests|features|integration)/"
  - "^qa/"
test-coverage --responsibility-patterns responsibility_patterns.yml ...

Changes

  • Add ResponsibilityClassifier class with configurable regex patterns
  • Add --responsibility-patterns PATH CLI argument (required)
  • Add is_responsible and is_dependent columns to ClickHouse schema
  • Add documentation with examples for GitLab and Rails projects

Related: gitlab-org/quality/analytics/team#340 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Richard Chong

Merge request reports

Loading