FA-59848 / Inventory cost layering / Member archive
FIFO perpetual issue: stock sufficiency boundary · case 03
An issue that exactly empties the warehouse is rejected as short even though every unit is on hand.
Case contract
Input {layers:[[qty,unit_cost]] oldest first, events:[["recv",qty,unit_cost]|["issue",qty]]}. Issues consume the oldest layer first; an issue larger than on-hand is rejected whole and reported as "short"; a receipt at exactly the newest layer cost merges into it; receipts of zero or negative quantity are ignored. Return {cogs:[per-issue cost or "short"], layers}.
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 |
|---|---|---|---|
| exact depletion | {"cogs": ["short"], "layers": [[4, 50], [3, 70]]} | {"cogs": [410], "layers": []} | 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 ↗