FA-59992 / Inventory cost layering / Member archive
Lower of cost and net realizable value: group write-down floor · case 02
Groups whose NRV exceeds cost report a negative write-down, i.e. an unrealized gain.
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 fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| no write down | {"group_writedown": {"g1": -610}, "items": [["B", 500, 0]]} | {"group_writedown": {"g1": 0}, "items": [["B", 500, 0]]} | 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 ↗