FA-77566 / Legal deadline computation / Open access
Earliest hearing date after court-day notice plus mailing days: final roll · case 01
The earliest hearing is scheduled on a court holiday.
ROOT CAUSE
The final adjustment only skips weekends.
VERIFIED REPAIR
At the final roll decision use `while closed(d):; d += dt.timedelta(days=1)`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `if closed(d):; d += dt.timedelta(days=1)` moves at most one day, which can still land on a weekend.
Case contract
Stipulated: a motion must be served at least notice_days court days before the hearing. Excluding the service day, count notice_days court days (not Saturday, Sunday or a listed holiday); then add calendar days for the service method (mail 5, mail-out-of-state 10, express 2, otherwise 0). If that day is not a court day, the earliest hearing is the next court day.
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(served, notice_days, method, holidays):
s = dt.date.fromisoformat(served)
hol = {dt.date.fromisoformat(x) for x in holidays}
def closed(d):
return d.weekday() >= 5 or d in hol
d = s
n = 0
while n < notice_days:
d += dt.timedelta(days=1)
if not closed(d):
n += 1
d += dt.timedelta(days={'mail': 5, 'mail-out-of-state': 10, 'express': 2}.get(method, 0))
while d.weekday() >= 5:
d += dt.timedelta(days=1)
return d.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08'),
('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07'),
('out of state mail',
['2024-03-01',
16,
'mail-out-of-state',
['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-04'),
('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12')],
[('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07'),
('out of state mail',
['2024-03-01',
16,
'mail-out-of-state',
['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-04'),
('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08')],
[('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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')],
[('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('express to sunday',
['2024-10-02',
1,
'express',
['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-07'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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')],
[('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('express to sunday',
['2024-10-02',
1,
'express',
['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-07'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08'),
('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07')]]
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: mail lands on holiday | 2024-07-04 | 2024-07-05 | Failed |
| friday holiday then weekend | 2024-07-05 | 2024-07-08 | Failed |
| sixteen court days across holiday | 2024-06-07 | 2024-06-07 | Passed |
| out of state mail | 2024-04-04 | 2024-04-04 | Passed |
| express | 2024-03-27 | 2024-03-27 | Passed |
| served on a saturday | 2024-03-06 | 2024-03-06 | Passed |
| mail lands on weekend | 2024-03-12 | 2024-03-12 | Passed |
SHA-256 / 8434cd91a3faa2d5f0b628b1c26f0180fe648fabed404ad056bd12d5f0194bd7
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(served, notice_days, method, holidays):
s = dt.date.fromisoformat(served)
hol = {dt.date.fromisoformat(x) for x in holidays}
def closed(d):
return d.weekday() >= 5 or d in hol
d = s
n = 0
while n < notice_days:
d += dt.timedelta(days=1)
if not closed(d):
n += 1
d += dt.timedelta(days={'mail': 5, 'mail-out-of-state': 10, 'express': 2}.get(method, 0))
if closed(d):
d += dt.timedelta(days=1)
return d.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08'),
('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07'),
('out of state mail',
['2024-03-01',
16,
'mail-out-of-state',
['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-04'),
('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12')],
[('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07'),
('out of state mail',
['2024-03-01',
16,
'mail-out-of-state',
['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-04'),
('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08')],
[('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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')],
[('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('express to sunday',
['2024-10-02',
1,
'express',
['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-07'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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')],
[('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('express to sunday',
['2024-10-02',
1,
'express',
['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-07'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08'),
('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07')]]
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: mail lands on holiday | 2024-07-05 | 2024-07-05 | Passed |
| friday holiday then weekend | 2024-07-06 | 2024-07-08 | Failed |
| sixteen court days across holiday | 2024-06-07 | 2024-06-07 | Passed |
| out of state mail | 2024-04-04 | 2024-04-04 | Passed |
| express | 2024-03-27 | 2024-03-27 | Passed |
| served on a saturday | 2024-03-06 | 2024-03-06 | Passed |
| mail lands on weekend | 2024-03-12 | 2024-03-12 | Passed |
SHA-256 / 64f9aee0bc1ae0aa7d649d92a117837329aa29c12eb62b0a37ec6583fe74990e
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(served, notice_days, method, holidays):
s = dt.date.fromisoformat(served)
hol = {dt.date.fromisoformat(x) for x in holidays}
def closed(d):
return d.weekday() >= 5 or d in hol
d = s
n = 0
while n < notice_days:
d += dt.timedelta(days=1)
if not closed(d):
n += 1
d += dt.timedelta(days={'mail': 5, 'mail-out-of-state': 10, 'express': 2}.get(method, 0))
while closed(d):
d += dt.timedelta(days=1)
return d.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08'),
('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07'),
('out of state mail',
['2024-03-01',
16,
'mail-out-of-state',
['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-04'),
('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12')],
[('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07'),
('out of state mail',
['2024-03-01',
16,
'mail-out-of-state',
['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-04'),
('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08')],
[('express',
['2024-03-01',
16,
'express',
['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-27'),
('served on a saturday',
['2024-03-02',
3,
'hand',
['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'),
('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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')],
[('mail lands on weekend',
['2024-03-04',
3,
'mail',
['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-12'),
('thanksgiving notice',
['2024-11-18',
9,
'mail',
['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-12-09'),
('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('express to sunday',
['2024-10-02',
1,
'express',
['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-07'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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')],
[('mail then saturday then monday holiday',
['2024-08-21',
2,
'mail',
['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-08-28'),
('zero notice',
['2024-04-05',
0,
'mail',
['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-10'),
('hand across july 4',
['2024-06-28',
5,
'hand',
['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-08'),
('express to sunday',
['2024-10-02',
1,
'express',
['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-07'),
('regression: mail lands on holiday',
['2024-06-21',
1,
'mail-out-of-state',
['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'),
('friday holiday then weekend', ['2024-06-24', 1, 'mail-out-of-state', ['2024-07-05']], '2024-07-08'),
('sixteen court days across holiday',
['2024-05-15',
16,
'hand',
['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-07')]]
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: mail lands on holiday | 2024-07-05 | 2024-07-05 | Passed |
| friday holiday then weekend | 2024-07-08 | 2024-07-08 | Passed |
| sixteen court days across holiday | 2024-06-07 | 2024-06-07 | Passed |
| out of state mail | 2024-04-04 | 2024-04-04 | Passed |
| express | 2024-03-27 | 2024-03-27 | Passed |
| served on a saturday | 2024-03-06 | 2024-03-06 | Passed |
| mail lands on weekend | 2024-03-12 | 2024-03-12 | Passed |
SHA-256 / fca48f18ef95ec6c4dbf2c8c464c53ab7086c1a522ff12aa3ee7d2ed69feb129
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:26.888423+00:00.
Case digest / 8cc5cb83f1e38aad432a066b1478f675e4052c18f8d53d6761a68194af5730ad