FAILURE MAP
← Case archive

FA-59927 / Inventory cost layering / Member archive

Moving average perpetual costing: issue boundary · case 02

Issuing exactly the on-hand quantity is rejected as short.

Member previewVariant 2 · 3 implementations · 8 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": 63, "cogs": ["short", 63], "onhand": 4}{"avg": 72, "cogs": [100, 72], "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 ↗