Fix custom rule content_available? to check for non-empty description
Context
Custom type rules were always considered to have content available, even when their summary template produced empty output (e.g., when the Ruby method returned nil). This caused parent summary reports to be created even when no child rules had actual content.
This issue was discovered in triage-ops where a ClickHouse-based quarantine helper returns nil when there are no quarantined tests. Despite this, reports were created for 75+ teams because content_available? always returned true for custom rules.
Related: gitlab-org/quality/triage-ops!3804 (merged)
What's in this MR?
- Updates
content_available?to check if the description contains any non-whitespace characters for custom rules, similar to howtitle_present?works - Removes unnecessary
|| falsefromRegexp#match?calls sincematch?already returns a boolean
def content_available?
if @is_custom
/\S+/.match?(description)
else
@resources.any?
end
end
This ensures custom rules only contribute to parent summaries when they produce actual content.
Proof of Work
See triage-ops MR for complete proof of work: gitlab-org/quality/triage-ops!3846 (merged)
Related
- triage-ops fix: gitlab-org/quality/triage-ops!3846 (merged)
- Bug report: gitlab-org/quality/triage-ops#1720 (closed)
Edited by David Dieulivol