FAILURE MAP
← Case archive

FA-66806 / Airline fare rule evaluation / Open access

Bags within the free allowance escape the 32 kg maximum · case 01

A 33 kg first bag on a fare with one free piece is accepted and priced.

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

ROOT CAUSE

The acceptance limit is only enforced for bags beyond the free allowance.

VERIFIED REPAIR

Refuse any bag over 32 kg regardless of whether it is free.

Unsuccessful approach: Exempting elite travellers from the acceptance limit still accepts unliftable bags.

Case contract

Input {'bags':[kg in check-in order],'allowance','elite'}. Any bag over 32 kg -> 'ERR_OVERWEIGHT_<i>' (first, zero-based). Free bags = allowance + 1 if elite, applied to the first bags. Base fee by overall bag position: 1st 30, 2nd 40, 3rd and later 150 (only for bags beyond the free count). Each bag over 23 kg adds 100, free or not. Return total.

Why this case matters

Baggage rules in fare families combine piece allowances, status benefits, position-based piece charges and weight surcharges.

1 / The failure

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

N = 1
observations = []
def solve(x):
    free = x['allowance'] + (1 if x['elite'] else 0)
    for i, kg in enumerate(x['bags']):
        if kg > 32 and i >= free: return 'ERR_OVERWEIGHT_%d' % i
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
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
basic fare three bags220220Passed
one free bag two paid190190Passed
elite extra bag300300Passed
heavy free bag140140Passed
exactly hard limit270270Passed
over hard limit100ERR_OVERWEIGHT_1Failed
elite with two allowance150150Passed
sampled case 1270270Passed
sampled case 200Passed
sampled case 3400400Passed

SHA-256 / 81923aff5c2d73348be0cb6175e3b82daebcdba2a93daa3bfc0c3e0f8c56275b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    for i, kg in enumerate(x['bags']):
        if kg > 32 and not x['elite']: return 'ERR_OVERWEIGHT_%d' % i
    free = x['allowance'] + (1 if x['elite'] else 0)
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
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
basic fare three bags220220Passed
one free bag two paid190190Passed
elite extra bag300300Passed
heavy free bag140140Passed
exactly hard limit270270Passed
over hard limit100ERR_OVERWEIGHT_1Failed
elite with two allowance150150Passed
sampled case 1270270Passed
sampled case 200Passed
sampled case 3400400Passed

SHA-256 / f8207f68e61a4369617e1c7e24b03756e827f8f3575100f685e2922b5c6759c6

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    for i, kg in enumerate(x['bags']):
        if kg > 32: return 'ERR_OVERWEIGHT_%d' % i
    free = x['allowance'] + (1 if x['elite'] else 0)
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
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
basic fare three bags220220Passed
one free bag two paid190190Passed
elite extra bag300300Passed
heavy free bag140140Passed
exactly hard limit270270Passed
over hard limitERR_OVERWEIGHT_1ERR_OVERWEIGHT_1Passed
elite with two allowance150150Passed
sampled case 1270270Passed
sampled case 200Passed
sampled case 3400400Passed

SHA-256 / 7b029ecc83ee8ed6d85bdbd34c5a87dd8bb519b8bd5c19a826ccde10937c9fbf

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

Case digest / 2f9593f778e0c70c384350c0f417ff9a034f2bd820e6525c1c3d80c5e0a103c2