# Add a missing test for a bug that shipped

Add a missing test for a bug that shipped: Name the bug that already got fixed, and get a test that makes sure it can't come back unnoticed.

Source: https://codeherder.com/starter-briefs/test-for-a-shipped-bug/

Starter briefs

Name the bug that already got fixed, and get a test that makes sure it can't come back unnoticed.

[Request access →](https://codeherder.com/get-started/#request-access) [Part of: Cover untested code →](https://codeherder.com/use-cases/cover-untested-code/)

## The brief

Copy this text as it is, or change the specifics to match your own case, then file it as a task.

Copy this and file it as a task

Copy brief

```
We already fixed a bug, but nobody added a test for it, so if it comes back nothing will catch it. Write a test that fails on the old broken behavior and passes with the fix in place, and add it to the existing test suite for that part of the product.
```

## Why this works

It has a concrete, checkable target: a test that fails against the old behavior and passes against the fix. That's a much narrower job than "add more tests," and it's easy to confirm by temporarily reverting the fix and watching the new test catch it.

How it runs

## Plan, code, review, merge, verify

1. plan Reads the fix and the behavior it corrected, and works out how to reproduce the old broken state in a test.
2. code Writes a test that fails without the fix and passes with it, and adds it to the existing suite for that area.
3. review Reverts the fix on purpose and watches the new test fail, then restores it.
4. merge Opens a pull request adding just this one test.
5. verify Confirms the new test runs clean alongside the rest of the suite.

## What you need on hand

- A description of the bug that was fixed, and roughly where the fix lives
- The test framework already used for that part of the product
- A person to check the test actually would have caught the original bug

## Done when

- The new test fails if the original bug's fix is reverted
- The new test passes with the fix in place
- The rest of the test suite still runs clean

## Proof, not a promise

No real task in examples.ts matches this brief's exact shape yet. What's real is the mechanism: an agent writes a test against the bug's original broken behavior first. Revert the fix, and the test fails; that's the proof it catches the regression.

Keep going

## Related briefs

[One doc page no longer matches the product Point at the doc page and the feature it describes, and get the drifted parts corrected.](https://codeherder.com/starter-briefs/doc-page-out-of-date/) [Cover the one file nobody has tests for Name a file with no test coverage, and get a real test suite for what it actually does.](https://codeherder.com/starter-briefs/cover-the-untested-file/) [A control that is cut off on a phone File the button or menu that gets clipped on a narrow screen, and get it fixed.](https://codeherder.com/starter-briefs/control-cut-off-on-phone/)

[← See every brief](https://codeherder.com/starter-briefs)
