FAILURE MAP
← Case archive

FA-60293 / Inventory cost layering / Member archive

Periodic weighted average with vendor returns: beginning inventory in pool · case 03

The average ignores opening stock, so a costly opening balance does not raise the average.

Member previewVariant 3 · 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": 2269, "ending_value": 1184, "pool": 3453, "units": 35}{"cogs": 2926, "ending_value": 1527, "pool": 4453, "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 ↗