FAILURE MAP
← Case archive

FA-95436 / Shipping rate zone lookup / Open access

Surcharges: residential area uplift missing · case 01

Residential deliveries in surcharge areas are billed the commercial area fee.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The residential uplift on delivery area surcharges is not applied.

VERIFIED REPAIR

Add 100 cents to the area fee when the delivery is residential.

Unsuccessful approach: Applying the uplift to commercial deliveries overcharges businesses.

Case contract

Cents. Residential 550; delivery area DAS 395 or EXT 510, plus 100 when the delivery is residential. Fuel = fuel_bp basis points of (base + residential + delivery area), rounded half up to the cent. Declared value (whole dollars): first $100 free, then 105 cents per $100 or part. Return [fuel, declared_value_fee, total].

Why this case matters

Accessorials and fuel are layered on the zone rate in a fixed order.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(base, residential, das, declared, fuel_bp):
    res = 550 if residential else 0
    das_fee = {'NONE': 0, 'DAS': 395, 'EXT': 510}[das]
    subject = base + res + das_fee
    fuel = (subject * fuel_bp + 5000) // 10000
    excess = max(0, declared - 100)
    dv = -(-excess // 100) * 105
    return [fuel, dv, subject + fuel + dv]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 2', [1000, False, 'EXT', 50, 1000], [151, 0, 1661]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['generated mix 7', [2345, False, 'DAS', 0, 1850], [507, 0, 3247]], ['generated mix 15', [2000, False, 'DAS', 101, 1625], [389, 105, 2889]]], [['generated mix 14', [2345, True, 'EXT', 1000, 1250], [438, 945, 4888]], ['generated mix 12', [4000, False, 'DAS', 0, 1850], [813, 0, 5208]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['generated mix 9', [4000, True, 'EXT', 100, 1250], [645, 0, 5805]], ['generated mix 19', [1000, False, 'DAS', 50, 1500], [209, 0, 1604]]], [['generated mix 33', [2000, True, 'EXT', 101, 1850], [585, 105, 3850]], ['generated mix 27', [1234, False, 'EXT', 101, 1625], [283, 105, 2132]], ['declared 250', [2000, True, 'NONE', 250, 1000], [255, 210, 3015]], ['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['generated mix 20', [1000, True, 'DAS', 250, 1500], [307, 210, 2562]], ['generated mix 29', [1500, True, 'NONE', 50, 1625], [333, 0, 2383]]], [['generated mix 57', [2000, True, 'DAS', 100, 1250], [381, 0, 3426]], ['generated mix 37', [2345, False, 'DAS', 1000, 1625], [445, 945, 4130]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['declared part hundred', [2000, False, 'NONE', 101, 1000], [200, 105, 2305]], ['declared 250', [2000, True, 'NONE', 250, 1000], [255, 210, 3015]], ['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 31', [2345, True, 'DAS', 50, 1850], [627, 0, 4017]], ['generated mix 40', [1000, True, 'EXT', 50, 1000], [216, 0, 2376]]], [['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 49', [4000, False, 'EXT', 200, 1500], [677, 105, 5292]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['generated mix 42', [4000, False, 'EXT', 200, 1250], [564, 105, 5179]], ['generated mix 51', [2345, False, 'NONE', 250, 1625], [381, 210, 2936]], ['generated mix 59', [4000, True, 'EXT', 50, 1250], [645, 0, 5805]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
residential ext uplift[206, 0, 2266][216, 0, 2376]Failed
generated mix 2[151, 0, 1661][151, 0, 1661]Passed
commercial das[209, 0, 1604][209, 0, 1604]Passed
fuel exact half[127, 0, 1139][127, 0, 1139]Passed
declared exactly 100[200, 0, 2200][200, 0, 2200]Passed
half cent up[125, 0, 1125][125, 0, 1125]Passed
generated mix 7[507, 0, 3247][507, 0, 3247]Passed
generated mix 15[389, 105, 2889][389, 105, 2889]Passed

SHA-256 / 7dff8f18546d63aad9ad7714540c48059192169edd37786f330f9c6319f24f1e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(base, residential, das, declared, fuel_bp):
    res = 550 if residential else 0
    das_fee = {'NONE': 0, 'DAS': 395, 'EXT': 510}[das]
    if das != 'NONE':
        das_fee += 100
    subject = base + res + das_fee
    fuel = (subject * fuel_bp + 5000) // 10000
    excess = max(0, declared - 100)
    dv = -(-excess // 100) * 105
    return [fuel, dv, subject + fuel + dv]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 2', [1000, False, 'EXT', 50, 1000], [151, 0, 1661]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['generated mix 7', [2345, False, 'DAS', 0, 1850], [507, 0, 3247]], ['generated mix 15', [2000, False, 'DAS', 101, 1625], [389, 105, 2889]]], [['generated mix 14', [2345, True, 'EXT', 1000, 1250], [438, 945, 4888]], ['generated mix 12', [4000, False, 'DAS', 0, 1850], [813, 0, 5208]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['generated mix 9', [4000, True, 'EXT', 100, 1250], [645, 0, 5805]], ['generated mix 19', [1000, False, 'DAS', 50, 1500], [209, 0, 1604]]], [['generated mix 33', [2000, True, 'EXT', 101, 1850], [585, 105, 3850]], ['generated mix 27', [1234, False, 'EXT', 101, 1625], [283, 105, 2132]], ['declared 250', [2000, True, 'NONE', 250, 1000], [255, 210, 3015]], ['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['generated mix 20', [1000, True, 'DAS', 250, 1500], [307, 210, 2562]], ['generated mix 29', [1500, True, 'NONE', 50, 1625], [333, 0, 2383]]], [['generated mix 57', [2000, True, 'DAS', 100, 1250], [381, 0, 3426]], ['generated mix 37', [2345, False, 'DAS', 1000, 1625], [445, 945, 4130]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['declared part hundred', [2000, False, 'NONE', 101, 1000], [200, 105, 2305]], ['declared 250', [2000, True, 'NONE', 250, 1000], [255, 210, 3015]], ['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 31', [2345, True, 'DAS', 50, 1850], [627, 0, 4017]], ['generated mix 40', [1000, True, 'EXT', 50, 1000], [216, 0, 2376]]], [['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 49', [4000, False, 'EXT', 200, 1500], [677, 105, 5292]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['generated mix 42', [4000, False, 'EXT', 200, 1250], [564, 105, 5179]], ['generated mix 51', [2345, False, 'NONE', 250, 1625], [381, 210, 2936]], ['generated mix 59', [4000, True, 'EXT', 50, 1250], [645, 0, 5805]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
residential ext uplift[216, 0, 2376][216, 0, 2376]Passed
generated mix 2[161, 0, 1771][151, 0, 1661]Failed
commercial das[224, 0, 1719][209, 0, 1604]Failed
fuel exact half[127, 0, 1139][127, 0, 1139]Passed
declared exactly 100[200, 0, 2200][200, 0, 2200]Passed
half cent up[125, 0, 1125][125, 0, 1125]Passed
generated mix 7[525, 0, 3365][507, 0, 3247]Failed
generated mix 15[405, 105, 3005][389, 105, 2889]Failed

SHA-256 / 7262fa225b44224f848b81af4f96c598c2b35c8a613519b9f5fe030c153cad94

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(base, residential, das, declared, fuel_bp):
    res = 550 if residential else 0
    das_fee = {'NONE': 0, 'DAS': 395, 'EXT': 510}[das]
    if residential and das != 'NONE':
        das_fee += 100
    subject = base + res + das_fee
    fuel = (subject * fuel_bp + 5000) // 10000
    excess = max(0, declared - 100)
    dv = -(-excess // 100) * 105
    return [fuel, dv, subject + fuel + dv]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 2', [1000, False, 'EXT', 50, 1000], [151, 0, 1661]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['generated mix 7', [2345, False, 'DAS', 0, 1850], [507, 0, 3247]], ['generated mix 15', [2000, False, 'DAS', 101, 1625], [389, 105, 2889]]], [['generated mix 14', [2345, True, 'EXT', 1000, 1250], [438, 945, 4888]], ['generated mix 12', [4000, False, 'DAS', 0, 1850], [813, 0, 5208]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['generated mix 9', [4000, True, 'EXT', 100, 1250], [645, 0, 5805]], ['generated mix 19', [1000, False, 'DAS', 50, 1500], [209, 0, 1604]]], [['generated mix 33', [2000, True, 'EXT', 101, 1850], [585, 105, 3850]], ['generated mix 27', [1234, False, 'EXT', 101, 1625], [283, 105, 2132]], ['declared 250', [2000, True, 'NONE', 250, 1000], [255, 210, 3015]], ['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['generated mix 20', [1000, True, 'DAS', 250, 1500], [307, 210, 2562]], ['generated mix 29', [1500, True, 'NONE', 50, 1625], [333, 0, 2383]]], [['generated mix 57', [2000, True, 'DAS', 100, 1250], [381, 0, 3426]], ['generated mix 37', [2345, False, 'DAS', 1000, 1625], [445, 945, 4130]], ['half cent up', [1000, False, 'NONE', 0, 1250], [125, 0, 1125]], ['declared part hundred', [2000, False, 'NONE', 101, 1000], [200, 105, 2305]], ['declared 250', [2000, True, 'NONE', 250, 1000], [255, 210, 3015]], ['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 31', [2345, True, 'DAS', 50, 1850], [627, 0, 4017]], ['generated mix 40', [1000, True, 'EXT', 50, 1000], [216, 0, 2376]]], [['residential ext uplift', [1000, True, 'EXT', 0, 1000], [216, 0, 2376]], ['generated mix 49', [4000, False, 'EXT', 200, 1500], [677, 105, 5292]], ['commercial das', [1000, False, 'DAS', 0, 1500], [209, 0, 1604]], ['fuel exact half', [1012, False, 'NONE', 0, 1250], [127, 0, 1139]], ['declared exactly 100', [2000, False, 'NONE', 100, 1000], [200, 0, 2200]], ['generated mix 42', [4000, False, 'EXT', 200, 1250], [564, 105, 5179]], ['generated mix 51', [2345, False, 'NONE', 250, 1625], [381, 210, 2936]], ['generated mix 59', [4000, True, 'EXT', 50, 1250], [645, 0, 5805]]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
residential ext uplift[216, 0, 2376][216, 0, 2376]Passed
generated mix 2[151, 0, 1661][151, 0, 1661]Passed
commercial das[209, 0, 1604][209, 0, 1604]Passed
fuel exact half[127, 0, 1139][127, 0, 1139]Passed
declared exactly 100[200, 0, 2200][200, 0, 2200]Passed
half cent up[125, 0, 1125][125, 0, 1125]Passed
generated mix 7[507, 0, 3247][507, 0, 3247]Passed
generated mix 15[389, 105, 2889][389, 105, 2889]Passed

SHA-256 / aa8a7fffde87f881e6004cd5f05bd4d064bf8d977b0fe9af9d40bd1a47eb56ac

Verification & scope

Stipulated fee amounts and ordering. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:52:13.640387+00:00.

Case digest / e21f374ed09c0c40be9135d501ec52a1a8a1f2a2d77cc72f490d11fa050572ac