FAILURE MAP
← Case archive

FA-59987 / Inventory cost layering / Member archive

Lower of cost and net realizable value: prior carrying default · case 02

Newly counted items show a huge positive adjustment as if they were previously carried at zero.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

Case contract

Input {items:[{sku,qty,cost,price,complete,sell_bp,group}], prior:{sku:carrying unit}}. NRV = price - complete - round-half-up(price*sell_bp/10000), floored at 0. Carrying unit = min(original cost, NRV). Adjustment = qty*(carrying - prior carrying), prior defaulting to original cost (reversals are thereby capped at cost). Group check: write-down per group = max(0, sum qty*cost - sum qty*NRV). Return {items:[[sku,carry,adj]], group_writedown}.

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
write down{"group_writedown": {"g1": 550}, "items": [["A", 890, 4450]]}{"group_writedown": {"g1": 550}, "items": [["A", 890, -550]]}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 ↗