FAILURE MAP
← Case archive

FA-66786 / Airline fare rule evaluation / Open access

Lowercase carrier codes never match · case 01

Segments entered as "ba" are rejected although BA flights are in range.

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

ROOT CAUSE

Carrier codes are compared without case normalisation.

VERIFIED REPAIR

Uppercase carrier codes before matching.

Unsuccessful approach: Trimming whitespace does not normalise case.

Case contract

Input {'segments':[[carrier, flight number string]],'ranges':[[carrier, lo, hi]],'except':[[carrier, flight]]}. Flight numbers are numeric strings that may carry leading zeros; carriers are case-insensitive (tables are uppercase). A segment qualifies if some inclusive range covers it numerically and it is not an exception; exceptions always win. Return one boolean per segment.

Why this case matters

Fare rules restrict validity to flight number ranges with exceptions; flight numbers are identifiers encoded as zero-padded digits.

1 / The failure

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

N = 1
observations = []
def solve(x):
    out = []
    for carrier, fno in x['segments']:
        c = carrier
        n = int(fno)
        ok = any(c == rc and int(lo) <= n <= int(hi) for rc, lo, hi in x['ranges'])
        if any(c == ec and n == int(ef) for ec, ef in x['except']):
            ok = False
        out.append(ok)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '151']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2401']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2100'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '11']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['UA', '0500'], ['ba', '500'], ['BA', '2999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False]], ['sampled case 2', {'segments': [['BA', '1000'], ['UA', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 3', {'segments': [['BA', '2000'], ['BA', '500'], ['AA', '2000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '152']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2402']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2200'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '12']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['aa', '451'], ['BA', '1873'], ['aa', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, False, False]], ['sampled case 2', {'segments': [['BA', '2400'], ['ba', '0999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 3', {'segments': [['ba', '1000'], ['UA', '500'], ['aa', '0451'], ['ba', '2000'], ['ba', '999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, True, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '153']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2403']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2300'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '13']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['UA', '2000'], ['AA', '500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 2', {'segments': [['AA', '2999'], ['AA', '450'], ['aa', '100'], ['LH', '2000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True, True]], ['sampled case 3', {'segments': [['BA', '2400'], ['UA', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '154']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2404']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2400'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, False, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '14']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['ba', '2000'], ['UA', '0450'], ['ba', '1000'], ['AA', '100'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True, False]], ['sampled case 2', {'segments': [['LH', '0451'], ['aa', '1543'], ['BA', '999'], ['aa', '1000'], ['LH', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False, False]], ['sampled case 3', {'segments': [['UA', '450'], ['BA', '2999'], ['LH', '099'], ['LH', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '155']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2405']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2500'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '15']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['BA', '0655'], ['BA', '2000'], ['UA', '1000'], ['AA', '1386']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False]], ['sampled case 2', {'segments': [['AA', '0999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True]], ['sampled case 3', {'segments': [['UA', '500'], ['AA', '451'], ['BA', '999'], ['ba', '100']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, False, True]]]]
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
three-digit versus two-digit[False, True, True][False, True, True]Passed
leading zeros[True, True, True, False][True, True, True, False]Passed
excepted flight inside range[False, False, False, True][False, False, False, True]Passed
lowercase carrier[False, False, False][True, True, True]Failed
range end points[True, True, True, False][True, True, True, False]Passed
exception for uncovered carrier[False, False][False, False]Passed
sampled case 1[False, False, False][False, False, False]Passed
sampled case 2[False, False][False, False]Passed
sampled case 3[False, False, False][False, False, False]Passed

SHA-256 / fea7863bdaa7c271997c42e3aaffa1ca6bdb24cc61f7e53da48037680faee407

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    out = []
    for carrier, fno in x['segments']:
        c = carrier.strip()
        n = int(fno)
        ok = any(c == rc and int(lo) <= n <= int(hi) for rc, lo, hi in x['ranges'])
        if any(c == ec and n == int(ef) for ec, ef in x['except']):
            ok = False
        out.append(ok)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '151']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2401']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2100'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '11']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['UA', '0500'], ['ba', '500'], ['BA', '2999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False]], ['sampled case 2', {'segments': [['BA', '1000'], ['UA', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 3', {'segments': [['BA', '2000'], ['BA', '500'], ['AA', '2000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '152']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2402']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2200'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '12']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['aa', '451'], ['BA', '1873'], ['aa', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, False, False]], ['sampled case 2', {'segments': [['BA', '2400'], ['ba', '0999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 3', {'segments': [['ba', '1000'], ['UA', '500'], ['aa', '0451'], ['ba', '2000'], ['ba', '999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, True, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '153']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2403']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2300'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '13']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['UA', '2000'], ['AA', '500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 2', {'segments': [['AA', '2999'], ['AA', '450'], ['aa', '100'], ['LH', '2000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True, True]], ['sampled case 3', {'segments': [['BA', '2400'], ['UA', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '154']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2404']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2400'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, False, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '14']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['ba', '2000'], ['UA', '0450'], ['ba', '1000'], ['AA', '100'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True, False]], ['sampled case 2', {'segments': [['LH', '0451'], ['aa', '1543'], ['BA', '999'], ['aa', '1000'], ['LH', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False, False]], ['sampled case 3', {'segments': [['UA', '450'], ['BA', '2999'], ['LH', '099'], ['LH', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '155']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2405']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2500'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '15']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['BA', '0655'], ['BA', '2000'], ['UA', '1000'], ['AA', '1386']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False]], ['sampled case 2', {'segments': [['AA', '0999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True]], ['sampled case 3', {'segments': [['UA', '500'], ['AA', '451'], ['BA', '999'], ['ba', '100']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, False, True]]]]
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
three-digit versus two-digit[False, True, True][False, True, True]Passed
leading zeros[True, True, True, False][True, True, True, False]Passed
excepted flight inside range[False, False, False, True][False, False, False, True]Passed
lowercase carrier[False, False, False][True, True, True]Failed
range end points[True, True, True, False][True, True, True, False]Passed
exception for uncovered carrier[False, False][False, False]Passed
sampled case 1[False, False, False][False, False, False]Passed
sampled case 2[False, False][False, False]Passed
sampled case 3[False, False, False][False, False, False]Passed

SHA-256 / 61d50214bc592a792c1d99f7336fc8fe04971f931266f6f228543d97975d6072

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    out = []
    for carrier, fno in x['segments']:
        c = carrier.upper()
        n = int(fno)
        ok = any(c == rc and int(lo) <= n <= int(hi) for rc, lo, hi in x['ranges'])
        if any(c == ec and n == int(ef) for ec, ef in x['except']):
            ok = False
        out.append(ok)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '151']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2401']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2100'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '11']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['UA', '0500'], ['ba', '500'], ['BA', '2999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False]], ['sampled case 2', {'segments': [['BA', '1000'], ['UA', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 3', {'segments': [['BA', '2000'], ['BA', '500'], ['AA', '2000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '152']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2402']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2200'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '12']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['aa', '451'], ['BA', '1873'], ['aa', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, False, False]], ['sampled case 2', {'segments': [['BA', '2400'], ['ba', '0999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 3', {'segments': [['ba', '1000'], ['UA', '500'], ['aa', '0451'], ['ba', '2000'], ['ba', '999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, True, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '153']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2403']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2300'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '13']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['UA', '2000'], ['AA', '500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 2', {'segments': [['AA', '2999'], ['AA', '450'], ['aa', '100'], ['LH', '2000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True, True]], ['sampled case 3', {'segments': [['BA', '2400'], ['UA', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '154']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2404']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2400'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, False, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '14']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['ba', '2000'], ['UA', '0450'], ['ba', '1000'], ['AA', '100'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True, False]], ['sampled case 2', {'segments': [['LH', '0451'], ['aa', '1543'], ['BA', '999'], ['aa', '1000'], ['LH', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False, False]], ['sampled case 3', {'segments': [['UA', '450'], ['BA', '2999'], ['LH', '099'], ['LH', '0500']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False]]], [['three-digit versus two-digit', {'segments': [['AA', '99'], ['AA', '100'], ['AA', '155']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, True]], ['leading zeros', {'segments': [['BA', '0045'], ['BA', '45'], ['BA', '0450'], ['BA', '451']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['excepted flight inside range', {'segments': [['AA', '500'], ['AA', '0500'], ['LH', '2400'], ['LH', '2405']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, True]], ['lowercase carrier', {'segments': [['ba', '120'], ['lh', '2500'], ['Aa', '101']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True]], ['range end points', {'segments': [['LH', '2000'], ['LH', '2999'], ['AA', '999'], ['AA', '1000']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True, True, True, False]], ['exception for uncovered carrier', {'segments': [['LH', '2400'], ['UA', '15']], 'ranges': [['AA', '1', '9999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False]], ['sampled case 1', {'segments': [['BA', '0655'], ['BA', '2000'], ['UA', '1000'], ['AA', '1386']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, False, False, False]], ['sampled case 2', {'segments': [['AA', '0999']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [True]], ['sampled case 3', {'segments': [['UA', '500'], ['AA', '451'], ['BA', '999'], ['ba', '100']], 'ranges': [['AA', '100', '999'], ['BA', '0001', '0450'], ['LH', '2000', '2999']], 'except': [['AA', '0500'], ['LH', '2400']]}, [False, True, False, True]]]]
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
three-digit versus two-digit[False, True, True][False, True, True]Passed
leading zeros[True, True, True, False][True, True, True, False]Passed
excepted flight inside range[False, False, False, True][False, False, False, True]Passed
lowercase carrier[True, True, True][True, True, True]Passed
range end points[True, True, True, False][True, True, True, False]Passed
exception for uncovered carrier[False, False][False, False]Passed
sampled case 1[False, False, False][False, False, False]Passed
sampled case 2[False, False][False, False]Passed
sampled case 3[False, False, False][False, False, False]Passed

SHA-256 / 74ae8d1ba28a412bbf915b300a05f47c819d3bf26051a11f4cbf6b1992591897

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

Case digest / b7c85e3923a00dbe9d63ee6048bcf83b44fc879c73840ac0623b4e4e3bc7d990