FA-77716 / Legal deadline computation / Open access
Docket countdown: court days remaining and urgency status: soon threshold · case 01
A deadline three calendar days away over a long weekend is flagged later than the court-day rule requires.
ROOT CAUSE
The urgency threshold counts calendar days instead of court days.
VERIFIED REPAIR
At the soon threshold decision use `court <= 3`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `court < 3` uses a strict threshold and misses deadlines exactly three court days away.
Case contract
For today and a deadline, return [calendar days remaining, court days remaining, status]. Court days remaining counts open days (not Saturday, Sunday or a listed holiday) after today up to and including the deadline; it is None when the deadline has passed. Status is "overdue" if the deadline is before today, "due today" if equal, "due soon" if at most 3 court days remain, else "open".
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(today, deadline, holidays):
t = dt.date.fromisoformat(today)
dl = dt.date.fromisoformat(deadline)
hol = {dt.date.fromisoformat(x) for x in holidays}
cal = (dl - t).days
if cal < 0:
court = None
else:
court = sum(1 for i in range(1, cal + 1) if (t + dt.timedelta(days=i)).weekday() < 5 and t + dt.timedelta(days=i) not in hol)
if cal < 0:
status = 'overdue'
elif cal == 0:
status = 'due today'
elif cal <= 3:
status = 'due soon'
else:
status = 'open'
return [cal, court, status]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon']),
('deadline today',
['2024-03-11',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[0, 0, 'due today']),
('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue']),
('three court days',
['2024-03-11',
'2024-03-14',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[3, 3, 'due soon']),
('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open'])],
[('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue']),
('three court days',
['2024-03-11',
'2024-03-14',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[3, 3, 'due soon']),
('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue'])],
[('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon'])],
[('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('saturday before sunday deadline',
['2024-03-09',
'2024-03-10',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 0, 'due soon']),
('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon'])],
[('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('saturday before sunday deadline',
['2024-03-09',
'2024-03-10',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 0, 'due soon']),
('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon']),
('deadline today',
['2024-03-11',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[0, 0, 'due today']),
('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue'])]]
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: saturday before monday deadline | [2, 1, 'due soon'] | [2, 1, 'due soon'] | Passed |
| deadline today | [0, 0, 'due today'] | [0, 0, 'due today'] | Passed |
| yesterday | [-1, None, 'overdue'] | [-1, None, 'overdue'] | Passed |
| three court days | [3, 3, 'due soon'] | [3, 3, 'due soon'] | Passed |
| long weekend | [6, 3, 'open'] | [6, 3, 'due soon'] | Failed |
| five calendar four court | [5, 2, 'open'] | [5, 2, 'due soon'] | Failed |
| far off | [44, 31, 'open'] | [44, 31, 'open'] | Passed |
SHA-256 / 053e183196d44e1f03d7fe7f7f85bf747fc3bc27ac9ab7a6bc43ca41bc1d82bb
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(today, deadline, holidays):
t = dt.date.fromisoformat(today)
dl = dt.date.fromisoformat(deadline)
hol = {dt.date.fromisoformat(x) for x in holidays}
cal = (dl - t).days
if cal < 0:
court = None
else:
court = sum(1 for i in range(1, cal + 1) if (t + dt.timedelta(days=i)).weekday() < 5 and t + dt.timedelta(days=i) not in hol)
if cal < 0:
status = 'overdue'
elif cal == 0:
status = 'due today'
elif court < 3:
status = 'due soon'
else:
status = 'open'
return [cal, court, status]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon']),
('deadline today',
['2024-03-11',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[0, 0, 'due today']),
('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue']),
('three court days',
['2024-03-11',
'2024-03-14',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[3, 3, 'due soon']),
('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open'])],
[('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue']),
('three court days',
['2024-03-11',
'2024-03-14',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[3, 3, 'due soon']),
('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue'])],
[('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon'])],
[('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('saturday before sunday deadline',
['2024-03-09',
'2024-03-10',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 0, 'due soon']),
('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon'])],
[('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('saturday before sunday deadline',
['2024-03-09',
'2024-03-10',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 0, 'due soon']),
('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon']),
('deadline today',
['2024-03-11',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[0, 0, 'due today']),
('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue'])]]
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: saturday before monday deadline | [2, 1, 'due soon'] | [2, 1, 'due soon'] | Passed |
| deadline today | [0, 0, 'due today'] | [0, 0, 'due today'] | Passed |
| yesterday | [-1, None, 'overdue'] | [-1, None, 'overdue'] | Passed |
| three court days | [3, 3, 'open'] | [3, 3, 'due soon'] | Failed |
| long weekend | [6, 3, 'open'] | [6, 3, 'due soon'] | Failed |
| five calendar four court | [5, 2, 'due soon'] | [5, 2, 'due soon'] | Passed |
| far off | [44, 31, 'open'] | [44, 31, 'open'] | Passed |
SHA-256 / e9d9a33479c816299fcd6d76824ba551998b5d78dac8fcfb3e27e977b1c684c8
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(today, deadline, holidays):
t = dt.date.fromisoformat(today)
dl = dt.date.fromisoformat(deadline)
hol = {dt.date.fromisoformat(x) for x in holidays}
cal = (dl - t).days
if cal < 0:
court = None
else:
court = sum(1 for i in range(1, cal + 1) if (t + dt.timedelta(days=i)).weekday() < 5 and t + dt.timedelta(days=i) not in hol)
if cal < 0:
status = 'overdue'
elif cal == 0:
status = 'due today'
elif court <= 3:
status = 'due soon'
else:
status = 'open'
return [cal, court, status]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon']),
('deadline today',
['2024-03-11',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[0, 0, 'due today']),
('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue']),
('three court days',
['2024-03-11',
'2024-03-14',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[3, 3, 'due soon']),
('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open'])],
[('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue']),
('three court days',
['2024-03-11',
'2024-03-14',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[3, 3, 'due soon']),
('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue'])],
[('long weekend',
['2024-05-24',
'2024-05-30',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('five calendar four court',
['2024-05-23',
'2024-05-28',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon'])],
[('far off',
['2024-01-02',
'2024-02-15',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[44, 31, 'open']),
('tomorrow',
['2024-04-01',
'2024-04-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 1, 'due soon']),
('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('saturday before sunday deadline',
['2024-03-09',
'2024-03-10',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 0, 'due soon']),
('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon'])],
[('two weeks ago',
['2024-04-15',
'2024-04-01',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-14, None, 'overdue']),
('friday to wednesday',
['2024-06-14',
'2024-06-19',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[5, 2, 'due soon']),
('thanksgiving week',
['2024-11-26',
'2024-12-02',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[6, 3, 'due soon']),
('saturday before sunday deadline',
['2024-03-09',
'2024-03-10',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[1, 0, 'due soon']),
('regression: saturday before monday deadline',
['2024-03-09',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[2, 1, 'due soon']),
('deadline today',
['2024-03-11',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[0, 0, 'due today']),
('yesterday',
['2024-03-12',
'2024-03-11',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
[-1, None, 'overdue'])]]
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: saturday before monday deadline | [2, 1, 'due soon'] | [2, 1, 'due soon'] | Passed |
| deadline today | [0, 0, 'due today'] | [0, 0, 'due today'] | Passed |
| yesterday | [-1, None, 'overdue'] | [-1, None, 'overdue'] | Passed |
| three court days | [3, 3, 'due soon'] | [3, 3, 'due soon'] | Passed |
| long weekend | [6, 3, 'due soon'] | [6, 3, 'due soon'] | Passed |
| five calendar four court | [5, 2, 'due soon'] | [5, 2, 'due soon'] | Passed |
| far off | [44, 31, 'open'] | [44, 31, 'open'] | Passed |
SHA-256 / ee7a5243a72f3b7eb1ecea16cd6aa9db6a30c792b5832328822cfade9d7059b8
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:28.488518+00:00.
Case digest / 6b47633ca25cf037bed3d9c152a2ae7c81e5ac3e40d0059d2e5ad143a0e7187b