Ticket Coverage + Ticket Coverage Collector
Enforce Ticket Coverage using data collected by Ticket Coverage Collector. Automatically check security and compliance standards on every PR.
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.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# 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.
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.
{
"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.