FA-77641 / Legal deadline computation / Open access
Deemed receipt of a contract notice and a business-day response window: deemed roll · case 01
A notice received on a public holiday is deemed received that day.
ROOT CAUSE
Only weekends move the deemed receipt date.
VERIFIED REPAIR
At the deemed roll decision use `not business(deemed)`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `deemed in hol` moves holidays but not weekends.
Case contract
Stipulated: a notice is sent at a local time in the sender zone (sender_offset_min east of UTC) and is received at the same instant in the recipient zone (recipient_offset_min). Received at or after the cutoff time (recipient local) it is deemed received the next day; a deemed day that is not a business day (weekday, not a listed holiday) moves to the next business day. The response window ends after n business days counted from the day after deemed receipt. Return [deemed receipt, response deadline].
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(sent_local, sender_offset_min, recipient_offset_min, cutoff, n, holidays):
sent = dt.datetime.fromisoformat(sent_local)
local = sent + dt.timedelta(minutes=recipient_offset_min - sender_offset_min)
cut = dt.time.fromisoformat(cutoff)
hol = {dt.date.fromisoformat(x) for x in holidays}
def business(d):
return d.weekday() < 5 and d not in hol
deemed = local.date()
if local.time() >= cut:
deemed += dt.timedelta(days=1)
while deemed.weekday() >= 5:
deemed += dt.timedelta(days=1)
d = deemed
k = 0
while k < n:
d += dt.timedelta(days=1)
if business(d):
k += 1
return [deemed.isoformat(), d.isoformat()]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08'])],
[('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30'])],
[('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13'])],
[('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11'])],
[('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09'])]]
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: cross-zone cutoff | ['2024-03-06', '2024-03-13'] | ['2024-03-06', '2024-03-13'] | Passed |
| exactly at cutoff | ['2024-03-06', '2024-03-11'] | ['2024-03-06', '2024-03-11'] | Passed |
| late minutes after cutoff hour | ['2024-03-06', '2024-03-11'] | ['2024-03-06', '2024-03-11'] | Passed |
| friday evening | ['2024-03-11', '2024-03-13'] | ['2024-03-11', '2024-03-13'] | Passed |
| received on holiday | ['2024-07-04', '2024-07-08'] | ['2024-07-05', '2024-07-09'] | Failed |
| received saturday | ['2024-03-11', '2024-03-12'] | ['2024-03-11', '2024-03-12'] | Passed |
| east to west | ['2024-03-06', '2024-03-08'] | ['2024-03-06', '2024-03-08'] | Passed |
SHA-256 / 65ca127d200f10d619245ff953b1b95fb7e1562fb6bf31ce28968263dbddbabc
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(sent_local, sender_offset_min, recipient_offset_min, cutoff, n, holidays):
sent = dt.datetime.fromisoformat(sent_local)
local = sent + dt.timedelta(minutes=recipient_offset_min - sender_offset_min)
cut = dt.time.fromisoformat(cutoff)
hol = {dt.date.fromisoformat(x) for x in holidays}
def business(d):
return d.weekday() < 5 and d not in hol
deemed = local.date()
if local.time() >= cut:
deemed += dt.timedelta(days=1)
while deemed in hol:
deemed += dt.timedelta(days=1)
d = deemed
k = 0
while k < n:
d += dt.timedelta(days=1)
if business(d):
k += 1
return [deemed.isoformat(), d.isoformat()]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08'])],
[('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30'])],
[('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13'])],
[('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11'])],
[('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09'])]]
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: cross-zone cutoff | ['2024-03-06', '2024-03-13'] | ['2024-03-06', '2024-03-13'] | Passed |
| exactly at cutoff | ['2024-03-06', '2024-03-11'] | ['2024-03-06', '2024-03-11'] | Passed |
| late minutes after cutoff hour | ['2024-03-06', '2024-03-11'] | ['2024-03-06', '2024-03-11'] | Passed |
| friday evening | ['2024-03-09', '2024-03-12'] | ['2024-03-11', '2024-03-13'] | Failed |
| received on holiday | ['2024-07-05', '2024-07-09'] | ['2024-07-05', '2024-07-09'] | Passed |
| received saturday | ['2024-03-09', '2024-03-11'] | ['2024-03-11', '2024-03-12'] | Failed |
| east to west | ['2024-03-06', '2024-03-08'] | ['2024-03-06', '2024-03-08'] | Passed |
SHA-256 / 7e6b3553a8fc69386b1e25d0268355bda7f05e91a9a9525dfedda62cbdb6c9e8
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(sent_local, sender_offset_min, recipient_offset_min, cutoff, n, holidays):
sent = dt.datetime.fromisoformat(sent_local)
local = sent + dt.timedelta(minutes=recipient_offset_min - sender_offset_min)
cut = dt.time.fromisoformat(cutoff)
hol = {dt.date.fromisoformat(x) for x in holidays}
def business(d):
return d.weekday() < 5 and d not in hol
deemed = local.date()
if local.time() >= cut:
deemed += dt.timedelta(days=1)
while not business(deemed):
deemed += dt.timedelta(days=1)
d = deemed
k = 0
while k < n:
d += dt.timedelta(days=1)
if business(d):
k += 1
return [deemed.isoformat(), d.isoformat()]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08'])],
[('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30'])],
[('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09']),
('received saturday',
['2024-03-09T10:00',
0,
0,
'17:00',
1,
['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-11', '2024-03-12']),
('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13'])],
[('east to west',
['2024-03-06T01:00',
60,
-300,
'17:00',
2,
['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-06', '2024-03-08']),
('before cutoff simple',
['2024-04-02T09:00',
0,
0,
'17:00',
5,
['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-02', '2024-04-09']),
('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11'])],
[('evening before holiday',
['2024-05-24T20:00',
0,
0,
'18:00',
2,
['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-28', '2024-05-30']),
('west to east crosses midnight',
['2024-06-18T21:00',
-420,
120,
'17:00',
1,
['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-20', '2024-06-21']),
('regression: cross-zone cutoff',
['2024-03-05T13:30',
-300,
0,
'17:00',
5,
['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-06', '2024-03-13']),
('exactly at cutoff',
['2024-03-05T17:00',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('late minutes after cutoff hour',
['2024-03-05T17:45',
0,
0,
'17:00',
3,
['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-06', '2024-03-11']),
('friday evening',
['2024-03-08T18:00',
0,
0,
'17:00',
2,
['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-11', '2024-03-13']),
('received on holiday',
['2024-07-04T09:00',
0,
0,
'17:00',
2,
['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-07-05', '2024-07-09'])]]
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: cross-zone cutoff | ['2024-03-06', '2024-03-13'] | ['2024-03-06', '2024-03-13'] | Passed |
| exactly at cutoff | ['2024-03-06', '2024-03-11'] | ['2024-03-06', '2024-03-11'] | Passed |
| late minutes after cutoff hour | ['2024-03-06', '2024-03-11'] | ['2024-03-06', '2024-03-11'] | Passed |
| friday evening | ['2024-03-11', '2024-03-13'] | ['2024-03-11', '2024-03-13'] | Passed |
| received on holiday | ['2024-07-05', '2024-07-09'] | ['2024-07-05', '2024-07-09'] | Passed |
| received saturday | ['2024-03-11', '2024-03-12'] | ['2024-03-11', '2024-03-12'] | Passed |
| east to west | ['2024-03-06', '2024-03-08'] | ['2024-03-06', '2024-03-08'] | Passed |
SHA-256 / 2485a3ec2588c78ed1f0b0d3554c01b1084d68495c5af4e6b51f20a265a60446
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:27.600066+00:00.
Case digest / 33e68b582373d249b3e0ef92f26b50da48e90124278b93d549ce3ebce0fac118