FAILURE MAP
← Case archive

FA-66416 / Airline fare rule evaluation / Open access

Weekday codes read with zero-based Monday · case 01

Weekend-only summer fares match Friday and Saturday instead of Saturday and Sunday.

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

ROOT CAUSE

The weekday digit comes from weekday() (Monday=0) instead of isoweekday() (Monday=1).

VERIFIED REPAIR

Use ISO weekday numbers 1..7.

Unsuccessful approach: strftime('%w') numbers Sunday as 0, so Sunday never matches digit 7.

Case contract

Input {'date','seasons':[[start 'M-D', end 'M-D' (unpadded allowed), weekdays string of ISO digits 1=Mon..7=Sun, code]]}. A season with start after end wraps the year end. Both ends inclusive. Return the code of the first season (list order) containing the date on an allowed weekday, else 'NONE'.

Why this case matters

Fare seasonality tables use month-day ranges that can wrap the year boundary and are further restricted by day of week.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date.fromisoformat(x['date'])
    md = (d.month, d.day)
    for start, end, dow, code in x['seasons']:
        s = tuple(int(p) for p in start.split('-'))
        e = tuple(int(p) for p in end.split('-'))
        inside = s <= md <= e if s <= e else (md >= s or md <= e)
        if inside and str(d.weekday()) in dow:
            return code
    return 'NONE'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['New Year inside wrap season', {'date': '2028-01-03', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-05', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-13', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-02-24', 'seasons': [['10-27', '3-18', '257', 'S0'], ['10-8', '11-12', '2346', 'S1'], ['3-2', '4-14', '23467', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2029-09-07', 'seasons': [['12-12', '5-9', '123456', 'S0'], ['12-8', '2-16', '1234567', 'S1'], ['6-10', '10-12', '12347', 'S2']]}, 'NONE'], ['sampled case 3', {'date': '2029-03-20', 'seasons': [['7-27', '9-9', '123567', 'S0'], ['10-31', '12-13', '1357', 'S1']]}, 'NONE']], [['New Year inside wrap season', {'date': '2028-01-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-11', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-06', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-14', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-05-03', 'seasons': [['5-4', '7-25', '13457', 'S0'], ['6-18', '9-12', '1234567', 'S1'], ['2-7', '6-1', '3', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2027-05-20', 'seasons': [['8-18', '2-4', '17', 'S0'], ['12-23', '12-28', '1267', 'S1']]}, 'NONE'], ['sampled case 3', {'date': '2028-01-27', 'seasons': [['2-5', '2-6', '136', 'S0'], ['11-22', '3-11', '23', 'S1'], ['10-29', '11-15', '67', 'S2'], ['4-23', '6-13', '1367', 'S3']]}, 'NONE']], [['New Year inside wrap season', {'date': '2028-01-05', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-18', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-07', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-15', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2028-09-07', 'seasons': [['12-12', '3-3', '15', 'S0'], ['4-5', '4-30', '6', 'S1'], ['12-10', '1-5', '136', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2027-08-20', 'seasons': [['10-3', '2-23', '137', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2029-01-15', 'seasons': [['1-2', '5-8', '16', 'S0'], ['1-19', '6-11', '1234567', 'S1'], ['10-17', '1-6', '2456', 'S2'], ['11-19', '1-26', '34567', 'S3']]}, 'S0']], [['New Year inside wrap season', {'date': '2028-01-06', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-25', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-08', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'NONE'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-16', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2028-03-30', 'seasons': [['1-26', '6-22', '4', 'S0'], ['5-16', '8-21', '123467', 'S1'], ['8-21', '11-24', '123467', 'S2'], ['2-13', '7-22', '1246', 'S3']]}, 'S0'], ['sampled case 2', {'date': '2029-03-23', 'seasons': [['9-11', '3-12', '1234', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2029-03-01', 'seasons': [['4-26', '5-25', '1234567', 'S0'], ['10-24', '12-15', '7', 'S1'], ['10-4', '3-14', '1246', 'S2']]}, 'S2']], [['New Year inside wrap season', {'date': '2028-01-07', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-09', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'NONE'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-17', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-04-07', 'seasons': [['12-9', '5-18', '123456', 'S0'], ['11-27', '12-4', '12457', 'S1']]}, 'S0'], ['sampled case 2', {'date': '2027-10-12', 'seasons': [['7-20', '1-2', '4', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2027-06-11', 'seasons': [['9-12', '2-18', '46', 'S0'], ['1-5', '7-14', '4', 'S1'], ['3-28', '6-4', '1234567', 'S2'], ['8-26', '9-24', '123567', 'S3']]}, 'NONE']]]
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
New Year inside wrap seasonNONEPEAKFailed
season end dayHIGH_WKHIGH_WKPassed
Sunday in summerHIGH_WEHIGH_WEPassed
autumn weekdaySHOULDERSHOULDERPassed
wrap end datePEAKPEAKPassed
overlapping seasons first winsNONEDECFailed
two-digit month compareFALLFALLPassed
sampled case 1S0NONEFailed
sampled case 2S2NONEFailed
sampled case 3NONENONEPassed

SHA-256 / 045ec25173bc4cb55ca79b6279f0d131f3001f84ca267f4d19aa9de800bda33a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date.fromisoformat(x['date'])
    md = (d.month, d.day)
    for start, end, dow, code in x['seasons']:
        s = tuple(int(p) for p in start.split('-'))
        e = tuple(int(p) for p in end.split('-'))
        inside = s <= md <= e if s <= e else (md >= s or md <= e)
        if inside and d.strftime('%w') in dow:
            return code
    return 'NONE'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['New Year inside wrap season', {'date': '2028-01-03', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-05', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-13', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-02-24', 'seasons': [['10-27', '3-18', '257', 'S0'], ['10-8', '11-12', '2346', 'S1'], ['3-2', '4-14', '23467', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2029-09-07', 'seasons': [['12-12', '5-9', '123456', 'S0'], ['12-8', '2-16', '1234567', 'S1'], ['6-10', '10-12', '12347', 'S2']]}, 'NONE'], ['sampled case 3', {'date': '2029-03-20', 'seasons': [['7-27', '9-9', '123567', 'S0'], ['10-31', '12-13', '1357', 'S1']]}, 'NONE']], [['New Year inside wrap season', {'date': '2028-01-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-11', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-06', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-14', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-05-03', 'seasons': [['5-4', '7-25', '13457', 'S0'], ['6-18', '9-12', '1234567', 'S1'], ['2-7', '6-1', '3', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2027-05-20', 'seasons': [['8-18', '2-4', '17', 'S0'], ['12-23', '12-28', '1267', 'S1']]}, 'NONE'], ['sampled case 3', {'date': '2028-01-27', 'seasons': [['2-5', '2-6', '136', 'S0'], ['11-22', '3-11', '23', 'S1'], ['10-29', '11-15', '67', 'S2'], ['4-23', '6-13', '1367', 'S3']]}, 'NONE']], [['New Year inside wrap season', {'date': '2028-01-05', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-18', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-07', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-15', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2028-09-07', 'seasons': [['12-12', '3-3', '15', 'S0'], ['4-5', '4-30', '6', 'S1'], ['12-10', '1-5', '136', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2027-08-20', 'seasons': [['10-3', '2-23', '137', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2029-01-15', 'seasons': [['1-2', '5-8', '16', 'S0'], ['1-19', '6-11', '1234567', 'S1'], ['10-17', '1-6', '2456', 'S2'], ['11-19', '1-26', '34567', 'S3']]}, 'S0']], [['New Year inside wrap season', {'date': '2028-01-06', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-25', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-08', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'NONE'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-16', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2028-03-30', 'seasons': [['1-26', '6-22', '4', 'S0'], ['5-16', '8-21', '123467', 'S1'], ['8-21', '11-24', '123467', 'S2'], ['2-13', '7-22', '1246', 'S3']]}, 'S0'], ['sampled case 2', {'date': '2029-03-23', 'seasons': [['9-11', '3-12', '1234', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2029-03-01', 'seasons': [['4-26', '5-25', '1234567', 'S0'], ['10-24', '12-15', '7', 'S1'], ['10-4', '3-14', '1246', 'S2']]}, 'S2']], [['New Year inside wrap season', {'date': '2028-01-07', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-09', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'NONE'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-17', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-04-07', 'seasons': [['12-9', '5-18', '123456', 'S0'], ['11-27', '12-4', '12457', 'S1']]}, 'S0'], ['sampled case 2', {'date': '2027-10-12', 'seasons': [['7-20', '1-2', '4', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2027-06-11', 'seasons': [['9-12', '2-18', '46', 'S0'], ['1-5', '7-14', '4', 'S1'], ['3-28', '6-4', '1234567', 'S2'], ['8-26', '9-24', '123567', 'S3']]}, 'NONE']]]
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
New Year inside wrap seasonPEAKPEAKPassed
season end dayHIGH_WKHIGH_WKPassed
Sunday in summerNONEHIGH_WEFailed
autumn weekdaySHOULDERSHOULDERPassed
wrap end datePEAKPEAKPassed
overlapping seasons first winsDECDECPassed
two-digit month compareFALLFALLPassed
sampled case 1NONENONEPassed
sampled case 2NONENONEPassed
sampled case 3NONENONEPassed

SHA-256 / c05af6f7009e4c6cac56618e3f6fa1a5409589dcccaa47c8a68506c26a968eeb

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date.fromisoformat(x['date'])
    md = (d.month, d.day)
    for start, end, dow, code in x['seasons']:
        s = tuple(int(p) for p in start.split('-'))
        e = tuple(int(p) for p in end.split('-'))
        inside = s <= md <= e if s <= e else (md >= s or md <= e)
        if inside and str(d.isoweekday()) in dow:
            return code
    return 'NONE'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['New Year inside wrap season', {'date': '2028-01-03', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-05', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-13', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-02-24', 'seasons': [['10-27', '3-18', '257', 'S0'], ['10-8', '11-12', '2346', 'S1'], ['3-2', '4-14', '23467', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2029-09-07', 'seasons': [['12-12', '5-9', '123456', 'S0'], ['12-8', '2-16', '1234567', 'S1'], ['6-10', '10-12', '12347', 'S2']]}, 'NONE'], ['sampled case 3', {'date': '2029-03-20', 'seasons': [['7-27', '9-9', '123567', 'S0'], ['10-31', '12-13', '1357', 'S1']]}, 'NONE']], [['New Year inside wrap season', {'date': '2028-01-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-11', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-06', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-14', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-05-03', 'seasons': [['5-4', '7-25', '13457', 'S0'], ['6-18', '9-12', '1234567', 'S1'], ['2-7', '6-1', '3', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2027-05-20', 'seasons': [['8-18', '2-4', '17', 'S0'], ['12-23', '12-28', '1267', 'S1']]}, 'NONE'], ['sampled case 3', {'date': '2028-01-27', 'seasons': [['2-5', '2-6', '136', 'S0'], ['11-22', '3-11', '23', 'S1'], ['10-29', '11-15', '67', 'S2'], ['4-23', '6-13', '1367', 'S3']]}, 'NONE']], [['New Year inside wrap season', {'date': '2028-01-05', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-18', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-07', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'SHOULDER'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-15', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2028-09-07', 'seasons': [['12-12', '3-3', '15', 'S0'], ['4-5', '4-30', '6', 'S1'], ['12-10', '1-5', '136', 'S2']]}, 'NONE'], ['sampled case 2', {'date': '2027-08-20', 'seasons': [['10-3', '2-23', '137', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2029-01-15', 'seasons': [['1-2', '5-8', '16', 'S0'], ['1-19', '6-11', '1234567', 'S1'], ['10-17', '1-6', '2456', 'S2'], ['11-19', '1-26', '34567', 'S3']]}, 'S0']], [['New Year inside wrap season', {'date': '2028-01-06', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-25', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-08', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'NONE'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-16', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2028-03-30', 'seasons': [['1-26', '6-22', '4', 'S0'], ['5-16', '8-21', '123467', 'S1'], ['8-21', '11-24', '123467', 'S2'], ['2-13', '7-22', '1246', 'S3']]}, 'S0'], ['sampled case 2', {'date': '2029-03-23', 'seasons': [['9-11', '3-12', '1234', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2029-03-01', 'seasons': [['4-26', '5-25', '1234567', 'S0'], ['10-24', '12-15', '7', 'S1'], ['10-4', '3-14', '1246', 'S2']]}, 'S2']], [['New Year inside wrap season', {'date': '2028-01-07', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['season end day', {'date': '2027-08-31', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WK'], ['Sunday in summer', {'date': '2027-07-04', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'HIGH_WE'], ['autumn weekday', {'date': '2027-10-09', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'NONE'], ['wrap end date', {'date': '2029-01-10', 'seasons': [['12-15', '1-10', '1234567', 'PEAK'], ['6-1', '8-31', '12345', 'HIGH_WK'], ['6-1', '8-31', '67', 'HIGH_WE'], ['1-11', '5-31', '1234567', 'LOW'], ['9-1', '12-14', '1234', 'SHOULDER']]}, 'PEAK'], ['overlapping seasons first wins', {'date': '2027-12-20', 'seasons': [['12-1', '12-31', '1234567', 'DEC'], ['12-15', '1-10', '1234567', 'PEAK']]}, 'DEC'], ['two-digit month compare', {'date': '2027-10-17', 'seasons': [['9-1', '11-30', '1234567', 'FALL'], ['3-1', '5-31', '1234567', 'SPRING']]}, 'FALL'], ['sampled case 1', {'date': '2029-04-07', 'seasons': [['12-9', '5-18', '123456', 'S0'], ['11-27', '12-4', '12457', 'S1']]}, 'S0'], ['sampled case 2', {'date': '2027-10-12', 'seasons': [['7-20', '1-2', '4', 'S0']]}, 'NONE'], ['sampled case 3', {'date': '2027-06-11', 'seasons': [['9-12', '2-18', '46', 'S0'], ['1-5', '7-14', '4', 'S1'], ['3-28', '6-4', '1234567', 'S2'], ['8-26', '9-24', '123567', 'S3']]}, 'NONE']]]
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
New Year inside wrap seasonPEAKPEAKPassed
season end dayHIGH_WKHIGH_WKPassed
Sunday in summerHIGH_WEHIGH_WEPassed
autumn weekdaySHOULDERSHOULDERPassed
wrap end datePEAKPEAKPassed
overlapping seasons first winsDECDECPassed
two-digit month compareFALLFALLPassed
sampled case 1NONENONEPassed
sampled case 2NONENONEPassed
sampled case 3NONENONEPassed

SHA-256 / ccd75ee65da7efcbf529102e44754070090c5f98e1f2133c000d8a8c12a5c641

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

Case digest / 7588ef78a5346840a34d1f2ca4b015bb08552900f6729524f62a59828752da1f