FAILURE MAP
← Case archive

FA-60139 / Inventory cost layering / Member archive

FIFO costing with customer returns: return credit cost · case 04

Customer returns are credited at the latest receipt price rather than the cost the units shipped at.

Member previewVariant 4 · 3 implementations · 7 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
full return{"layers": [[1, 2, 20], [2, 2, 30]], "results": [1, 2, 100, 120]}{"layers": [[1, 2, 20], [2, 2, 30]], "results": [1, 2, 100, 100]}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 ↗