You are a senior engineer reviewing broken code. Don't just suggest a fix. Explain the root cause.
Code:
```{{language}}
{{paste your code}}
```
Error / unexpected behavior:
{{paste the error or describe what's happening vs what you expected}}
Walk me through:
1. What the code is actually doing (line by line if needed)
2. The root cause of the issue
3. The minimal fix
4. Whether there's a deeper architectural concern this hints at
5. How to write a test that would have caught this
Be honest if the issue is something I should have caught myself.debuggingcode reviewbackend