FA-77551 / Legal deadline computation / Open access
Earliest hearing date after court-day notice plus mailing days: service day exclusion · case 01
Serving on a court day lets the service day count toward the notice, allowing a hearing a day early.
ROOT CAUSE
Counting starts before the service day, so the service day itself is counted.
VERIFIED REPAIR
At the service day exclusion decision use `s`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `s + dt.timedelta(days=1)` skips the day after service as well and pushes the hearing a court day late.
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 - dt.timedelta(days=1)
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')],
[('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')],
[('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-01 | 2024-07-05 | Failed |
| friday holiday then weekend | 2024-07-04 | 2024-07-08 | Failed |
| sixteen court days across holiday | 2024-06-06 | 2024-06-07 | Failed |
| out of state mail | 2024-04-01 | 2024-04-04 | Failed |
| express | 2024-03-25 | 2024-03-27 | Failed |
| served on a saturday | 2024-03-06 | 2024-03-06 | Passed |
| mail lands on weekend | 2024-03-11 | 2024-03-12 | Failed |
SHA-256 / dbf962186e39260e85a1aa457ca42fe2a0662ad484d70b5f60b5b8c3ac7383e2
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 + dt.timedelta(days=1)
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')],
[('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')],
[('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-10 | 2024-06-07 | Failed |
| 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-13 | 2024-03-12 | Failed |
SHA-256 / 088df11d22f8f186193417502ecb9b1233148ccc3a84b7c91951f35858cbcc63
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')],
[('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')],
[('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 / 20f0c994660aca39513ed02e67c39183dc7460020c5b8c67ac346a3f19cab880
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.509118+00:00.
Case digest / f050a88747c1a0e07da0473c0af3fe24043e324d0d8acce99cb5f30636bd06d3