FA-59919 / Inventory cost layering / Member archive
Moving average perpetual costing: short issue side effects · case 04
A rejected over-issue still drains on-hand units, making later issues short too.
Case contract
Input {onhand, avg (cents, integer), events}. On receipt the average becomes round-half-up((onhand*avg + qty*cost)/(onhand+qty)) to whole cents; an issue is costed at qty*avg with the current average and never changes it; an issue exceeding on-hand returns "short". When on-hand reaches zero the average is kept as the last value (not reset). Return {cogs, onhand, avg}.
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 |
|---|---|---|---|
| short issue | {"avg": 50, "cogs": ["short"], "onhand": -5} | {"avg": 50, "cogs": ["short"], "onhand": 2} | 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 ↗