INV-431 · Overselling during peak-sale load test
During the load test the warehouse dashboard showed negative stock for several SKUs, and the stock endpoint shows numbers that are always one update behind. Clients also report that bad input returns an HTML 500 page instead of our JSON error format.
Expected behaviour:
PATCH /api/products/:id/stock returns the new document. If shipping would push stock below 0, respond 409 and leave stock untouched (it must be safe under concurrency).
- Malformed ids return 400
{ message: 'Invalid product id' }.
Definition of done: tests/inventory.test.js is green.