FA-77481 / Legal deadline computation / Open access
Limitations period with discovery accrual, tolling and repose cap: toll clip · case 01
Tolling that ended before discovery still extends the deadline.
ROOT CAUSE
Tolling days before accrual are counted.
VERIFIED REPAIR
At the toll clip decision use `max(a, accrual)`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `max(a, inj)` clips at the injury date instead of accrual.
Case contract
Stipulated: the claim accrues on the later of injury and discovery. The base deadline is the anniversary of accrual after years (a February 29 anniversary in a common year becomes February 28). Tolling intervals [start, end] are inclusive of both days, days before accrual do not count, and overlapping intervals count each day once; the tolled day count is added to the base deadline. A repose deadline of repose_years from the injury (same anniversary rule, never tolled) caps the result.
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(injury, discovery, years, tolls, repose_years):
inj = dt.date.fromisoformat(injury)
disc = dt.date.fromisoformat(discovery)
accrual = max(inj, disc)
def add_years(d, n):
y = d.year + n
return dt.date(y, d.month, min(d.day, calendar.monthrange(y, d.month)[1]))
base = add_years(accrual, years)
covered = set()
total = 0
for a, b in tolls:
a = dt.date.fromisoformat(a)
b = dt.date.fromisoformat(b)
a = a
span = max(0, (b - a).days + 1)
total += span
for i in range(span):
covered.add(a + dt.timedelta(days=i))
tolled = len(covered)
extended = base + dt.timedelta(days=tolled)
repose = add_years(inj, repose_years)
return (min(extended, repose)).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28'),
('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06'),
('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01')],
[('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06'),
('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19')],
[('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10')],
[('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10'),
('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28')],
[('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10'),
('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28'),
('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06')]]
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: discovery then overlapping tolls | 2021-06-21 | 2021-06-21 | Passed |
| leap day accrual | 2023-02-28 | 2023-02-28 | Passed |
| leap crossing two years | 2025-03-01 | 2025-03-01 | Passed |
| toll before discovery | 2019-12-06 | 2019-05-06 | Failed |
| one day toll | 2022-04-05 | 2022-04-05 | Passed |
| repose caps | 2020-01-15 | 2020-01-15 | Passed |
| repose with tolling beyond | 2022-07-01 | 2022-07-01 | Passed |
SHA-256 / 9a169ab767dfcded8d09ef4ed2af27e89c04b6e418498c9344ddf8efc62dddc1
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(injury, discovery, years, tolls, repose_years):
inj = dt.date.fromisoformat(injury)
disc = dt.date.fromisoformat(discovery)
accrual = max(inj, disc)
def add_years(d, n):
y = d.year + n
return dt.date(y, d.month, min(d.day, calendar.monthrange(y, d.month)[1]))
base = add_years(accrual, years)
covered = set()
total = 0
for a, b in tolls:
a = dt.date.fromisoformat(a)
b = dt.date.fromisoformat(b)
a = max(a, inj)
span = max(0, (b - a).days + 1)
total += span
for i in range(span):
covered.add(a + dt.timedelta(days=i))
tolled = len(covered)
extended = base + dt.timedelta(days=tolled)
repose = add_years(inj, repose_years)
return (min(extended, repose)).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28'),
('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06'),
('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01')],
[('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06'),
('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19')],
[('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10')],
[('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10'),
('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28')],
[('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10'),
('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28'),
('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06')]]
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: discovery then overlapping tolls | 2021-06-21 | 2021-06-21 | Passed |
| leap day accrual | 2023-02-28 | 2023-02-28 | Passed |
| leap crossing two years | 2025-03-01 | 2025-03-01 | Passed |
| toll before discovery | 2019-12-06 | 2019-05-06 | Failed |
| one day toll | 2022-04-05 | 2022-04-05 | Passed |
| repose caps | 2020-01-15 | 2020-01-15 | Passed |
| repose with tolling beyond | 2022-07-01 | 2022-07-01 | Passed |
SHA-256 / 79471f5e3e0e1334687210053df1b960f0439f4056d781b3f740b4e4a03b309e
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(injury, discovery, years, tolls, repose_years):
inj = dt.date.fromisoformat(injury)
disc = dt.date.fromisoformat(discovery)
accrual = max(inj, disc)
def add_years(d, n):
y = d.year + n
return dt.date(y, d.month, min(d.day, calendar.monthrange(y, d.month)[1]))
base = add_years(accrual, years)
covered = set()
total = 0
for a, b in tolls:
a = dt.date.fromisoformat(a)
b = dt.date.fromisoformat(b)
a = max(a, accrual)
span = max(0, (b - a).days + 1)
total += span
for i in range(span):
covered.add(a + dt.timedelta(days=i))
tolled = len(covered)
extended = base + dt.timedelta(days=tolled)
repose = add_years(inj, repose_years)
return (min(extended, repose)).isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28'),
('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06'),
('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01')],
[('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06'),
('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19')],
[('one day toll', ['2021-04-04', '2021-04-04', 1, [['2021-05-05', '2021-05-05']], 5], '2022-04-05'),
('repose caps', ['2010-01-15', '2019-06-01', 3, [['2020-01-01', '2020-06-30']], 10], '2020-01-15'),
('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10')],
[('repose with tolling beyond',
['2014-07-01', '2015-07-01', 7, [['2016-01-01', '2016-03-31']], 8],
'2022-07-01'),
('toll straddles accrual',
['2019-01-01', '2019-02-01', 1, [['2019-01-20', '2019-02-10']], 4],
'2020-02-11'),
('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10'),
('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28')],
[('three overlapping tolls',
['2022-05-05',
'2022-05-05',
2,
[['2022-06-01', '2022-06-30'], ['2022-06-15', '2022-07-15'], ['2022-07-10', '2022-07-12']],
6],
'2024-06-19'),
('discovery earlier than injury input', ['2021-09-09', '2021-08-01', 2, [], 4], '2023-09-09'),
('toll wholly before injury',
['2020-10-10', '2020-10-10', 1, [['2019-01-01', '2019-02-01']], 3],
'2021-10-10'),
('regression: discovery then overlapping tolls',
['2018-03-10', '2019-06-01', 2, [['2019-07-01', '2019-07-10'], ['2019-07-05', '2019-07-20']], 10],
'2021-06-21'),
('leap day accrual', ['2020-02-29', '2020-02-29', 3, [], 10], '2023-02-28'),
('leap crossing two years', ['2023-03-01', '2023-03-01', 2, [], 10], '2025-03-01'),
('toll before discovery',
['2015-01-10', '2016-05-05', 3, [['2015-06-01', '2015-12-31'], ['2017-01-01', '2017-01-01']], 10],
'2019-05-06')]]
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: discovery then overlapping tolls | 2021-06-21 | 2021-06-21 | Passed |
| leap day accrual | 2023-02-28 | 2023-02-28 | Passed |
| leap crossing two years | 2025-03-01 | 2025-03-01 | Passed |
| toll before discovery | 2019-05-06 | 2019-05-06 | Passed |
| one day toll | 2022-04-05 | 2022-04-05 | Passed |
| repose caps | 2020-01-15 | 2020-01-15 | Passed |
| repose with tolling beyond | 2022-07-01 | 2022-07-01 | Passed |
SHA-256 / c2414393c47cb015482af313c31cabcb4d7b44b0b6cf891cb757972dc18d72bb
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:25.851382+00:00.
Case digest / 25128591d8e88f7b6d9bf96e903ab89d5550cfc7282f8569a7fe384e9a4f3428