FAILURE MAP
← Case archive

FA-66436 / Airline fare rule evaluation / Open access

One-day blackout entries ignored · case 01

Travel on a single blacked-out holiday is sold.

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

ROOT CAUSE

Entries with only one date are skipped as malformed ranges.

VERIFIED REPAIR

Treat a single-date entry as a range starting and ending on that date.

Unsuccessful approach: Extending single dates to the following day also blacks out an extra day.

Case contract

Input {'outbound','inbound' (ISO date or None),'blackouts':[[start, end] or [single date]]}. Blackouts apply only to each direction's departure date (inclusive ranges), not to days in between. Return the list of blocked directions in order 'OUT','IN', each at most once.

Why this case matters

Blackout rules restrict travel dates per direction; staying through a blackout period is permitted.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    out = []
    for tag, ds in (('OUT', x['outbound']), ('IN', x['inbound'])):
        if ds is None: continue
        d = datetime.date.fromisoformat(ds)
        for rng in x['blackouts']:
            a = datetime.date.fromisoformat(rng[0])
            if len(rng) < 2: continue
            b = datetime.date.fromisoformat(rng[1])
            if a <= d <= b:
                out.append(tag)
                break
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trip spans a blackout', {'outbound': '2027-12-11', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-09', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-02', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-01', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-21', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-04-27', 'inbound': '2027-05-20', 'blackouts': [['2028-11-06']]}, []], ['sampled case 2', {'outbound': '2028-09-02', 'inbound': '2028-09-14', 'blackouts': [['2027-02-28', '2027-03-11'], ['2028-04-27'], ['2027-05-07', '2027-05-14']]}, []], ['sampled case 3', {'outbound': '2027-06-30', 'inbound': '2027-07-31', 'blackouts': [['2028-07-23'], ['2028-02-18', '2028-02-24'], ['2028-02-06', '2028-02-10'], ['2028-04-11', '2028-04-21']]}, []], ['regression: single-date blackout entries', {'outbound': '2027-02-06', 'inbound': '2027-02-25', 'blackouts': [['2027-02-24'], ['2028-12-22', '2028-12-23'], ['2028-06-07', '2028-06-15']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-12', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-10', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-03', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-02', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-22', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-12-03', 'inbound': '2027-12-13', 'blackouts': [['2027-05-07', '2027-05-15'], ['2027-11-09', '2027-11-20'], ['2027-02-15', '2027-02-26'], ['2027-05-24', '2027-05-31']]}, []], ['sampled case 2', {'outbound': '2027-12-20', 'inbound': '2028-01-12', 'blackouts': [['2028-11-01', '2028-11-09'], ['2028-12-29', '2029-01-07']]}, []], ['sampled case 3', {'outbound': '2027-06-18', 'inbound': '2027-07-26', 'blackouts': [['2028-10-29', '2028-11-08']]}, []], ['regression: single-date blackout entries', {'outbound': '2027-06-17', 'inbound': '2027-07-01', 'blackouts': [['2027-06-30'], ['2028-09-16', '2028-09-25'], ['2027-03-26', '2027-04-02'], ['2027-09-22', '2027-09-25']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-13', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-11', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-04', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-03', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-23', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-01-26', 'inbound': None, 'blackouts': [['2028-12-08', '2028-12-08'], ['2027-08-12'], ['2028-08-20', '2028-08-23']]}, []], ['sampled case 2', {'outbound': '2028-07-28', 'inbound': '2028-09-03', 'blackouts': [['2027-08-10', '2027-08-11'], ['2027-02-12'], ['2027-03-22', '2027-03-30'], ['2028-01-03', '2028-01-03']]}, []], ['sampled case 3', {'outbound': '2028-05-10', 'inbound': '2028-05-17', 'blackouts': [['2027-03-25', '2027-03-26']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-04-01', 'inbound': '2028-04-14', 'blackouts': [['2028-04-13'], ['2027-11-24', '2027-11-24']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-14', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-12', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-05', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-04', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-24', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2028-05-25', 'inbound': '2028-06-06', 'blackouts': [['2028-05-14'], ['2028-11-03', '2028-11-14']]}, []], ['sampled case 2', {'outbound': '2027-05-21', 'inbound': None, 'blackouts': [['2028-07-14', '2028-07-14']]}, []], ['sampled case 3', {'outbound': '2028-11-12', 'inbound': '2028-12-09', 'blackouts': [['2028-09-06', '2028-09-09']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-03-23', 'inbound': '2028-04-09', 'blackouts': [['2027-11-28', '2027-12-08'], ['2027-10-28', '2027-11-03'], ['2028-04-08'], ['2028-03-15', '2028-03-24']]}, ['OUT']]], [['trip spans a blackout', {'outbound': '2027-12-15', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-13', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-06', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-05', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-25', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-04-06', 'inbound': None, 'blackouts': [['2027-05-03', '2027-05-11'], ['2027-09-16', '2027-09-16']]}, []], ['sampled case 2', {'outbound': '2028-09-10', 'inbound': None, 'blackouts': [['2027-05-03', '2027-05-05'], ['2027-05-06']]}, []], ['sampled case 3', {'outbound': '2027-01-31', 'inbound': '2027-02-06', 'blackouts': [['2028-04-06', '2028-04-16'], ['2028-06-24', '2028-06-27']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-04-18', 'inbound': '2028-04-23', 'blackouts': [['2028-04-22']]}, []]]]
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
trip spans a blackout[][]Passed
outbound on end date['OUT']['OUT']Passed
single-day blackout[]['IN']Failed
inbound in second range['IN']['IN']Passed
both directions blocked['OUT', 'IN']['OUT', 'IN']Passed
clear trip[][]Passed
start day of range['OUT']['OUT']Passed
sampled case 1[][]Passed
sampled case 2[][]Passed
sampled case 3[][]Passed
regression: single-date blackout entries[][]Passed

SHA-256 / d4cd76494e3bc01d33c3a5ca1ae8c375a9a298e9f90042110f8907ccb8efd437

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    out = []
    for tag, ds in (('OUT', x['outbound']), ('IN', x['inbound'])):
        if ds is None: continue
        d = datetime.date.fromisoformat(ds)
        for rng in x['blackouts']:
            a = datetime.date.fromisoformat(rng[0])
            b = a + datetime.timedelta(days=1) if len(rng) == 1 else datetime.date.fromisoformat(rng[1])
            if a <= d <= b:
                out.append(tag)
                break
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trip spans a blackout', {'outbound': '2027-12-11', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-09', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-02', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-01', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-21', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-04-27', 'inbound': '2027-05-20', 'blackouts': [['2028-11-06']]}, []], ['sampled case 2', {'outbound': '2028-09-02', 'inbound': '2028-09-14', 'blackouts': [['2027-02-28', '2027-03-11'], ['2028-04-27'], ['2027-05-07', '2027-05-14']]}, []], ['sampled case 3', {'outbound': '2027-06-30', 'inbound': '2027-07-31', 'blackouts': [['2028-07-23'], ['2028-02-18', '2028-02-24'], ['2028-02-06', '2028-02-10'], ['2028-04-11', '2028-04-21']]}, []], ['regression: single-date blackout entries', {'outbound': '2027-02-06', 'inbound': '2027-02-25', 'blackouts': [['2027-02-24'], ['2028-12-22', '2028-12-23'], ['2028-06-07', '2028-06-15']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-12', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-10', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-03', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-02', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-22', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-12-03', 'inbound': '2027-12-13', 'blackouts': [['2027-05-07', '2027-05-15'], ['2027-11-09', '2027-11-20'], ['2027-02-15', '2027-02-26'], ['2027-05-24', '2027-05-31']]}, []], ['sampled case 2', {'outbound': '2027-12-20', 'inbound': '2028-01-12', 'blackouts': [['2028-11-01', '2028-11-09'], ['2028-12-29', '2029-01-07']]}, []], ['sampled case 3', {'outbound': '2027-06-18', 'inbound': '2027-07-26', 'blackouts': [['2028-10-29', '2028-11-08']]}, []], ['regression: single-date blackout entries', {'outbound': '2027-06-17', 'inbound': '2027-07-01', 'blackouts': [['2027-06-30'], ['2028-09-16', '2028-09-25'], ['2027-03-26', '2027-04-02'], ['2027-09-22', '2027-09-25']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-13', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-11', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-04', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-03', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-23', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-01-26', 'inbound': None, 'blackouts': [['2028-12-08', '2028-12-08'], ['2027-08-12'], ['2028-08-20', '2028-08-23']]}, []], ['sampled case 2', {'outbound': '2028-07-28', 'inbound': '2028-09-03', 'blackouts': [['2027-08-10', '2027-08-11'], ['2027-02-12'], ['2027-03-22', '2027-03-30'], ['2028-01-03', '2028-01-03']]}, []], ['sampled case 3', {'outbound': '2028-05-10', 'inbound': '2028-05-17', 'blackouts': [['2027-03-25', '2027-03-26']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-04-01', 'inbound': '2028-04-14', 'blackouts': [['2028-04-13'], ['2027-11-24', '2027-11-24']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-14', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-12', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-05', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-04', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-24', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2028-05-25', 'inbound': '2028-06-06', 'blackouts': [['2028-05-14'], ['2028-11-03', '2028-11-14']]}, []], ['sampled case 2', {'outbound': '2027-05-21', 'inbound': None, 'blackouts': [['2028-07-14', '2028-07-14']]}, []], ['sampled case 3', {'outbound': '2028-11-12', 'inbound': '2028-12-09', 'blackouts': [['2028-09-06', '2028-09-09']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-03-23', 'inbound': '2028-04-09', 'blackouts': [['2027-11-28', '2027-12-08'], ['2027-10-28', '2027-11-03'], ['2028-04-08'], ['2028-03-15', '2028-03-24']]}, ['OUT']]], [['trip spans a blackout', {'outbound': '2027-12-15', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-13', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-06', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-05', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-25', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-04-06', 'inbound': None, 'blackouts': [['2027-05-03', '2027-05-11'], ['2027-09-16', '2027-09-16']]}, []], ['sampled case 2', {'outbound': '2028-09-10', 'inbound': None, 'blackouts': [['2027-05-03', '2027-05-05'], ['2027-05-06']]}, []], ['sampled case 3', {'outbound': '2027-01-31', 'inbound': '2027-02-06', 'blackouts': [['2028-04-06', '2028-04-16'], ['2028-06-24', '2028-06-27']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-04-18', 'inbound': '2028-04-23', 'blackouts': [['2028-04-22']]}, []]]]
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
trip spans a blackout[][]Passed
outbound on end date['OUT']['OUT']Passed
single-day blackout['IN']['IN']Passed
inbound in second range['IN']['IN']Passed
both directions blocked['OUT', 'IN']['OUT', 'IN']Passed
clear trip[][]Passed
start day of range['OUT']['OUT']Passed
sampled case 1[][]Passed
sampled case 2[][]Passed
sampled case 3[][]Passed
regression: single-date blackout entries['IN'][]Failed

SHA-256 / e58f189d6eb7f408928c1033c3d621313623d1da7abc66494653b82c101026b6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    out = []
    for tag, ds in (('OUT', x['outbound']), ('IN', x['inbound'])):
        if ds is None: continue
        d = datetime.date.fromisoformat(ds)
        for rng in x['blackouts']:
            a = datetime.date.fromisoformat(rng[0])
            b = datetime.date.fromisoformat(rng[-1])
            if a <= d <= b:
                out.append(tag)
                break
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trip spans a blackout', {'outbound': '2027-12-11', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-09', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-02', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-01', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-21', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-04-27', 'inbound': '2027-05-20', 'blackouts': [['2028-11-06']]}, []], ['sampled case 2', {'outbound': '2028-09-02', 'inbound': '2028-09-14', 'blackouts': [['2027-02-28', '2027-03-11'], ['2028-04-27'], ['2027-05-07', '2027-05-14']]}, []], ['sampled case 3', {'outbound': '2027-06-30', 'inbound': '2027-07-31', 'blackouts': [['2028-07-23'], ['2028-02-18', '2028-02-24'], ['2028-02-06', '2028-02-10'], ['2028-04-11', '2028-04-21']]}, []], ['regression: single-date blackout entries', {'outbound': '2027-02-06', 'inbound': '2027-02-25', 'blackouts': [['2027-02-24'], ['2028-12-22', '2028-12-23'], ['2028-06-07', '2028-06-15']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-12', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-10', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-03', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-02', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-22', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-12-03', 'inbound': '2027-12-13', 'blackouts': [['2027-05-07', '2027-05-15'], ['2027-11-09', '2027-11-20'], ['2027-02-15', '2027-02-26'], ['2027-05-24', '2027-05-31']]}, []], ['sampled case 2', {'outbound': '2027-12-20', 'inbound': '2028-01-12', 'blackouts': [['2028-11-01', '2028-11-09'], ['2028-12-29', '2029-01-07']]}, []], ['sampled case 3', {'outbound': '2027-06-18', 'inbound': '2027-07-26', 'blackouts': [['2028-10-29', '2028-11-08']]}, []], ['regression: single-date blackout entries', {'outbound': '2027-06-17', 'inbound': '2027-07-01', 'blackouts': [['2027-06-30'], ['2028-09-16', '2028-09-25'], ['2027-03-26', '2027-04-02'], ['2027-09-22', '2027-09-25']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-13', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-11', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-04', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-03', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-23', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-01-26', 'inbound': None, 'blackouts': [['2028-12-08', '2028-12-08'], ['2027-08-12'], ['2028-08-20', '2028-08-23']]}, []], ['sampled case 2', {'outbound': '2028-07-28', 'inbound': '2028-09-03', 'blackouts': [['2027-08-10', '2027-08-11'], ['2027-02-12'], ['2027-03-22', '2027-03-30'], ['2028-01-03', '2028-01-03']]}, []], ['sampled case 3', {'outbound': '2028-05-10', 'inbound': '2028-05-17', 'blackouts': [['2027-03-25', '2027-03-26']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-04-01', 'inbound': '2028-04-14', 'blackouts': [['2028-04-13'], ['2027-11-24', '2027-11-24']]}, []]], [['trip spans a blackout', {'outbound': '2027-12-14', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-12', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-05', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-04', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-24', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2028-05-25', 'inbound': '2028-06-06', 'blackouts': [['2028-05-14'], ['2028-11-03', '2028-11-14']]}, []], ['sampled case 2', {'outbound': '2027-05-21', 'inbound': None, 'blackouts': [['2028-07-14', '2028-07-14']]}, []], ['sampled case 3', {'outbound': '2028-11-12', 'inbound': '2028-12-09', 'blackouts': [['2028-09-06', '2028-09-09']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-03-23', 'inbound': '2028-04-09', 'blackouts': [['2027-11-28', '2027-12-08'], ['2027-10-28', '2027-11-03'], ['2028-04-08'], ['2028-03-15', '2028-03-24']]}, ['OUT']]], [['trip spans a blackout', {'outbound': '2027-12-15', 'inbound': '2028-01-05', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['outbound on end date', {'outbound': '2028-04-17', 'inbound': None, 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['single-day blackout', {'outbound': '2028-02-13', 'inbound': '2028-02-14', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['inbound in second range', {'outbound': '2027-12-06', 'inbound': '2027-12-30', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['IN']], ['both directions blocked', {'outbound': '2027-12-24', 'inbound': '2027-12-26', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT', 'IN']], ['clear trip', {'outbound': '2028-03-05', 'inbound': '2028-03-20', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, []], ['start day of range', {'outbound': '2028-04-10', 'inbound': '2028-04-25', 'blackouts': [['2027-12-20', '2027-12-27'], ['2027-12-24', '2028-01-02'], ['2028-02-14'], ['2028-04-10', '2028-04-17']]}, ['OUT']], ['sampled case 1', {'outbound': '2027-04-06', 'inbound': None, 'blackouts': [['2027-05-03', '2027-05-11'], ['2027-09-16', '2027-09-16']]}, []], ['sampled case 2', {'outbound': '2028-09-10', 'inbound': None, 'blackouts': [['2027-05-03', '2027-05-05'], ['2027-05-06']]}, []], ['sampled case 3', {'outbound': '2027-01-31', 'inbound': '2027-02-06', 'blackouts': [['2028-04-06', '2028-04-16'], ['2028-06-24', '2028-06-27']]}, []], ['regression: single-date blackout entries', {'outbound': '2028-04-18', 'inbound': '2028-04-23', 'blackouts': [['2028-04-22']]}, []]]]
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
trip spans a blackout[][]Passed
outbound on end date['OUT']['OUT']Passed
single-day blackout['IN']['IN']Passed
inbound in second range['IN']['IN']Passed
both directions blocked['OUT', 'IN']['OUT', 'IN']Passed
clear trip[][]Passed
start day of range['OUT']['OUT']Passed
sampled case 1[][]Passed
sampled case 2[][]Passed
sampled case 3[][]Passed
regression: single-date blackout entries[][]Passed

SHA-256 / 75f57b0d984fca7a2e341b6bf579f16a87d8bc60244ee25932a912475e3ed169

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

Case digest / 18ccbce028c1ccf571db0be209af21a3cee26fbb372b006cd46083b5dc8770d4