FA-77416 / Legal deadline computation / Open access
Hour-denominated periods with next-open-day extension: counting start · case 01
A 48-hour period triggered at 10:20 ends at 11:00 two days later.
ROOT CAUSE
Counting starts at the next whole hour instead of immediately.
VERIFIED REPAIR
At the counting start decision use `s`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `s.replace(minute=0)` truncates to the start of the hour, ending the period early.
Case contract
Stipulated rule: an hours period begins counting immediately at the triggering event, counts every hour including weekends and holidays, and if it ends on a Saturday, Sunday or listed holiday it continues to the same time on the next day that is none of these.
Why this case matters
Docketing systems compute filing and response deadlines from trigger events; a wrong date can forfeit a right.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(start, hours, holidays):
s = dt.datetime.fromisoformat(start)
hol = {dt.date.fromisoformat(x) for x in holidays}
def closed(day):
return day.weekday() >= 5 or day in hol
e = (s.replace(minute=0) + dt.timedelta(hours=1) if s.minute else s) + dt.timedelta(hours=hours)
while closed(e.date()):
e = e + dt.timedelta(days=1)
return e.isoformat(timespec='minutes')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00')],
[('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00')],
[('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00')],
[('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00')],
[('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00')]]
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 |
|---|---|---|---|
| regression: ends saturday afternoon | 2024-03-11T15:00 | 2024-03-11T15:00 | Passed |
| mid-hour start | 2024-03-06T11:00 | 2024-03-06T10:20 | Failed |
| 36 hours | 2024-03-05T20:00 | 2024-03-05T20:00 | Passed |
| ends on holiday | 2024-01-16T10:00 | 2024-01-16T09:30 | Failed |
| weekday end | 2024-04-02T12:00 | 2024-04-02T12:00 | Passed |
| 14 hours overnight | 2024-04-03T11:00 | 2024-04-03T10:45 | Failed |
| ends sunday then holiday | 2024-05-28T11:00 | 2024-05-28T11:00 | Passed |
SHA-256 / 43635ca7f1a5b9b3ee75fa82bc50e7a21004498a4c8b545370303187d6751b7d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(start, hours, holidays):
s = dt.datetime.fromisoformat(start)
hol = {dt.date.fromisoformat(x) for x in holidays}
def closed(day):
return day.weekday() >= 5 or day in hol
e = s.replace(minute=0) + dt.timedelta(hours=hours)
while closed(e.date()):
e = e + dt.timedelta(days=1)
return e.isoformat(timespec='minutes')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00')],
[('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00')],
[('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00')],
[('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00')],
[('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00')]]
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 |
|---|---|---|---|
| regression: ends saturday afternoon | 2024-03-11T15:00 | 2024-03-11T15:00 | Passed |
| mid-hour start | 2024-03-06T10:00 | 2024-03-06T10:20 | Failed |
| 36 hours | 2024-03-05T20:00 | 2024-03-05T20:00 | Passed |
| ends on holiday | 2024-01-16T09:00 | 2024-01-16T09:30 | Failed |
| weekday end | 2024-04-02T12:00 | 2024-04-02T12:00 | Passed |
| 14 hours overnight | 2024-04-03T10:00 | 2024-04-03T10:45 | Failed |
| ends sunday then holiday | 2024-05-28T11:00 | 2024-05-28T11:00 | Passed |
SHA-256 / 9fc5f8843c229d3fa6fdc927af4e15a6fe223cc1647fab23b51fbba684861e3c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(start, hours, holidays):
s = dt.datetime.fromisoformat(start)
hol = {dt.date.fromisoformat(x) for x in holidays}
def closed(day):
return day.weekday() >= 5 or day in hol
e = s + dt.timedelta(hours=hours)
while closed(e.date()):
e = e + dt.timedelta(days=1)
return e.isoformat(timespec='minutes')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00')],
[('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00')],
[('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00'),
('14 hours overnight',
['2024-04-02T20:45',
14,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-03T10:45'),
('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00')],
[('ends sunday then holiday',
['2024-05-24T11:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-05-28T11:00'),
('72 hours from friday',
['2024-06-14T16:10',
72,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-17T16:10'),
('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00')],
[('six hours into saturday',
['2024-06-07T21:00',
6,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-06-10T03:00'),
('100 hours',
['2024-10-08T07:15',
100,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-10-15T11:15'),
('regression: ends saturday afternoon',
['2024-03-07T15:00',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-11T15:00'),
('mid-hour start',
['2024-03-04T10:20',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-06T10:20'),
('36 hours',
['2024-03-04T08:00',
36,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-03-05T20:00'),
('ends on holiday',
['2024-01-13T09:30',
48,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-01-16T09:30'),
('weekday end',
['2024-04-01T12:00',
24,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
'2024-04-02T12:00')]]
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 |
|---|---|---|---|
| regression: ends saturday afternoon | 2024-03-11T15:00 | 2024-03-11T15:00 | Passed |
| mid-hour start | 2024-03-06T10:20 | 2024-03-06T10:20 | Passed |
| 36 hours | 2024-03-05T20:00 | 2024-03-05T20:00 | Passed |
| ends on holiday | 2024-01-16T09:30 | 2024-01-16T09:30 | Passed |
| weekday end | 2024-04-02T12:00 | 2024-04-02T12:00 | Passed |
| 14 hours overnight | 2024-04-03T10:45 | 2024-04-03T10:45 | Passed |
| ends sunday then holiday | 2024-05-28T11:00 | 2024-05-28T11:00 | Passed |
SHA-256 / 05af21d741397162fa5ab31ba53008ae3145b234ad59c3fa82f19fdf3ffbcc99
Verification & scope
Stipulated toy deadline rules evaluated offline on explicit fixtures. The contract is inspired by common court-rule structures but is not legal advice and makes no claim to reproduce any jurisdiction's rules. 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:49:25.239766+00:00.
Case digest / 695cfafb8453934367c3686e84fc09e4e1b503000baa57916c5a571ceb49cb4a