Support summaries without requiring resources
Problem
Currently, gitlab-triage requires at least 1 resource for a summary to be valid (see SummaryBuilder#any_resources?). This means that if you want to generate a summary that doesn't actually use GitLab issue data (e.g., pulling data from an external source like ClickHouse), you still need to fetch at least 1 issue from the API.
This creates unnecessary API overhead when the summary content is generated entirely from external data sources.
Proposal
Add an optional type field to summary rules. When type: custom is specified, skip resource fetching entirely and allow the summary to be valid without any resources.
Default behavior (unchanged):
summaries:
- name: Bug Report
rules:
- name: Open Bugs
# type defaults to 'resource' (or omitted)
conditions:
labels: [bug]
actions:
summarize:
title: "Bugs"
item: "- {{title}}"
summary: "{{items}}"
New custom type:
summaries:
- name: Weekly Report
rules:
- name: Quarantined Tests
type: custom # Skip resource fetching
actions:
summarize:
title: "Quarantined Tests"
summary: |
#{ fetch_quarantined_tests_from_clickhouse() }
Implementation
- Add optional
typefield to rule definitions (defaults toresourceor omitted) - In
Engine#resources_for_rule, check ifrule_definition[:type] == 'custom'and skipfetch_resources - In
SummaryBuilder#valid?, check the rule type and skipany_resources?check for custom types - Update documentation with examples
Use Case
In triage-ops, we're generating quarantine test summaries by querying ClickHouse directly. The summary doesn't use any GitLab issue data, but we currently have to fetch issues with a specific label just to satisfy the any_resources? check.
Benefits
- Backward compatible: Existing policies work unchanged
- Minimal API changes: Just one optional field
-
Clear intent:
type: customis explicit and searchable - Performance: Skips unnecessary API calls for external data sources