All problems

Failed Assembly Kit Reservations Consume Earlier Components

Level 2 · node · Reliability · Partial stock mutation on failed multi-component reservations

Scenario

A fictional equipment assembly room reserves several component types from a storage bin for one kit. If any later component is missing or insufficient, the entire reservation must fail without changing stock. The current service deducts earlier components as it checks them, so a failed request can still consume inventory. Inspect the repository, service, and controller flow.

Requirements

Check availability of every requested component before changing any stock. If one component is missing or insufficient, reject the entire request and preserve all previous quantities. Keep successful reservations, bin isolation, invalid input rejection, and duplicate component checks.

Acceptance criteria

  • A successful kit reservation deducts every requested component.
  • If a later component is missing, no component stock changes.
  • If a later component lacks quantity, earlier component stock stays unchanged.
  • Inventory in different bins remains independent.
  • Invalid reservations are rejected without stock changes.
  • Repeated component identifiers in one request are rejected.