Reviewing code changes
Send Qwen3.7-Max the diff and the surrounding functions, and ask which change can break existing behaviour and why. Write a test that reproduces each finding before you change the code.
Example: Which change in this diff breaks checkout?
Material
- cart.ts (diff)
- - if (qty <= 0) return removeItem(id); + if (qty < 0) return removeItem(id);
- checkout.ts
- Order total is the sum of price × qty for every line in the cart.
PromptReview the diff, name the change that can break existing behaviour, and explain how it fails.
Sample answer · written by hand to show the reasoning
The guard changed from qty <= 0 to qty < 0, so setting a quantity to 0 no longer removes the line. The item stays in the cart with qty 0: it adds nothing to the total but still shows up at checkout and may be sent to fulfilment. Restore <= 0, or remove zero-quantity lines before checkout, and add a test that sets qty to 0.