FAILURE MAP
← Case archive

FA-60300 / Inventory cost layering / Member archive

Periodic weighted average with vendor returns: return unit removal · case 05

The average cost falls after a vendor return because units stay in the pool while value leaves.

Member previewVariant 5 · 3 implementations · 7 checks per implementation

Case contract

Input {begin:[qty,value], purchases:[[qty,value]], vendor_returns:[[purchase_index,qty]], ending_qty}. Each vendor return removes qty units and floor(value*qty/purchase_qty) value of that purchase. The pool is beginning plus purchases less returns; ending value = round-half-up(ending_qty*pool value/pool units); COGS = pool value - ending value. ending_qty outside [0, pool units] returns {"error"}. Return {units, pool, ending_value, cogs}.

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
basic{"cogs": 3118, "ending_value": 1337, "pool": 4455, "units": 40}{"cogs": 2928, "ending_value": 1527, "pool": 4455, "units": 35}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 ↗