FA-77766 / Legal deadline computation / Open access
Return due date with automatic extension from the statutory date: due month offset · case 01
A partnership return is scheduled a month late.
ROOT CAUSE
Every entity uses the fourth-month due date.
VERIFIED REPAIR
At the due month offset decision use `3 if entity == 'partnership' else 4`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `3 if entity == 'corporation' else 4` swaps the entity types.
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), 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')],
[('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-04-15 | 2024-03-15 | Failed |
| partnership extension | 2024-10-15 | 2024-09-16 | Failed |
| 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 / bca80f0bff31fe5bb590037f0d9752c3734ff72dfe1c7ae08f607eb670315189
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 == 'corporation' 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')],
[('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-03-15 | 2023-10-16 | Failed |
| partnership calendar year | 2024-04-15 | 2024-03-15 | Failed |
| partnership extension | 2024-10-15 | 2024-09-16 | Failed |
| corporation june year | 2024-09-16 | 2024-10-15 | Failed |
| request on due date | 2024-03-15 | 2024-10-15 | Failed |
| late request | 2024-03-15 | 2024-04-15 | Failed |
| statutory on holiday | 2024-10-15 | 2024-10-15 | Passed |
SHA-256 / b4e890269d49529fbcd693d8b29b6b38f96de46bbb0b62b167976acf4f397f0d
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')],
[('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 / 16dad945bf61751cd88a06fd303b368a98f67cc3f8c50650549e08e1ee4971d4
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.700988+00:00.
Case digest / c7acac811b3051f844bb5cd07799fccb22d776203b04a30b062b5964f556a468