FA-77771 / Legal deadline computation / Open access
Return due date with automatic extension from the statutory date: request timely · case 01
An extension requested on the Monday after a weekend statutory date is rejected.
ROOT CAUSE
Request timeliness is tested against the unmoved statutory date.
VERIFIED REPAIR
At the request timely decision use `dt.date.fromisoformat(requested) <= due`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `dt.date.fromisoformat(requested) < due` rejects a request filed on the due date itself.
Case contract
Stipulated: a return for a fiscal year ending fy_end (month end) is due on the 15th day of the 3rd month after year end for a partnership and the 4th month for other entities. A statutory date on a weekend or listed holiday moves to the next open day. An extension request filed on or before that (moved) due date extends the due date to 6 months after the statutory (unmoved) date, again moved forward if closed.
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(fy_end, entity, requested, holidays):
e = dt.date.fromisoformat(fy_end)
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
def plus_months(d, k):
mi = d.month - 1 + k
return dt.date(d.year + mi // 12, mi % 12 + 1, d.day)
statutory = plus_months(dt.date(e.year, e.month, 15), 3 if entity == 'partnership' else 4)
due = roll(statutory)
if requested is not None and dt.date.fromisoformat(requested) <= statutory:
due = roll(plus_months(statutory, 6))
return due.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15')],
[('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16')],
[('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')],
[('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')],
[('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')]]
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: statutory saturday, extension | 2023-04-17 | 2023-10-16 | Failed |
| partnership calendar year | 2024-03-15 | 2024-03-15 | Passed |
| partnership extension | 2024-09-16 | 2024-09-16 | Passed |
| corporation june year | 2024-10-15 | 2024-10-15 | Passed |
| request on due date | 2024-10-15 | 2024-10-15 | Passed |
| late request | 2024-04-15 | 2024-04-15 | Passed |
| statutory on holiday | 2024-10-15 | 2024-10-15 | Passed |
SHA-256 / d23b41b0b6f14659e182e883e99f143d69fe3a082ae1ca784f81a7012b86dc08
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(fy_end, entity, requested, holidays):
e = dt.date.fromisoformat(fy_end)
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
def plus_months(d, k):
mi = d.month - 1 + k
return dt.date(d.year + mi // 12, mi % 12 + 1, d.day)
statutory = plus_months(dt.date(e.year, e.month, 15), 3 if entity == 'partnership' else 4)
due = roll(statutory)
if requested is not None and dt.date.fromisoformat(requested) < due:
due = roll(plus_months(statutory, 6))
return due.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15')],
[('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16')],
[('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')],
[('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')],
[('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')]]
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: statutory saturday, extension | 2023-04-17 | 2023-10-16 | Failed |
| partnership calendar year | 2024-03-15 | 2024-03-15 | Passed |
| partnership extension | 2024-03-15 | 2024-09-16 | Failed |
| corporation june year | 2024-10-15 | 2024-10-15 | Passed |
| request on due date | 2024-04-15 | 2024-10-15 | Failed |
| late request | 2024-04-15 | 2024-04-15 | Passed |
| statutory on holiday | 2024-10-15 | 2024-10-15 | Passed |
SHA-256 / b8db26afa81745b4abdaf53632f300851eab47351b4049ed053eaea994770fcd
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(fy_end, entity, requested, holidays):
e = dt.date.fromisoformat(fy_end)
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
def plus_months(d, k):
mi = d.month - 1 + k
return dt.date(d.year + mi // 12, mi % 12 + 1, d.day)
statutory = plus_months(dt.date(e.year, e.month, 15), 3 if entity == 'partnership' else 4)
due = roll(statutory)
if requested is not None and dt.date.fromisoformat(requested) <= due:
due = roll(plus_months(statutory, 6))
return due.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15')],
[('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16')],
[('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')],
[('statutory on holiday',
['2023-12-31',
'individual',
'2024-04-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-04-15']],
'2024-10-15'),
('march fiscal year corporation',
['2024-03-31',
'corporation',
'2024-07-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']],
'2025-01-15'),
('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')],
[('september fiscal partnership',
['2023-09-30',
'partnership',
'2023-12-15',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25',
'2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-17'),
('regression: statutory saturday, extension',
['2022-12-31',
'corporation',
'2023-04-17',
['2023-01-02',
'2023-01-16',
'2023-02-20',
'2023-05-29',
'2023-06-19',
'2023-07-04',
'2023-09-04',
'2023-10-09',
'2023-11-10',
'2023-11-23',
'2023-12-25']],
'2023-10-16'),
('partnership calendar year',
['2023-12-31',
'partnership',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('partnership extension',
['2023-12-31',
'partnership',
'2024-03-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']],
'2024-09-16'),
('corporation june year',
['2024-06-30',
'corporation',
None,
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15'),
('request on due date',
['2023-12-31',
'corporation',
'2024-04-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']],
'2024-10-15'),
('late request',
['2023-12-31',
'corporation',
'2024-04-16',
['2024-01-01',
'2024-01-15',
'2024-02-19',
'2024-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-15')]]
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: statutory saturday, extension | 2023-10-16 | 2023-10-16 | Passed |
| partnership calendar year | 2024-03-15 | 2024-03-15 | Passed |
| partnership extension | 2024-09-16 | 2024-09-16 | Passed |
| corporation june year | 2024-10-15 | 2024-10-15 | Passed |
| request on due date | 2024-10-15 | 2024-10-15 | Passed |
| late request | 2024-04-15 | 2024-04-15 | Passed |
| statutory on holiday | 2024-10-15 | 2024-10-15 | Passed |
SHA-256 / e03db22abcb5d26a86feaca607f30a9f5b994e3a05282f018b95ea0b7449fb8b
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.700873+00:00.
Case digest / 6358b9348be2eaa0a7e833ce1f45abee65a30cce7c65ec1125821d694592ecca