Inventory Deduction
Level 3 · python · Concurrency · TOCTOU (check-then-act)
Scenario
Review the implementation for “Inventory Deduction”. Trace the relevant controller, service, and storage paths together and identify behavior that violates the contract.
Requirements
- Preserve the documented successful behavior - Handle failure and edge cases according to the stated contract - Keep unrelated data and behavior unchanged - Make the smallest safe correction that satisfies the contract
Acceptance criteria
- The normal success path continues to return the expected result
- The reported edge or failure case is handled according to the contract
- The fix does not introduce unintended changes to unrelated state or behavior