FAILURE MAP
← Case archive

FA-66506 / Airline fare rule evaluation / Open access

Routing exactly on a band limit pushed to the next band · case 01

A routing exactly 5% over MPM is charged a 10M surcharge.

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

ROOT CAUSE

The band test excludes its upper limit.

VERIFIED REPAIR

Include the band limit in the band.

Unsuccessful approach: Rounding the allowance to the nearest mile admits routings up to half a mile over the band limit.

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 (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 boundary', {'tpm': [407, 466], 'tpd': 0, 'mpm': 831}, ['10M', 10]]], [['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]], ['regression: surcharge band boundary', {'tpm': [536, 627], 'tpd': 0, 'mpm': 1011}, ['20M', 20]]], [['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 boundary', {'tpm': [1618, 1377], 'tpd': 0, 'mpm': 2604}, ['20M', 20]]], [['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 boundary', {'tpm': [1913, 2101], 'tpd': 0, 'mpm': 3649}, ['15M', 15]]], [['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 boundary', {'tpm': [839, 957], 'tpd': 0, 'mpm': 1710}, ['10M', 10]]]]
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 boundary['10M', 10]['10M', 10]Passed

SHA-256 / 2bb278515683bf64e30003dbbcc6589ce7792872a6a8d1f77212b8661066f0fa

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 (5, 10, 15, 20, 25):
        if total <= round(mpm * (1 + pct / 100)):
            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 boundary', {'tpm': [407, 466], 'tpd': 0, 'mpm': 831}, ['10M', 10]]], [['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]], ['regression: surcharge band boundary', {'tpm': [536, 627], 'tpd': 0, 'mpm': 1011}, ['20M', 20]]], [['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 boundary', {'tpm': [1618, 1377], 'tpd': 0, 'mpm': 2604}, ['20M', 20]]], [['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 boundary', {'tpm': [1913, 2101], 'tpd': 0, 'mpm': 3649}, ['15M', 15]]], [['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 boundary', {'tpm': [839, 957], 'tpd': 0, 'mpm': 1710}, ['10M', 10]]]]
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 boundary['5M', 5]['10M', 10]Failed

SHA-256 / d8b80b0ebafa73bb4ebdfc383191ee57ef2cb24f88976345c5c1562cc190e2c5

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 boundary', {'tpm': [407, 466], 'tpd': 0, 'mpm': 831}, ['10M', 10]]], [['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]], ['regression: surcharge band boundary', {'tpm': [536, 627], 'tpd': 0, 'mpm': 1011}, ['20M', 20]]], [['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 boundary', {'tpm': [1618, 1377], 'tpd': 0, 'mpm': 2604}, ['20M', 20]]], [['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 boundary', {'tpm': [1913, 2101], 'tpd': 0, 'mpm': 3649}, ['15M', 15]]], [['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 boundary', {'tpm': [839, 957], 'tpd': 0, 'mpm': 1710}, ['10M', 10]]]]
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 boundary['10M', 10]['10M', 10]Passed

SHA-256 / f3e9c99b3c792d651060740c9053a781acc335083e12cd4a8b4f447b060ede95

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.336238+00:00.

Case digest / 6317a3da6b84a58300422b3a7a0f1b1849025bb65c08b7918084df2bc7e4b953