FAILURE MAP
← Case archive

FA-60118 / Inventory cost layering / Member archive

FIFO costing with customer returns: restock piece order · case 03

A partial return is credited at the oldest layer cost of the sale instead of the units most recently shipped.

Member previewVariant 3 · 3 implementations · 8 checks per implementation

Case contract

Events: ["recv",qty,cost] opens a layer with the next receipt sequence; ["sale",id,qty] consumes FIFO and records the pieces taken; ["return",id,qty] restocks units at the cost they left with, last-consumed piece first, into the layer with the same receipt sequence (recreated in sequence order if gone). Returns above the unreturned quantity of that sale are "rejected"; sales above stock are "short". Return {results, layers:[[seq,qty,cost]]}.

Why this case matters

Inventory valuation and cost-of-goods decisions depend on this rule.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
return last consumed{"layers": [[1, 2, 10], [2, 3, 14]], "results": [1, 2, 58, 20]}{"layers": [[2, 5, 14]], "results": [1, 2, 58, 28]}Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗