FAILURE MAP
← Case archive

FA-66526 / Airline fare rule evaluation / Open access

Five percent mileage band skipped · case 01

Routings 1-5% over MPM are charged a 10M surcharge.

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

ROOT CAUSE

The band list starts at 10, so the first surcharge band is never offered.

VERIFIED REPAIR

Offer bands 5, 10, 15, 20 and 25 in ascending order.

Unsuccessful approach: range(5, 25, 5) stops before 25, so routings in the top band are rejected.

Case contract

Input {'tpm':[segment miles],'tpd':deduction miles,'mpm'}. Total = sum(TPM) - TPD. Total <= MPM -> ['M',0]; else the smallest band b in 5,10,15,20,25 with total <= MPM*(1+b/100) -> ['bM', b]; beyond 25% -> 'ERR_EXCEEDS'. Comparisons are exact integer arithmetic.

Why this case matters

The mileage system surcharges fares in 5% bands when the ticketed routing exceeds the maximum permitted mileage.

1 / The failure

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

N = 1
observations = []
def solve(x):
    total = sum(x['tpm']) - x['tpd']
    mpm = x['mpm']
    if total * 100 <= mpm * 100: return ['M', 0]
    for pct in (10, 15, 20, 25):
        if total * 100 <= mpm * (100 + pct):
            return ['%dM' % pct, pct]
    return 'ERR_EXCEEDS'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['within MPM', {'tpm': [1200, 801], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1107], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 251, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1210], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5256], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [2492, 2156], 'tpd': 0, 'mpm': 4150}, ['15M', 15]], ['sampled case 2', {'tpm': [3592, 2721], 'tpd': 0, 'mpm': 5598}, ['15M', 15]], ['sampled case 3', {'tpm': [402, 360], 'tpd': 73, 'mpm': 652}, ['10M', 10]], ['regression: surcharge band list', {'tpm': [2090, 1881], 'tpd': 0, 'mpm': 3225}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 802], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1108], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 252, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1220], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5257], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [4525, 5148], 'tpd': 0, 'mpm': 7940}, ['25M', 25]], ['sampled case 2', {'tpm': [3880, 3908], 'tpd': 293, 'mpm': 7743}, ['M', 0]], ['sampled case 3', {'tpm': [3404, 3171], 'tpd': 0, 'mpm': 5451}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 803], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1109], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 253, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1230], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5258], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [2696, 2449], 'tpd': 42, 'mpm': 4715}, ['10M', 10]], ['sampled case 2', {'tpm': [193], 'tpd': 0, 'mpm': 8525}, ['M', 0]], ['sampled case 3', {'tpm': [1557, 1285], 'tpd': 0, 'mpm': 2456}, ['20M', 20]], ['regression: surcharge band list', {'tpm': [4198, 4524], 'tpd': 0, 'mpm': 6997}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 804], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1110], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 254, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1240], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5259], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [1579, 2622], 'tpd': 0, 'mpm': 1172}, 'ERR_EXCEEDS'], ['sampled case 2', {'tpm': [3163, 3734], 'tpd': 278, 'mpm': 3722}, 'ERR_EXCEEDS'], ['sampled case 3', {'tpm': [607], 'tpd': 0, 'mpm': 5975}, ['M', 0]], ['regression: surcharge band list', {'tpm': [4543, 4625], 'tpd': 0, 'mpm': 7467}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 805], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1111], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 255, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1250], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5260], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [1024], 'tpd': 298, 'mpm': 6290}, ['M', 0]], ['sampled case 2', {'tpm': [1754, 1180], 'tpd': 0, 'mpm': 872}, 'ERR_EXCEEDS'], ['sampled case 3', {'tpm': [3753, 4785], 'tpd': 130, 'mpm': 7546}, ['15M', 15]], ['regression: surcharge band list', {'tpm': [3646, 3806], 'tpd': 0, 'mpm': 6071}, ['25M', 25]]]]
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
within MPM['M', 0]['M', 0]Passed
exactly MPM['M', 0]['M', 0]Passed
exactly 5 percent over['10M', 10]['5M', 5]Failed
just over 5 percent['10M', 10]['10M', 10]Passed
deduction brings within['M', 0]['M', 0]Passed
beyond 25 percentERR_EXCEEDSERR_EXCEEDSPassed
ratio rounds down to band['10M', 10]['10M', 10]Passed
sampled case 1['15M', 15]['15M', 15]Passed
sampled case 2['15M', 15]['15M', 15]Passed
sampled case 3['10M', 10]['10M', 10]Passed
regression: surcharge band list['25M', 25]['25M', 25]Passed

SHA-256 / 68ac79f8f0dd8b62f254265197dc12e05c8508299bcfcf873a47f33190a8473b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    total = sum(x['tpm']) - x['tpd']
    mpm = x['mpm']
    if total * 100 <= mpm * 100: return ['M', 0]
    for pct in range(5, 25, 5):
        if total * 100 <= mpm * (100 + pct):
            return ['%dM' % pct, pct]
    return 'ERR_EXCEEDS'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['within MPM', {'tpm': [1200, 801], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1107], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 251, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1210], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5256], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [2492, 2156], 'tpd': 0, 'mpm': 4150}, ['15M', 15]], ['sampled case 2', {'tpm': [3592, 2721], 'tpd': 0, 'mpm': 5598}, ['15M', 15]], ['sampled case 3', {'tpm': [402, 360], 'tpd': 73, 'mpm': 652}, ['10M', 10]], ['regression: surcharge band list', {'tpm': [2090, 1881], 'tpd': 0, 'mpm': 3225}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 802], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1108], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 252, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1220], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5257], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [4525, 5148], 'tpd': 0, 'mpm': 7940}, ['25M', 25]], ['sampled case 2', {'tpm': [3880, 3908], 'tpd': 293, 'mpm': 7743}, ['M', 0]], ['sampled case 3', {'tpm': [3404, 3171], 'tpd': 0, 'mpm': 5451}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 803], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1109], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 253, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1230], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5258], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [2696, 2449], 'tpd': 42, 'mpm': 4715}, ['10M', 10]], ['sampled case 2', {'tpm': [193], 'tpd': 0, 'mpm': 8525}, ['M', 0]], ['sampled case 3', {'tpm': [1557, 1285], 'tpd': 0, 'mpm': 2456}, ['20M', 20]], ['regression: surcharge band list', {'tpm': [4198, 4524], 'tpd': 0, 'mpm': 6997}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 804], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1110], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 254, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1240], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5259], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [1579, 2622], 'tpd': 0, 'mpm': 1172}, 'ERR_EXCEEDS'], ['sampled case 2', {'tpm': [3163, 3734], 'tpd': 278, 'mpm': 3722}, 'ERR_EXCEEDS'], ['sampled case 3', {'tpm': [607], 'tpd': 0, 'mpm': 5975}, ['M', 0]], ['regression: surcharge band list', {'tpm': [4543, 4625], 'tpd': 0, 'mpm': 7467}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 805], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1111], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 255, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1250], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5260], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [1024], 'tpd': 298, 'mpm': 6290}, ['M', 0]], ['sampled case 2', {'tpm': [1754, 1180], 'tpd': 0, 'mpm': 872}, 'ERR_EXCEEDS'], ['sampled case 3', {'tpm': [3753, 4785], 'tpd': 130, 'mpm': 7546}, ['15M', 15]], ['regression: surcharge band list', {'tpm': [3646, 3806], 'tpd': 0, 'mpm': 6071}, ['25M', 25]]]]
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
within MPM['M', 0]['M', 0]Passed
exactly MPM['M', 0]['M', 0]Passed
exactly 5 percent over['5M', 5]['5M', 5]Passed
just over 5 percent['10M', 10]['10M', 10]Passed
deduction brings within['M', 0]['M', 0]Passed
beyond 25 percentERR_EXCEEDSERR_EXCEEDSPassed
ratio rounds down to band['10M', 10]['10M', 10]Passed
sampled case 1['15M', 15]['15M', 15]Passed
sampled case 2['15M', 15]['15M', 15]Passed
sampled case 3['10M', 10]['10M', 10]Passed
regression: surcharge band listERR_EXCEEDS['25M', 25]Failed

SHA-256 / ba5843b1c451e56b33271756cffdedff5e9d47a76532567aa35749aeaddebe2d

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    total = sum(x['tpm']) - x['tpd']
    mpm = x['mpm']
    if total * 100 <= mpm * 100: return ['M', 0]
    for pct in (5, 10, 15, 20, 25):
        if total * 100 <= mpm * (100 + pct):
            return ['%dM' % pct, pct]
    return 'ERR_EXCEEDS'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['within MPM', {'tpm': [1200, 801], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1107], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 251, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1210], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5256], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [2492, 2156], 'tpd': 0, 'mpm': 4150}, ['15M', 15]], ['sampled case 2', {'tpm': [3592, 2721], 'tpd': 0, 'mpm': 5598}, ['15M', 15]], ['sampled case 3', {'tpm': [402, 360], 'tpd': 73, 'mpm': 652}, ['10M', 10]], ['regression: surcharge band list', {'tpm': [2090, 1881], 'tpd': 0, 'mpm': 3225}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 802], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1108], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 252, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1220], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5257], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [4525, 5148], 'tpd': 0, 'mpm': 7940}, ['25M', 25]], ['sampled case 2', {'tpm': [3880, 3908], 'tpd': 293, 'mpm': 7743}, ['M', 0]], ['sampled case 3', {'tpm': [3404, 3171], 'tpd': 0, 'mpm': 5451}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 803], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1109], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 253, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1230], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5258], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [2696, 2449], 'tpd': 42, 'mpm': 4715}, ['10M', 10]], ['sampled case 2', {'tpm': [193], 'tpd': 0, 'mpm': 8525}, ['M', 0]], ['sampled case 3', {'tpm': [1557, 1285], 'tpd': 0, 'mpm': 2456}, ['20M', 20]], ['regression: surcharge band list', {'tpm': [4198, 4524], 'tpd': 0, 'mpm': 6997}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 804], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1110], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 254, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1240], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5259], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [1579, 2622], 'tpd': 0, 'mpm': 1172}, 'ERR_EXCEEDS'], ['sampled case 2', {'tpm': [3163, 3734], 'tpd': 278, 'mpm': 3722}, 'ERR_EXCEEDS'], ['sampled case 3', {'tpm': [607], 'tpd': 0, 'mpm': 5975}, ['M', 0]], ['regression: surcharge band list', {'tpm': [4543, 4625], 'tpd': 0, 'mpm': 7467}, ['25M', 25]]], [['within MPM', {'tpm': [1200, 805], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly MPM', {'tpm': [1000, 1100], 'tpd': 0, 'mpm': 2100}, ['M', 0]], ['exactly 5 percent over', {'tpm': [1100, 1105], 'tpd': 0, 'mpm': 2100}, ['5M', 5]], ['just over 5 percent', {'tpm': [1100, 1111], 'tpd': 0, 'mpm': 2100}, ['10M', 10]], ['deduction brings within', {'tpm': [1500, 900], 'tpd': 255, 'mpm': 2200}, ['M', 0]], ['beyond 25 percent', {'tpm': [2000, 1250], 'tpd': 0, 'mpm': 2500}, 'ERR_EXCEEDS'], ['ratio rounds down to band', {'tpm': [5260], 'tpd': 0, 'mpm': 5000}, ['10M', 10]], ['sampled case 1', {'tpm': [1024], 'tpd': 298, 'mpm': 6290}, ['M', 0]], ['sampled case 2', {'tpm': [1754, 1180], 'tpd': 0, 'mpm': 872}, 'ERR_EXCEEDS'], ['sampled case 3', {'tpm': [3753, 4785], 'tpd': 130, 'mpm': 7546}, ['15M', 15]], ['regression: surcharge band list', {'tpm': [3646, 3806], 'tpd': 0, 'mpm': 6071}, ['25M', 25]]]]
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
within MPM['M', 0]['M', 0]Passed
exactly MPM['M', 0]['M', 0]Passed
exactly 5 percent over['5M', 5]['5M', 5]Passed
just over 5 percent['10M', 10]['10M', 10]Passed
deduction brings within['M', 0]['M', 0]Passed
beyond 25 percentERR_EXCEEDSERR_EXCEEDSPassed
ratio rounds down to band['10M', 10]['10M', 10]Passed
sampled case 1['15M', 15]['15M', 15]Passed
sampled case 2['15M', 15]['15M', 15]Passed
sampled case 3['10M', 10]['10M', 10]Passed
regression: surcharge band list['25M', 25]['25M', 25]Passed

SHA-256 / e48d70b31742f463530a51f58005b3935492289749f7edf65d1d623677fcaad9

Verification & scope

A stipulated toy fare-rule contract with invented constants; it is not an ATPCO or carrier tariff implementation and makes no claim of industry-standard conformance. 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:47:44.582883+00:00.

Case digest / 843ca4a915127393bd1bc8e6a3045e771dbc50f1806b228e0357e987fc26ed03