FA-66421 / Airline fare rule evaluation / Open access
Month-day bounds compared as text · case 01
An October date is judged outside a September-to-November season.
ROOT CAUSE
Unpadded month-day strings are compared lexicographically, so "10-15" sorts before "9-1".
VERIFIED REPAIR
Parse month and day into integer tuples before comparing.
Unsuccessful approach: Formatting the travel date unpadded as well is still a lexicographic comparison.
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.strftime('%m-%d')
for start, end, dow, code in x['seasons']:
s = start
e = end
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| New Year inside wrap season | PEAK | PEAK | Passed |
| season end day | PEAK | HIGH_WK | Failed |
| Sunday in summer | PEAK | HIGH_WE | Failed |
| autumn weekday | LOW | SHOULDER | Failed |
| wrap end date | PEAK | PEAK | Passed |
| overlapping seasons first wins | DEC | DEC | Passed |
| two-digit month compare | FALL | FALL | Passed |
| sampled case 1 | NONE | NONE | Passed |
| sampled case 2 | NONE | NONE | Passed |
| sampled case 3 | NONE | NONE | Passed |
SHA-256 / 994490fcd5dd3f875b2153d92fa96fc09dc734547aab901e9536c2589c494d43
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-%d' % (d.month, d.day)
for start, end, dow, code in x['seasons']:
s = start
e = end
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| New Year inside wrap season | LOW | PEAK | Failed |
| season end day | PEAK | HIGH_WK | Failed |
| Sunday in summer | PEAK | HIGH_WE | Failed |
| autumn weekday | LOW | SHOULDER | Failed |
| wrap end date | PEAK | PEAK | Passed |
| overlapping seasons first wins | DEC | DEC | Passed |
| two-digit month compare | FALL | FALL | Passed |
| sampled case 1 | NONE | NONE | Passed |
| sampled case 2 | NONE | NONE | Passed |
| sampled case 3 | NONE | NONE | Passed |
SHA-256 / 3e389171999078442fb6e9820902183e272a726e06864cba196da4ba480130ed
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| New Year inside wrap season | PEAK | PEAK | Passed |
| season end day | HIGH_WK | HIGH_WK | Passed |
| Sunday in summer | HIGH_WE | HIGH_WE | Passed |
| autumn weekday | SHOULDER | SHOULDER | Passed |
| wrap end date | PEAK | PEAK | Passed |
| overlapping seasons first wins | DEC | DEC | Passed |
| two-digit month compare | FALL | FALL | Passed |
| sampled case 1 | NONE | NONE | Passed |
| sampled case 2 | NONE | NONE | Passed |
| sampled case 3 | NONE | NONE | Passed |
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.502420+00:00.
Case digest / 13ba5e7ad16d1be75f24a69792372515b5c5d1d3e1258143e22b4c156d01dfac