FA-77731 / Legal deadline computation / Open access
Stacking stipulated extensions under a cumulative cap: extension base · case 01
A second extension is added to the original deadline, so extensions do not stack.
ROOT CAUSE
Each extension is measured from the original deadline.
VERIFIED REPAIR
At the extension base decision use `cur`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `s` measures each extension from the signing date.
Case contract
Stipulated: the original deadline (rolled forward to an open day) may be extended by stipulations [signed, days] processed in order, without court order, up to 30 days in total across all stipulations. A stipulation is valid only if signed on or before the then-current deadline; it grants min(days, remaining cap), added to the current deadline, and the result is rolled forward to an open day (not weekend or listed holiday). Return [final deadline, total days granted].
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(original, stipulations, holidays):
hol = {dt.date.fromisoformat(x) for x in holidays}
def roll(d):
while d.weekday() >= 5 or d in hol:
d += dt.timedelta(days=1)
return d
base = roll(dt.date.fromisoformat(original))
cur = base
used = 0
for signed, days in stipulations:
s = dt.date.fromisoformat(signed)
if s > cur:
continue
grant = min(days, 30 - used)
if grant <= 0:
continue
used += grant
nxt = base + dt.timedelta(days=grant)
cur = roll(nxt)
return [cur.isoformat(), used]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3])],
[('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30])],
[('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20])],
[('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7])],
[('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5])]]
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: second stipulation after original | ['2024-03-11', 20] | ['2024-03-21', 20] | Failed |
| cap exceeded | ['2024-04-15', 28] | ['2024-05-01', 30] | Failed |
| signed on deadline day | ['2024-04-08', 7] | ['2024-04-08', 7] | Passed |
| late stipulation | ['2024-04-01', 0] | ['2024-04-01', 0] | Passed |
| extension to saturday | ['2024-04-08', 5] | ['2024-04-08', 5] | Passed |
| extension to holiday | ['2024-06-20', 7] | ['2024-06-20', 7] | Passed |
| original on weekend | ['2024-06-06', 3] | ['2024-06-06', 3] | Passed |
SHA-256 / 3b488c0095ebc1323e1900a3aab16a862ecf5419d5f348fa45ac8ec74f23e52c
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(original, stipulations, holidays):
hol = {dt.date.fromisoformat(x) for x in holidays}
def roll(d):
while d.weekday() >= 5 or d in hol:
d += dt.timedelta(days=1)
return d
base = roll(dt.date.fromisoformat(original))
cur = base
used = 0
for signed, days in stipulations:
s = dt.date.fromisoformat(signed)
if s > cur:
continue
grant = min(days, 30 - used)
if grant <= 0:
continue
used += grant
nxt = s + dt.timedelta(days=grant)
cur = roll(nxt)
return [cur.isoformat(), used]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3])],
[('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30])],
[('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20])],
[('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7])],
[('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5])]]
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: second stipulation after original | ['2024-03-18', 20] | ['2024-03-21', 20] | Failed |
| cap exceeded | ['2024-04-22', 30] | ['2024-05-01', 30] | Failed |
| signed on deadline day | ['2024-04-08', 7] | ['2024-04-08', 7] | Passed |
| late stipulation | ['2024-04-01', 0] | ['2024-04-01', 0] | Passed |
| extension to saturday | ['2024-04-01', 5] | ['2024-04-08', 5] | Failed |
| extension to holiday | ['2024-06-17', 7] | ['2024-06-20', 7] | Failed |
| original on weekend | ['2024-06-06', 3] | ['2024-06-06', 3] | Passed |
SHA-256 / 577a7da9032fc2217700eeac3c570378354e7c20533ab0d8be009218d765f492
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(original, stipulations, holidays):
hol = {dt.date.fromisoformat(x) for x in holidays}
def roll(d):
while d.weekday() >= 5 or d in hol:
d += dt.timedelta(days=1)
return d
base = roll(dt.date.fromisoformat(original))
cur = base
used = 0
for signed, days in stipulations:
s = dt.date.fromisoformat(signed)
if s > cur:
continue
grant = min(days, 30 - used)
if grant <= 0:
continue
used += grant
nxt = cur + dt.timedelta(days=grant)
cur = roll(nxt)
return [cur.isoformat(), used]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3])],
[('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30])],
[('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5]),
('extension to holiday',
['2024-06-12',
[['2024-06-10', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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', 7]),
('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20])],
[('original on weekend',
['2024-06-01',
[['2024-06-03', 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-06-06', 3]),
('exact cap',
['2024-01-08',
[['2024-01-05', 20], ['2024-01-20', 10], ['2024-02-01', 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-02-08', 30]),
('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7])],
[('single thirty',
['2024-08-01',
[['2024-07-01', 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']],
['2024-09-03', 30]),
('three stacked short',
['2024-09-03',
[['2024-09-01', 3], ['2024-09-05', 4], ['2024-09-09', 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-09-12', 9]),
('regression: second stipulation after original',
['2024-03-01',
[['2024-02-28', 10], ['2024-03-08', 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']],
['2024-03-21', 20]),
('cap exceeded',
['2024-04-01',
[['2024-03-30', 14], ['2024-04-10', 14], ['2024-04-20', 14]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-05-27',
'2024-06-19',
'2024-07-04',
'2024-09-02',
'2024-10-14',
'2024-11-11',
'2024-11-28',
'2024-12-25']],
['2024-05-01', 30]),
('signed on deadline day',
['2024-04-01',
[['2024-04-01', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-08', 7]),
('late stipulation',
['2024-04-01',
[['2024-04-02', 7]],
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-01', 0]),
('extension to saturday',
['2024-04-01',
[['2024-03-25', 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-08', 5])]]
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: second stipulation after original | ['2024-03-21', 20] | ['2024-03-21', 20] | Passed |
| cap exceeded | ['2024-05-01', 30] | ['2024-05-01', 30] | Passed |
| signed on deadline day | ['2024-04-08', 7] | ['2024-04-08', 7] | Passed |
| late stipulation | ['2024-04-01', 0] | ['2024-04-01', 0] | Passed |
| extension to saturday | ['2024-04-08', 5] | ['2024-04-08', 5] | Passed |
| extension to holiday | ['2024-06-20', 7] | ['2024-06-20', 7] | Passed |
| original on weekend | ['2024-06-06', 3] | ['2024-06-06', 3] | Passed |
SHA-256 / 8eb27ce8df57574455c26701251e425539bac4e4a99c23aa87f103938f85ebf5
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.545711+00:00.
Case digest / 16c6db9359947223c15ec9728d2eedd852e5c8abacc1c8fce52f9a69dd3809e6