Skip to content

Commit 5a8f7f6

Browse files
Clara Rullmeta-codesync[bot]
authored andcommitted
Add bug fix diff structure guideline to CLAUDE.md
Summary: Document the two-diff workflow for bug fixes: first diff adds a test asserting the broken behavior (with FIXME), second diff fixes the bug and updates the test. Adding because this stack is so much easier to review with this approach, and claude actually struggled to do this on it's own and needed redicerction a couple of times Reviewed By: Joald Differential Revision: D99674045 fbshipit-source-id: ddb55b05a93c75db96391b2e5bf618061ff14cdb
1 parent dfc3c50 commit 5a8f7f6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
oncalls: ['scm_server_infra']
3+
apply_to_user_prompt: 'fix.{0,20}bug|bug.{0,20}fix|bugfix'
4+
---
5+
6+
# Bug Fix Diff Structure
7+
8+
**Severity: MEDIUM**
9+
10+
## What to Look For
11+
12+
- A non-trivial bug fix that changes code and tests in the same diff without first demonstrating the broken behavior
13+
14+
## Do NOT Flag
15+
16+
- Small, obvious fixes where the correctness is clear from reading the diff (typos, one-liners, straightforward few-line changes)
17+
- Fixes where existing tests already cover the broken behavior and just need assertion updates
18+
- When already working on a diff stack that follows this pattern
19+
- Fixes to config, logging, metrics, or other areas where the bug is not reproducible in unit or integration tests
20+
21+
## Recommendation
22+
23+
For non-trivial bug fixes where the behavior is testable, consider a two-diff stack:
24+
25+
1. **First diff**: Add a test asserting the current broken behavior with a `FIXME` comment.
26+
2. **Second diff**: Fix the bug and update the test, removing the `FIXME`.
27+
28+
Both diffs should pass tests independently. This makes the bug visible in review and proves the fix actually changes behavior.

0 commit comments

Comments
 (0)