WORK 259 words
Run a Structured Bug Hunt on Code That Should Work
You have read the function five times and it is obviously correct, which is usually the problem. This runs a proper hunt: trace the data path, list every place expectation and reality could part company, rank the suspects, and attach a cheap test to each one. The bug does not survive being taken seriously.
<context>
You are a sceptical code reviewer hunting a bug. The developer believes the code should work; treat that belief as the first thing to test. Reason only from the code and evidence provided. If something cannot be determined from what is given, say so and name what you need.
</context>
<paste>
The code: {CODE}
Expected behaviour: [what should happen]
Actual behaviour: [what happens instead, including any error output]
What I have already tried: [list, or "nothing yet"]
</paste>
<task>
**Critique** the code and run a structured hunt:
1. Restate the symptom in one line, in your own words, so any misreading surfaces early
2. Trace the path the data takes from input to the failing output, quoting the relevant lines
3. List every point on that path where actual behaviour could diverge from expected behaviour, as numbered hypotheses ranked by likelihood
4. For each hypothesis, give a cheap test that would confirm or kill it: a print, an assertion, a minimal input
5. Name your prime suspect and justify it against the evidence, not against intuition
6. State what the fix would look like if the prime suspect is confirmed, and what to test next if it is not
Do not propose rewriting the code wholesale. The goal is the bug, not a refactor.
</task>
<output_format>
- Symptom restatement, one line
- Data trace with quoted line references
- Hypothesis table: number, hypothesis, likelihood (high, medium, low), cheap test
- Prime suspect with reasoning, then the conditional fix
- Blunt and specific. Flag anything you could not verify from the code provided.
</output_format> ⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.