FAILURE MAP
← Case archive

FA-95671 / Shipping rate zone lookup / Open access

Contract discount: spend on threshold gets lower tier · case 01

Accounts spending exactly a tier threshold receive the lower discount.

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

ROOT CAUSE

The tier test is strict at the spend threshold.

VERIFIED REPAIR

A tier applies when spend is at least its threshold.

Unsuccessful approach: Rounding spend to whole dollars promotes accounts that fall a few cents short.

Case contract

Cents. Weekly spend (dollars, may have cents) selects the discount: >= 5000 -> 25%, >= 2000 -> 18%, >= 500 -> 12%, else 0. Discount = list * pct / 100 rounded half up. Net is floored at the minimum charge, but never above the list rate. Return [pct, net].

Why this case matters

Contract pricing discounts list rates by volume tier subject to a minimum.

1 / The failure

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

N = 1
observations = []
def solve(list_rate, spend, min_charge):
    pct = 0
    for limit, p in ((5000, 25), (2000, 18), (500, 12)):
        if spend > limit:
            pct = p
            break
    disc = (list_rate * pct + 50) // 100
    net = list_rate - disc
    floor_amt = min(min_charge, list_rate)
    return [pct, max(net, floor_amt)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['tier edge', [1000, 2000, 500], [18, 820]], ['generated mix 1', [700, 499.99, 500], [0, 700]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['top tier', [1000, 6000, 500], [25, 750]], ['generated mix 7', [2000, 100, 0], [0, 2000]], ['generated mix 15', [1250, 8000, 900], [25, 937]]], [['generated mix 20', [4999, 5000, 500], [25, 3749]], ['generated mix 14', [4999, 1999.6, 1200], [12, 4399]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['tier edge', [1000, 2000, 500], [18, 820]], ['top tier', [1000, 6000, 500], [25, 750]], ['generated mix 9', [1000, 500, 900], [12, 900]], ['generated mix 18', [700, 8000, 0], [25, 525]]], [['generated mix 34', [700, 500, 900], [12, 700]], ['generated mix 31', [700, 4999.5, 900], [18, 700]], ['no discount', [1000, 100, 500], [0, 1000]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['generated mix 20', [4999, 5000, 500], [25, 3749]], ['generated mix 28', [1333, 2000, 1200], [18, 1200]]], [['generated mix 62', [2000, 2000, 0], [18, 1640]], ['generated mix 41', [1025, 499.99, 0], [0, 1025]], ['top tier', [1000, 6000, 500], [25, 750]], ['minimum applies', [1000, 6000, 900], [25, 900]], ['no discount', [1000, 100, 500], [0, 1000]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['generated mix 31', [700, 4999.5, 900], [18, 700]], ['generated mix 39', [700, 1999.6, 1200], [12, 700]]], [['generated mix 75', [1025, 500, 500], [12, 902]], ['generated mix 52', [1333, 1999.6, 500], [12, 1173]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['tier edge', [1000, 2000, 500], [18, 820]], ['top tier', [1000, 6000, 500], [25, 750]], ['minimum applies', [1000, 6000, 900], [25, 900]], ['generated mix 42', [1025, 1999.6, 500], [12, 902]], ['generated mix 50', [1025, 2000, 500], [18, 840]]]]
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
tier edge[12, 880][18, 820]Failed
generated mix 1[0, 700][0, 700]Passed
just under tier[12, 880][12, 880]Passed
half cent discount[12, 902][18, 840]Failed
minimum capped by list[25, 700][25, 700]Passed
top tier[25, 750][25, 750]Passed
generated mix 7[0, 2000][0, 2000]Passed
generated mix 15[25, 937][25, 937]Passed

SHA-256 / 2db55d03856195ff3dc9a2f269348faef02ab6e766ddf67b61e883f8796f3c53

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(list_rate, spend, min_charge):
    pct = 0
    for limit, p in ((5000, 25), (2000, 18), (500, 12)):
        if round(spend) >= limit:
            pct = p
            break
    disc = (list_rate * pct + 50) // 100
    net = list_rate - disc
    floor_amt = min(min_charge, list_rate)
    return [pct, max(net, floor_amt)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['tier edge', [1000, 2000, 500], [18, 820]], ['generated mix 1', [700, 499.99, 500], [0, 700]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['top tier', [1000, 6000, 500], [25, 750]], ['generated mix 7', [2000, 100, 0], [0, 2000]], ['generated mix 15', [1250, 8000, 900], [25, 937]]], [['generated mix 20', [4999, 5000, 500], [25, 3749]], ['generated mix 14', [4999, 1999.6, 1200], [12, 4399]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['tier edge', [1000, 2000, 500], [18, 820]], ['top tier', [1000, 6000, 500], [25, 750]], ['generated mix 9', [1000, 500, 900], [12, 900]], ['generated mix 18', [700, 8000, 0], [25, 525]]], [['generated mix 34', [700, 500, 900], [12, 700]], ['generated mix 31', [700, 4999.5, 900], [18, 700]], ['no discount', [1000, 100, 500], [0, 1000]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['generated mix 20', [4999, 5000, 500], [25, 3749]], ['generated mix 28', [1333, 2000, 1200], [18, 1200]]], [['generated mix 62', [2000, 2000, 0], [18, 1640]], ['generated mix 41', [1025, 499.99, 0], [0, 1025]], ['top tier', [1000, 6000, 500], [25, 750]], ['minimum applies', [1000, 6000, 900], [25, 900]], ['no discount', [1000, 100, 500], [0, 1000]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['generated mix 31', [700, 4999.5, 900], [18, 700]], ['generated mix 39', [700, 1999.6, 1200], [12, 700]]], [['generated mix 75', [1025, 500, 500], [12, 902]], ['generated mix 52', [1333, 1999.6, 500], [12, 1173]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['tier edge', [1000, 2000, 500], [18, 820]], ['top tier', [1000, 6000, 500], [25, 750]], ['minimum applies', [1000, 6000, 900], [25, 900]], ['generated mix 42', [1025, 1999.6, 500], [12, 902]], ['generated mix 50', [1025, 2000, 500], [18, 840]]]]
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
tier edge[18, 820][18, 820]Passed
generated mix 1[12, 616][0, 700]Failed
just under tier[18, 820][12, 880]Failed
half cent discount[18, 840][18, 840]Passed
minimum capped by list[25, 700][25, 700]Passed
top tier[25, 750][25, 750]Passed
generated mix 7[0, 2000][0, 2000]Passed
generated mix 15[25, 937][25, 937]Passed

SHA-256 / edbfc6bcf4188a1ddeffc9b69b8968eca8fe7a55ab486ba78fa11a603cd819ab

3 / The verified repair

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

N = 1
observations = []
def solve(list_rate, spend, min_charge):
    pct = 0
    for limit, p in ((5000, 25), (2000, 18), (500, 12)):
        if spend >= limit:
            pct = p
            break
    disc = (list_rate * pct + 50) // 100
    net = list_rate - disc
    floor_amt = min(min_charge, list_rate)
    return [pct, max(net, floor_amt)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['tier edge', [1000, 2000, 500], [18, 820]], ['generated mix 1', [700, 499.99, 500], [0, 700]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['top tier', [1000, 6000, 500], [25, 750]], ['generated mix 7', [2000, 100, 0], [0, 2000]], ['generated mix 15', [1250, 8000, 900], [25, 937]]], [['generated mix 20', [4999, 5000, 500], [25, 3749]], ['generated mix 14', [4999, 1999.6, 1200], [12, 4399]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['tier edge', [1000, 2000, 500], [18, 820]], ['top tier', [1000, 6000, 500], [25, 750]], ['generated mix 9', [1000, 500, 900], [12, 900]], ['generated mix 18', [700, 8000, 0], [25, 525]]], [['generated mix 34', [700, 500, 900], [12, 700]], ['generated mix 31', [700, 4999.5, 900], [18, 700]], ['no discount', [1000, 100, 500], [0, 1000]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['half cent discount', [1025, 2000, 500], [18, 840]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['generated mix 20', [4999, 5000, 500], [25, 3749]], ['generated mix 28', [1333, 2000, 1200], [18, 1200]]], [['generated mix 62', [2000, 2000, 0], [18, 1640]], ['generated mix 41', [1025, 499.99, 0], [0, 1025]], ['top tier', [1000, 6000, 500], [25, 750]], ['minimum applies', [1000, 6000, 900], [25, 900]], ['no discount', [1000, 100, 500], [0, 1000]], ['just under tier', [1000, 1999.6, 500], [12, 880]], ['generated mix 31', [700, 4999.5, 900], [18, 700]], ['generated mix 39', [700, 1999.6, 1200], [12, 700]]], [['generated mix 75', [1025, 500, 500], [12, 902]], ['generated mix 52', [1333, 1999.6, 500], [12, 1173]], ['minimum capped by list', [700, 6000, 900], [25, 700]], ['tier edge', [1000, 2000, 500], [18, 820]], ['top tier', [1000, 6000, 500], [25, 750]], ['minimum applies', [1000, 6000, 900], [25, 900]], ['generated mix 42', [1025, 1999.6, 500], [12, 902]], ['generated mix 50', [1025, 2000, 500], [18, 840]]]]
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
tier edge[18, 820][18, 820]Passed
generated mix 1[0, 700][0, 700]Passed
just under tier[12, 880][12, 880]Passed
half cent discount[18, 840][18, 840]Passed
minimum capped by list[25, 700][25, 700]Passed
top tier[25, 750][25, 750]Passed
generated mix 7[0, 2000][0, 2000]Passed
generated mix 15[25, 937][25, 937]Passed

SHA-256 / ab761ebbe44cccd1709914872efbbf75d546ae83e219edec18ee08739badfa29

Verification & scope

Stipulated tiers; no earned incentive periods. 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:15.800875+00:00.

Case digest / fa81b539dc6084dbd36b86c1cb2f1891a736e24d12abb8e75a44573a85759cf8