# Add the test that would have caught it

The first action item on every postmortem, written as a test that fails against the commit that caused the outage.

Category: Incident follow-through
Source: https://letsship.ai/use-cases/add-the-test-that-would-have-caught-it
Published: 2026-08-25

## Goal

Write the test that would have caught the incident before it reached production.

## Acceptance criteria

- The test fails when run against the commit that caused the incident
- It asserts the condition that broke, not the symptom that was noticed
- It runs in the normal suite rather than a special one
- The incident is referenced in the description

## What lands as proof

The test run against the offending commit, failing. Anything else is a guess about what would have caught it.

## Prompt

Copy this to an agent to open the ticket:

```text
Create a Linear issue in my team and assign it to the SHIP agent.

Title: Add the regression test for the {incident} incident

Description: Write the test that would have caught the incident before it reached production.

Acceptance criteria:
- The test fails when run against the commit that caused the incident
- It asserts the condition that broke, not the symptom that was noticed
- It runs in the normal suite rather than a special one
- The incident is referenced in the description

Before you create the issue, find the incident and the commit that caused it, and replace {incident} with the incident reference.
```

## Questions

### What does the agent actually change?

The ticket is scoped to one outcome: write the test that would have caught the incident before it reached production. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.

### How do I know the work is done?

The pull request carries the evidence, not only the diff. Here that means the test fails against the commit that caused the incident, so a reviewer can confirm the result without reproducing the work locally.

### How much oversight does this need?

None is required before the run starts. Every claim this ticket makes can be checked by machine, so the agent works straight through and a person reviews the finished pull request like any other.
