TestFailureHistory badge does not include blocked pipelines in calculation

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Work on this issue
  • Close this issue

Proposal

Number of recent failures badge can be seen on the merge requests widget and when viewing a single Unit test. Currently, this badge only calculates failures that occurred in completed pipelines. Pipelines that are blocked (that have a manual job that wasn't triggered) are not counted towards total count of recent test failures on default branch.

This seems like an unnecessary requirement because if a pipeline success was required to register a flaky test, the test job would be forced to be made optional.

We should include tests available in blocked pipelines into calculation.

Relevant discussions: https://gitlab.com/gitlab-com/ops-sub-department/section-ops-request-for-help/-/issues/231

Technical Implementation Proposal

-     after_transition any => ::Ci::Pipeline.completed_statuses  do |pipeline|
+     after_transition any => ::Ci::Pipeline.completed_statuses + ::Ci::Pipeline.blocked_statuses do |pipeline|
        pipeline.run_after_commit do
          ::Ci::TestFailureHistoryService.new(pipeline).async.perform_if_needed # rubocop: disable CodeReuse/ServiceClass
        end
      end

Documentation update

Once implemented, we shold revert the Document TestFailureHistory badge MR.

Edited Aug 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading