FAILURE MAP
← Case archive

FA-59948 / Inventory cost layering / Member archive

Landed cost allocation to receipt layers: duty base · case 03

Duty is overstated because it is levied on the allocated freight as well as the goods.

Member previewVariant 3 · 3 implementations · 8 checks per implementation

Case contract

Input {lines:[{sku,qty,unit_cost,weight(per unit)}], freight, duty_bp, basis:"weight"|"value"}. Freight is allocated in proportion to qty*weight (or line value); floor shares are topped up one cent at a time by largest remainder, ties to the earlier line. If the weight basis sums to zero, fall back to value; if that is zero too return {"error"}. Duty is round-half-up(line value*duty_bp/10000) on merchandise value only. Landed total = value+freight share+duty; unit = round-half-up(landed/qty).

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
weight basis[{"duty": 94, "freight": 772, "landed": 3866, "sku": "A", "unit": 387}, {"duty": 131, "freight": 231, "landed": 5362, "sku": "B", "unit": 5362}][{"duty": 75, "freight": 772, "landed": 3847, "sku": "A", "unit": 385}, {"duty": 125, "freight": 231, "landed": 5356, "sku": "B", "unit": 5356}]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 ↗