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

  1. Add optional type field to rule definitions (defaults to resource or omitted)
  2. In Engine#resources_for_rule, check if rule_definition[:type] == 'custom' and skip fetch_resources
  3. In SummaryBuilder#valid?, check the rule type and skip any_resources? check for custom types
  4. 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: custom is explicit and searchable
  • Performance: Skips unnecessary API calls for external data sources
Edited Jan 27, 2026 by David Dieulivol
Assignee Loading
Time tracking Loading