FAILURE MAP
← Case archive

FA-59913 / Inventory cost layering / Member archive

Moving average perpetual costing: pooled value uses stale average · case 03

The first receipt after an issue is averaged as if the issued units were still on hand.

Member previewVariant 3 · 3 implementations · 9 checks per implementation

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 fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
zero then receipt{"avg": 106, "cogs": [100, 106], "onhand": 2}{"avg": 73, "cogs": [100, 73], "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 ↗