Write Regression Tests for Bug Fixes
TEST-WRITE-REGRESSION-TESTS-FOR-BUG-FIXES
Summary
Add a test that fails before the bug fix and protects the repaired contract. Skip only when reproduction is impractical, and then record the closest trustworthy validation.
Rule
Write regression tests for bug fixes unless impractical.
Why
A bug fix without a regression test can silently revert later, especially when the original failure was an edge case, integration path, or user-reported behavior. The test should fail before the fix and explain the broken contract after it is repaired.
Helps
- Preserves user-reported fixes and gives future maintainers a precise failure when the bug returns.
Limits
Skip or defer the test only when the bug is impractical to reproduce safely. In that case, document the reason and use the closest practical validation.
Agent Instruction
Write regression tests for bug fixes that could silently revert, especially edge cases, integration
paths, and user-reported behavior.Mechanisms
Supported by failing-first regression tests, minimized fixtures, issue-linked test names, snapshots, integration tests, and handoff notes when reproduction is impractical.