FA-66411 / Airline fare rule evaluation / Open access
Later overlapping season overrides the first match · case 01
A date covered by both a December promotion and the peak season gets the later-listed code.
ROOT CAUSE
The loop keeps scanning and remembers the last matching season.
VERIFIED REPAIR
Return the first matching season in list order.
Unsuccessful approach: Scanning in reverse is still last-match-wins.
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)
found = 'NONE'
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:
found = code
return found
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 | PEAK | DEC | Failed |
| 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 / 5af4c59f764e3815244d4b6aa647a6742681da4bd2bea25e32ac551b0cb6196d
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 reversed(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 | PEAK | DEC | Failed |
| 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 / 628eca3fd560b8917e4fd7a59f3b34a6b5470b420f2a61780146f4c6db4bd708
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.457147+00:00.
Case digest / 4f95506cbaec27b3f0323ee3b1ba6603260f8608a9d6e64be9752a2894bde205