Hamburger Cross Icon
Ticket Coverage
+
Ticket Coverage Collector

Ticket Coverage + Ticket Coverage Collector

✓ Guardrail ↓ Collector Experimental Security And Compliance

Enforce Ticket Coverage using data collected by Ticket Coverage Collector. Automatically check security and compliance standards on every PR.

Guardrail: Asserts that at least `min_percentage` of the component's pull requests in the trailing window referenced a ticket, reading `.vcs.ticket_coverage` from the ticket-coverage collector. Skips when there is no coverage data yet, and when the window contains no pull requests at all — a component with no recent change should not be reported as failing a change-management control.
Data Source: Record what share of a component's recent pull requests referenced an issue-tracker ticket. Runs on the default branch over Lunar's own history, so change-management coverage reads as a trend on the component rather than only as a verdict on each individual pull request.

How Ticket Coverage Collector Powers This Guardrail

The Ticket Coverage Collector gathers metadata from your vcs systems. This data flows into Lunar's Component JSON, where the Ticket Coverage guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
↓ Ticket Coverage Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
✓ Ticket Coverage Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the Ticket Coverage Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/ticket-coverage@v1.0.5
    # with: ...

# Step 2: Enable the Ticket Coverage Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/ticket-coverage@v1.0.5
    include: [ticket-coverage]
    # with: ...

What Ticket Coverage Collector Collects

This collector gathers the following data that the Ticket Coverage guardrail evaluates.

Collector code

ticket-coverage

Runs on the default branch. Queries Lunar's SQL API for the pull requests recorded against this component within a trailing window, counts how many carried a resolved ticket id at .vcs.pr.ticket.id, and writes the totals and percentage to .vcs.ticket_coverage. Default-branch by design: every Lunar rollup reads default-branch state only, so per-PR ticket results never reach an initiative score. This turns that history into a default-branch fact, so ticket coverage can be scored. Reads only Lunar's own data — no issue-tracker or Git-platform API call and no token, so it behaves the same on any Git platform. Skips rather than fails when it cannot produce a number: in PR context, or when the SQL API is unreachable.

Example Data Flow

Here's an example of the data that Ticket Coverage Collector writes to the Component JSON, which Ticket Coverage then evaluates.

{ } component.json From Ticket Coverage Collector
{
  "vcs": {
    "ticket_coverage": {
      "window_days": 30,
      "prs_total": 24,
      "prs_with_ticket": 21,
      "percentage": 87.5
    }
  }
}

Configuration Options

Ticket Coverage Collector Inputs

Input Required Default Description
window_days Optional 30 Trailing window, in days, over which to measure ticket coverage. A window shorter than the component's release cadence will often contain no pull requests, and the metric skips rather than reporting a misleading zero.

Ticket Coverage Guardrails Inputs

Input Required Default Description
min_percentage Optional 80 Minimum percentage of pull requests in the window that must reference a ticket.

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 300+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Auto-ID My Guardrails
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo