"When inventory drops below the re-order level, we automatically order more," was how the product owner described the requirement to the junior developer. The junior toddled off to work, made their changes. They were not, however, given sufficient supervision, any additional guidance, or any code-reviews.
Dan found this in production:
let item = backend.fetchItem(itemId);
if (item.quantityOnHand <= item.reorderLevel) {
//automatic re-order
item.quantityOnHand++;
}
else {
item.quantityOnHand--;
}
backend.updateItem(item);
As you might imagine, "ordering refills" is slightly more complicated than "just alter the inventory quantity". This code didn't work. It should never have gotten released. And it's definitely not the junior developer's fault.