FAILURE MAP
← Case archive

FA-66781 / Airline fare rule evaluation / Open access

Excepted flights inside a range still qualify · case 01

Flight AA500 is sold on a fare that explicitly excludes it.

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

ROOT CAUSE

The exception is only consulted when no range matched, so it can never remove a match.

THE FAILURE

The exception is only consulted when no range matched, so it can never remove a match.

Unsuccessful approach: Toggling with an exclusive-or makes an excepted flight qualify when no range covers it.

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.upper()
        n = int(fno)
        ok = any(c == rc and int(lo) <= n <= int(hi) for rc, lo, hi in x['ranges'])
        if not ok and 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[True, True, True, True][False, False, False, True]Failed
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 / dfa3bbb91cd845da1287c31a74eb0887e5e49adc150aa652e9f4082c5457c234

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.upper()
        n = int(fno)
        ok = any(c == rc and int(lo) <= n <= int(hi) for rc, lo, hi in x['ranges'])
        ok = ok != any(c == ec and n == int(ef) for ec, ef in x['except'])
        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[True, False][False, False]Failed
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 / db938fff8008dd7f9ba10d505a485f5789d401724fac710036919c30079f0326

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 6e7e1e1744456f621c76c5b703fb8af8c5c7c0bf40a9603aa748430df1238da4