FA-77661 / Legal deadline computation / Open access
Court holiday calendar with observed dates: memorial rule · case 01
In years with five Mondays in May the memorial closure is a week early.
ROOT CAUSE
The last Monday of May is computed as the fourth Monday.
THE FAILURE
The last Monday of May is computed as the fourth Monday.
Unsuccessful approach: The partial repair `nth(5, 0, 4) if nth(5, 0, 4).day > 25 else nth(5, 0, 5)` uses the wrong day threshold to decide whether a fifth Monday exists.
Case contract
Stipulated court holidays for a year: new-year (Jan 1), mlk (3rd Monday Jan), memorial (last Monday May), juneteenth (Jun 19), independence (Jul 4), labor (1st Monday Sep), thanksgiving (4th Thursday Nov), day-after-thanksgiving, christmas (Dec 25). Fixed-date holidays on Saturday are observed the Friday before and on Sunday the Monday after. When next year's January 1 is a Saturday, a new-year-observed entry falls on December 31 of this year; an observed date that falls in another year is not part of this year's calendar. Return [[name, date]] sorted by date.
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(year):
def nth(month, wd, n):
first = dt.date(year, month, 1)
return first + dt.timedelta(days=(wd - first.weekday()) % 7 + 7 * (n - 1))
def last(month, wd):
lastd = dt.date(year, month, calendar.monthrange(year, month)[1])
return lastd - dt.timedelta(days=(lastd.weekday() - wd) % 7)
def observed(d):
return d - dt.timedelta(days=1) if d.weekday() == 5 else d + dt.timedelta(days=1) if d.weekday() == 6 else d
thanks = nth(11, 3, 4)
rows = [['new-year', observed(dt.date(year, 1, 1))], ['mlk', nth(1, 0, 3)], ['memorial', nth(5, 0, 4)],
['juneteenth', observed(dt.date(year, 6, 19))], ['independence', observed(dt.date(year, 7, 4))],
['labor', nth(9, 0, 1)], ['thanksgiving', thanks], ['day-after-thanksgiving', thanks + dt.timedelta(days=1)],
['christmas', observed(dt.date(year, 12, 25))]]
nxt = dt.date(year + 1, 1, 1)
if nxt.weekday() == 5:
rows.append(['new-year-observed', nxt - dt.timedelta(days=1)])
rows = [r for r in rows if r[1].year == year]
return [[name, d.isoformat()] for name, d in sorted(rows, key=lambda r: r[1])]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 2022 new year on saturday',
[2022],
[['mlk', '2022-01-17'],
['memorial', '2022-05-30'],
['juneteenth', '2022-06-20'],
['independence', '2022-07-04'],
['labor', '2022-09-05'],
['thanksgiving', '2022-11-24'],
['day-after-thanksgiving', '2022-11-25'],
['christmas', '2022-12-26']]),
('2021 next new year saturday',
[2021],
[['new-year', '2021-01-01'],
['mlk', '2021-01-18'],
['memorial', '2021-05-31'],
['juneteenth', '2021-06-18'],
['independence', '2021-07-05'],
['labor', '2021-09-06'],
['thanksgiving', '2021-11-25'],
['day-after-thanksgiving', '2021-11-26'],
['christmas', '2021-12-24'],
['new-year-observed', '2021-12-31']]),
('2024 leap',
[2024],
[['new-year', '2024-01-01'],
['mlk', '2024-01-15'],
['memorial', '2024-05-27'],
['juneteenth', '2024-06-19'],
['independence', '2024-07-04'],
['labor', '2024-09-02'],
['thanksgiving', '2024-11-28'],
['day-after-thanksgiving', '2024-11-29'],
['christmas', '2024-12-25']]),
('2019 november starts friday',
[2019],
[['new-year', '2019-01-01'],
['mlk', '2019-01-21'],
['memorial', '2019-05-27'],
['juneteenth', '2019-06-19'],
['independence', '2019-07-04'],
['labor', '2019-09-02'],
['thanksgiving', '2019-11-28'],
['day-after-thanksgiving', '2019-11-29'],
['christmas', '2019-12-25']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']]),
('2016 next new year sunday',
[2016],
[['new-year', '2016-01-01'],
['mlk', '2016-01-18'],
['memorial', '2016-05-30'],
['juneteenth', '2016-06-20'],
['independence', '2016-07-04'],
['labor', '2016-09-05'],
['thanksgiving', '2016-11-24'],
['day-after-thanksgiving', '2016-11-25'],
['christmas', '2016-12-26']]),
('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']])],
[('2024 leap',
[2024],
[['new-year', '2024-01-01'],
['mlk', '2024-01-15'],
['memorial', '2024-05-27'],
['juneteenth', '2024-06-19'],
['independence', '2024-07-04'],
['labor', '2024-09-02'],
['thanksgiving', '2024-11-28'],
['day-after-thanksgiving', '2024-11-29'],
['christmas', '2024-12-25']]),
('2019 november starts friday',
[2019],
[['new-year', '2019-01-01'],
['mlk', '2019-01-21'],
['memorial', '2019-05-27'],
['juneteenth', '2019-06-19'],
['independence', '2019-07-04'],
['labor', '2019-09-02'],
['thanksgiving', '2019-11-28'],
['day-after-thanksgiving', '2019-11-29'],
['christmas', '2019-12-25']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']]),
('2016 next new year sunday',
[2016],
[['new-year', '2016-01-01'],
['mlk', '2016-01-18'],
['memorial', '2016-05-30'],
['juneteenth', '2016-06-20'],
['independence', '2016-07-04'],
['labor', '2016-09-05'],
['thanksgiving', '2016-11-24'],
['day-after-thanksgiving', '2016-11-25'],
['christmas', '2016-12-26']]),
('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']]),
('2023',
[2023],
[['new-year', '2023-01-02'],
['mlk', '2023-01-16'],
['memorial', '2023-05-29'],
['juneteenth', '2023-06-19'],
['independence', '2023-07-04'],
['labor', '2023-09-04'],
['thanksgiving', '2023-11-23'],
['day-after-thanksgiving', '2023-11-24'],
['christmas', '2023-12-25']]),
('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']])],
[('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']]),
('2016 next new year sunday',
[2016],
[['new-year', '2016-01-01'],
['mlk', '2016-01-18'],
['memorial', '2016-05-30'],
['juneteenth', '2016-06-20'],
['independence', '2016-07-04'],
['labor', '2016-09-05'],
['thanksgiving', '2016-11-24'],
['day-after-thanksgiving', '2016-11-25'],
['christmas', '2016-12-26']]),
('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']]),
('2023',
[2023],
[['new-year', '2023-01-02'],
['mlk', '2023-01-16'],
['memorial', '2023-05-29'],
['juneteenth', '2023-06-19'],
['independence', '2023-07-04'],
['labor', '2023-09-04'],
['thanksgiving', '2023-11-23'],
['day-after-thanksgiving', '2023-11-24'],
['christmas', '2023-12-25']]),
('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']]),
('2032 leap',
[2032],
[['new-year', '2032-01-01'],
['mlk', '2032-01-19'],
['memorial', '2032-05-31'],
['juneteenth', '2032-06-18'],
['independence', '2032-07-05'],
['labor', '2032-09-06'],
['thanksgiving', '2032-11-25'],
['day-after-thanksgiving', '2032-11-26'],
['christmas', '2032-12-24'],
['new-year-observed', '2032-12-31']]),
('2033 new year saturday',
[2033],
[['mlk', '2033-01-17'],
['memorial', '2033-05-30'],
['juneteenth', '2033-06-20'],
['independence', '2033-07-04'],
['labor', '2033-09-05'],
['thanksgiving', '2033-11-24'],
['day-after-thanksgiving', '2033-11-25'],
['christmas', '2033-12-26']])],
[('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']]),
('2023',
[2023],
[['new-year', '2023-01-02'],
['mlk', '2023-01-16'],
['memorial', '2023-05-29'],
['juneteenth', '2023-06-19'],
['independence', '2023-07-04'],
['labor', '2023-09-04'],
['thanksgiving', '2023-11-23'],
['day-after-thanksgiving', '2023-11-24'],
['christmas', '2023-12-25']]),
('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']]),
('2032 leap',
[2032],
[['new-year', '2032-01-01'],
['mlk', '2032-01-19'],
['memorial', '2032-05-31'],
['juneteenth', '2032-06-18'],
['independence', '2032-07-05'],
['labor', '2032-09-06'],
['thanksgiving', '2032-11-25'],
['day-after-thanksgiving', '2032-11-26'],
['christmas', '2032-12-24'],
['new-year-observed', '2032-12-31']]),
('2033 new year saturday',
[2033],
[['mlk', '2033-01-17'],
['memorial', '2033-05-30'],
['juneteenth', '2033-06-20'],
['independence', '2033-07-04'],
['labor', '2033-09-05'],
['thanksgiving', '2033-11-24'],
['day-after-thanksgiving', '2033-11-25'],
['christmas', '2033-12-26']]),
('regression: 2022 new year on saturday',
[2022],
[['mlk', '2022-01-17'],
['memorial', '2022-05-30'],
['juneteenth', '2022-06-20'],
['independence', '2022-07-04'],
['labor', '2022-09-05'],
['thanksgiving', '2022-11-24'],
['day-after-thanksgiving', '2022-11-25'],
['christmas', '2022-12-26']]),
('2021 next new year saturday',
[2021],
[['new-year', '2021-01-01'],
['mlk', '2021-01-18'],
['memorial', '2021-05-31'],
['juneteenth', '2021-06-18'],
['independence', '2021-07-05'],
['labor', '2021-09-06'],
['thanksgiving', '2021-11-25'],
['day-after-thanksgiving', '2021-11-26'],
['christmas', '2021-12-24'],
['new-year-observed', '2021-12-31']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']])],
[('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']]),
('2032 leap',
[2032],
[['new-year', '2032-01-01'],
['mlk', '2032-01-19'],
['memorial', '2032-05-31'],
['juneteenth', '2032-06-18'],
['independence', '2032-07-05'],
['labor', '2032-09-06'],
['thanksgiving', '2032-11-25'],
['day-after-thanksgiving', '2032-11-26'],
['christmas', '2032-12-24'],
['new-year-observed', '2032-12-31']]),
('2033 new year saturday',
[2033],
[['mlk', '2033-01-17'],
['memorial', '2033-05-30'],
['juneteenth', '2033-06-20'],
['independence', '2033-07-04'],
['labor', '2033-09-05'],
['thanksgiving', '2033-11-24'],
['day-after-thanksgiving', '2033-11-25'],
['christmas', '2033-12-26']]),
('regression: 2022 new year on saturday',
[2022],
[['mlk', '2022-01-17'],
['memorial', '2022-05-30'],
['juneteenth', '2022-06-20'],
['independence', '2022-07-04'],
['labor', '2022-09-05'],
['thanksgiving', '2022-11-24'],
['day-after-thanksgiving', '2022-11-25'],
['christmas', '2022-12-26']]),
('2021 next new year saturday',
[2021],
[['new-year', '2021-01-01'],
['mlk', '2021-01-18'],
['memorial', '2021-05-31'],
['juneteenth', '2021-06-18'],
['independence', '2021-07-05'],
['labor', '2021-09-06'],
['thanksgiving', '2021-11-25'],
['day-after-thanksgiving', '2021-11-26'],
['christmas', '2021-12-24'],
['new-year-observed', '2021-12-31']]),
('2024 leap',
[2024],
[['new-year', '2024-01-01'],
['mlk', '2024-01-15'],
['memorial', '2024-05-27'],
['juneteenth', '2024-06-19'],
['independence', '2024-07-04'],
['labor', '2024-09-02'],
['thanksgiving', '2024-11-28'],
['day-after-thanksgiving', '2024-11-29'],
['christmas', '2024-12-25']]),
('2019 november starts friday',
[2019],
[['new-year', '2019-01-01'],
['mlk', '2019-01-21'],
['memorial', '2019-05-27'],
['juneteenth', '2019-06-19'],
['independence', '2019-07-04'],
['labor', '2019-09-02'],
['thanksgiving', '2019-11-28'],
['day-after-thanksgiving', '2019-11-29'],
['christmas', '2019-12-25']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']])]]
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: 2022 new year on saturday | [['mlk', '2022-01-17'], ['memorial', '2022-05-23'], ['juneteenth', '2022-06-20'], ['independence', '2022-07-04'], ['labor', '2022-09-05'], ['thanksgiving', '2022-11-24'], ['day-after-thanksgiving', '2022-11-25'], ['christmas', '2022-12-26']] | [['mlk', '2022-01-17'], ['memorial', '2022-05-30'], ['juneteenth', '2022-06-20'], ['independence', '2022-07-04'], ['labor', '2022-09-05'], ['thanksgiving', '2022-11-24'], ['day-after-thanksgiving', '2022-11-25'], ['christmas', '2022-12-26']] | Failed |
| 2021 next new year saturday | [['new-year', '2021-01-01'], ['mlk', '2021-01-18'], ['memorial', '2021-05-24'], ['juneteenth', '2021-06-18'], ['independence', '2021-07-05'], ['labor', '2021-09-06'], ['thanksgiving', '2021-11-25'], ['day-after-thanksgiving', '2021-11-26'], ['christmas', '2021-12-24'], ['new-year-observed', '2021-12-31']] | [['new-year', '2021-01-01'], ['mlk', '2021-01-18'], ['memorial', '2021-05-31'], ['juneteenth', '2021-06-18'], ['independence', '2021-07-05'], ['labor', '2021-09-06'], ['thanksgiving', '2021-11-25'], ['day-after-thanksgiving', '2021-11-26'], ['christmas', '2021-12-24'], ['new-year-observed', '2021-12-31']] | Failed |
| 2024 leap | [['new-year', '2024-01-01'], ['mlk', '2024-01-15'], ['memorial', '2024-05-27'], ['juneteenth', '2024-06-19'], ['independence', '2024-07-04'], ['labor', '2024-09-02'], ['thanksgiving', '2024-11-28'], ['day-after-thanksgiving', '2024-11-29'], ['christmas', '2024-12-25']] | [['new-year', '2024-01-01'], ['mlk', '2024-01-15'], ['memorial', '2024-05-27'], ['juneteenth', '2024-06-19'], ['independence', '2024-07-04'], ['labor', '2024-09-02'], ['thanksgiving', '2024-11-28'], ['day-after-thanksgiving', '2024-11-29'], ['christmas', '2024-12-25']] | Passed |
| 2019 november starts friday | [['new-year', '2019-01-01'], ['mlk', '2019-01-21'], ['memorial', '2019-05-27'], ['juneteenth', '2019-06-19'], ['independence', '2019-07-04'], ['labor', '2019-09-02'], ['thanksgiving', '2019-11-28'], ['day-after-thanksgiving', '2019-11-29'], ['christmas', '2019-12-25']] | [['new-year', '2019-01-01'], ['mlk', '2019-01-21'], ['memorial', '2019-05-27'], ['juneteenth', '2019-06-19'], ['independence', '2019-07-04'], ['labor', '2019-09-02'], ['thanksgiving', '2019-11-28'], ['day-after-thanksgiving', '2019-11-29'], ['christmas', '2019-12-25']] | Passed |
| 2020 july 4 saturday | [['new-year', '2020-01-01'], ['mlk', '2020-01-20'], ['memorial', '2020-05-25'], ['juneteenth', '2020-06-19'], ['independence', '2020-07-03'], ['labor', '2020-09-07'], ['thanksgiving', '2020-11-26'], ['day-after-thanksgiving', '2020-11-27'], ['christmas', '2020-12-25']] | [['new-year', '2020-01-01'], ['mlk', '2020-01-20'], ['memorial', '2020-05-25'], ['juneteenth', '2020-06-19'], ['independence', '2020-07-03'], ['labor', '2020-09-07'], ['thanksgiving', '2020-11-26'], ['day-after-thanksgiving', '2020-11-27'], ['christmas', '2020-12-25']] | Passed |
| 2016 next new year sunday | [['new-year', '2016-01-01'], ['mlk', '2016-01-18'], ['memorial', '2016-05-23'], ['juneteenth', '2016-06-20'], ['independence', '2016-07-04'], ['labor', '2016-09-05'], ['thanksgiving', '2016-11-24'], ['day-after-thanksgiving', '2016-11-25'], ['christmas', '2016-12-26']] | [['new-year', '2016-01-01'], ['mlk', '2016-01-18'], ['memorial', '2016-05-30'], ['juneteenth', '2016-06-20'], ['independence', '2016-07-04'], ['labor', '2016-09-05'], ['thanksgiving', '2016-11-24'], ['day-after-thanksgiving', '2016-11-25'], ['christmas', '2016-12-26']] | Failed |
| 2027 five mondays may | [['new-year', '2027-01-01'], ['mlk', '2027-01-18'], ['memorial', '2027-05-24'], ['juneteenth', '2027-06-18'], ['independence', '2027-07-05'], ['labor', '2027-09-06'], ['thanksgiving', '2027-11-25'], ['day-after-thanksgiving', '2027-11-26'], ['christmas', '2027-12-24'], ['new-year-observed', '2027-12-31']] | [['new-year', '2027-01-01'], ['mlk', '2027-01-18'], ['memorial', '2027-05-31'], ['juneteenth', '2027-06-18'], ['independence', '2027-07-05'], ['labor', '2027-09-06'], ['thanksgiving', '2027-11-25'], ['day-after-thanksgiving', '2027-11-26'], ['christmas', '2027-12-24'], ['new-year-observed', '2027-12-31']] | Failed |
SHA-256 / bb16cb7055785bff7f6eba8129957921b391f2a796b6c966d466386173c2bfef
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(year):
def nth(month, wd, n):
first = dt.date(year, month, 1)
return first + dt.timedelta(days=(wd - first.weekday()) % 7 + 7 * (n - 1))
def last(month, wd):
lastd = dt.date(year, month, calendar.monthrange(year, month)[1])
return lastd - dt.timedelta(days=(lastd.weekday() - wd) % 7)
def observed(d):
return d - dt.timedelta(days=1) if d.weekday() == 5 else d + dt.timedelta(days=1) if d.weekday() == 6 else d
thanks = nth(11, 3, 4)
rows = [['new-year', observed(dt.date(year, 1, 1))], ['mlk', nth(1, 0, 3)], ['memorial', nth(5, 0, 4) if nth(5, 0, 4).day > 25 else nth(5, 0, 5)],
['juneteenth', observed(dt.date(year, 6, 19))], ['independence', observed(dt.date(year, 7, 4))],
['labor', nth(9, 0, 1)], ['thanksgiving', thanks], ['day-after-thanksgiving', thanks + dt.timedelta(days=1)],
['christmas', observed(dt.date(year, 12, 25))]]
nxt = dt.date(year + 1, 1, 1)
if nxt.weekday() == 5:
rows.append(['new-year-observed', nxt - dt.timedelta(days=1)])
rows = [r for r in rows if r[1].year == year]
return [[name, d.isoformat()] for name, d in sorted(rows, key=lambda r: r[1])]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: 2022 new year on saturday',
[2022],
[['mlk', '2022-01-17'],
['memorial', '2022-05-30'],
['juneteenth', '2022-06-20'],
['independence', '2022-07-04'],
['labor', '2022-09-05'],
['thanksgiving', '2022-11-24'],
['day-after-thanksgiving', '2022-11-25'],
['christmas', '2022-12-26']]),
('2021 next new year saturday',
[2021],
[['new-year', '2021-01-01'],
['mlk', '2021-01-18'],
['memorial', '2021-05-31'],
['juneteenth', '2021-06-18'],
['independence', '2021-07-05'],
['labor', '2021-09-06'],
['thanksgiving', '2021-11-25'],
['day-after-thanksgiving', '2021-11-26'],
['christmas', '2021-12-24'],
['new-year-observed', '2021-12-31']]),
('2024 leap',
[2024],
[['new-year', '2024-01-01'],
['mlk', '2024-01-15'],
['memorial', '2024-05-27'],
['juneteenth', '2024-06-19'],
['independence', '2024-07-04'],
['labor', '2024-09-02'],
['thanksgiving', '2024-11-28'],
['day-after-thanksgiving', '2024-11-29'],
['christmas', '2024-12-25']]),
('2019 november starts friday',
[2019],
[['new-year', '2019-01-01'],
['mlk', '2019-01-21'],
['memorial', '2019-05-27'],
['juneteenth', '2019-06-19'],
['independence', '2019-07-04'],
['labor', '2019-09-02'],
['thanksgiving', '2019-11-28'],
['day-after-thanksgiving', '2019-11-29'],
['christmas', '2019-12-25']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']]),
('2016 next new year sunday',
[2016],
[['new-year', '2016-01-01'],
['mlk', '2016-01-18'],
['memorial', '2016-05-30'],
['juneteenth', '2016-06-20'],
['independence', '2016-07-04'],
['labor', '2016-09-05'],
['thanksgiving', '2016-11-24'],
['day-after-thanksgiving', '2016-11-25'],
['christmas', '2016-12-26']]),
('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']])],
[('2024 leap',
[2024],
[['new-year', '2024-01-01'],
['mlk', '2024-01-15'],
['memorial', '2024-05-27'],
['juneteenth', '2024-06-19'],
['independence', '2024-07-04'],
['labor', '2024-09-02'],
['thanksgiving', '2024-11-28'],
['day-after-thanksgiving', '2024-11-29'],
['christmas', '2024-12-25']]),
('2019 november starts friday',
[2019],
[['new-year', '2019-01-01'],
['mlk', '2019-01-21'],
['memorial', '2019-05-27'],
['juneteenth', '2019-06-19'],
['independence', '2019-07-04'],
['labor', '2019-09-02'],
['thanksgiving', '2019-11-28'],
['day-after-thanksgiving', '2019-11-29'],
['christmas', '2019-12-25']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']]),
('2016 next new year sunday',
[2016],
[['new-year', '2016-01-01'],
['mlk', '2016-01-18'],
['memorial', '2016-05-30'],
['juneteenth', '2016-06-20'],
['independence', '2016-07-04'],
['labor', '2016-09-05'],
['thanksgiving', '2016-11-24'],
['day-after-thanksgiving', '2016-11-25'],
['christmas', '2016-12-26']]),
('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']]),
('2023',
[2023],
[['new-year', '2023-01-02'],
['mlk', '2023-01-16'],
['memorial', '2023-05-29'],
['juneteenth', '2023-06-19'],
['independence', '2023-07-04'],
['labor', '2023-09-04'],
['thanksgiving', '2023-11-23'],
['day-after-thanksgiving', '2023-11-24'],
['christmas', '2023-12-25']]),
('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']])],
[('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']]),
('2016 next new year sunday',
[2016],
[['new-year', '2016-01-01'],
['mlk', '2016-01-18'],
['memorial', '2016-05-30'],
['juneteenth', '2016-06-20'],
['independence', '2016-07-04'],
['labor', '2016-09-05'],
['thanksgiving', '2016-11-24'],
['day-after-thanksgiving', '2016-11-25'],
['christmas', '2016-12-26']]),
('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']]),
('2023',
[2023],
[['new-year', '2023-01-02'],
['mlk', '2023-01-16'],
['memorial', '2023-05-29'],
['juneteenth', '2023-06-19'],
['independence', '2023-07-04'],
['labor', '2023-09-04'],
['thanksgiving', '2023-11-23'],
['day-after-thanksgiving', '2023-11-24'],
['christmas', '2023-12-25']]),
('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']]),
('2032 leap',
[2032],
[['new-year', '2032-01-01'],
['mlk', '2032-01-19'],
['memorial', '2032-05-31'],
['juneteenth', '2032-06-18'],
['independence', '2032-07-05'],
['labor', '2032-09-06'],
['thanksgiving', '2032-11-25'],
['day-after-thanksgiving', '2032-11-26'],
['christmas', '2032-12-24'],
['new-year-observed', '2032-12-31']]),
('2033 new year saturday',
[2033],
[['mlk', '2033-01-17'],
['memorial', '2033-05-30'],
['juneteenth', '2033-06-20'],
['independence', '2033-07-04'],
['labor', '2033-09-05'],
['thanksgiving', '2033-11-24'],
['day-after-thanksgiving', '2033-11-25'],
['christmas', '2033-12-26']])],
[('2027 five mondays may',
[2027],
[['new-year', '2027-01-01'],
['mlk', '2027-01-18'],
['memorial', '2027-05-31'],
['juneteenth', '2027-06-18'],
['independence', '2027-07-05'],
['labor', '2027-09-06'],
['thanksgiving', '2027-11-25'],
['day-after-thanksgiving', '2027-11-26'],
['christmas', '2027-12-24'],
['new-year-observed', '2027-12-31']]),
('2023',
[2023],
[['new-year', '2023-01-02'],
['mlk', '2023-01-16'],
['memorial', '2023-05-29'],
['juneteenth', '2023-06-19'],
['independence', '2023-07-04'],
['labor', '2023-09-04'],
['thanksgiving', '2023-11-23'],
['day-after-thanksgiving', '2023-11-24'],
['christmas', '2023-12-25']]),
('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']]),
('2032 leap',
[2032],
[['new-year', '2032-01-01'],
['mlk', '2032-01-19'],
['memorial', '2032-05-31'],
['juneteenth', '2032-06-18'],
['independence', '2032-07-05'],
['labor', '2032-09-06'],
['thanksgiving', '2032-11-25'],
['day-after-thanksgiving', '2032-11-26'],
['christmas', '2032-12-24'],
['new-year-observed', '2032-12-31']]),
('2033 new year saturday',
[2033],
[['mlk', '2033-01-17'],
['memorial', '2033-05-30'],
['juneteenth', '2033-06-20'],
['independence', '2033-07-04'],
['labor', '2033-09-05'],
['thanksgiving', '2033-11-24'],
['day-after-thanksgiving', '2033-11-25'],
['christmas', '2033-12-26']]),
('regression: 2022 new year on saturday',
[2022],
[['mlk', '2022-01-17'],
['memorial', '2022-05-30'],
['juneteenth', '2022-06-20'],
['independence', '2022-07-04'],
['labor', '2022-09-05'],
['thanksgiving', '2022-11-24'],
['day-after-thanksgiving', '2022-11-25'],
['christmas', '2022-12-26']]),
('2021 next new year saturday',
[2021],
[['new-year', '2021-01-01'],
['mlk', '2021-01-18'],
['memorial', '2021-05-31'],
['juneteenth', '2021-06-18'],
['independence', '2021-07-05'],
['labor', '2021-09-06'],
['thanksgiving', '2021-11-25'],
['day-after-thanksgiving', '2021-11-26'],
['christmas', '2021-12-24'],
['new-year-observed', '2021-12-31']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']])],
[('2030',
[2030],
[['new-year', '2030-01-01'],
['mlk', '2030-01-21'],
['memorial', '2030-05-27'],
['juneteenth', '2030-06-19'],
['independence', '2030-07-04'],
['labor', '2030-09-02'],
['thanksgiving', '2030-11-28'],
['day-after-thanksgiving', '2030-11-29'],
['christmas', '2030-12-25']]),
('2032 leap',
[2032],
[['new-year', '2032-01-01'],
['mlk', '2032-01-19'],
['memorial', '2032-05-31'],
['juneteenth', '2032-06-18'],
['independence', '2032-07-05'],
['labor', '2032-09-06'],
['thanksgiving', '2032-11-25'],
['day-after-thanksgiving', '2032-11-26'],
['christmas', '2032-12-24'],
['new-year-observed', '2032-12-31']]),
('2033 new year saturday',
[2033],
[['mlk', '2033-01-17'],
['memorial', '2033-05-30'],
['juneteenth', '2033-06-20'],
['independence', '2033-07-04'],
['labor', '2033-09-05'],
['thanksgiving', '2033-11-24'],
['day-after-thanksgiving', '2033-11-25'],
['christmas', '2033-12-26']]),
('regression: 2022 new year on saturday',
[2022],
[['mlk', '2022-01-17'],
['memorial', '2022-05-30'],
['juneteenth', '2022-06-20'],
['independence', '2022-07-04'],
['labor', '2022-09-05'],
['thanksgiving', '2022-11-24'],
['day-after-thanksgiving', '2022-11-25'],
['christmas', '2022-12-26']]),
('2021 next new year saturday',
[2021],
[['new-year', '2021-01-01'],
['mlk', '2021-01-18'],
['memorial', '2021-05-31'],
['juneteenth', '2021-06-18'],
['independence', '2021-07-05'],
['labor', '2021-09-06'],
['thanksgiving', '2021-11-25'],
['day-after-thanksgiving', '2021-11-26'],
['christmas', '2021-12-24'],
['new-year-observed', '2021-12-31']]),
('2024 leap',
[2024],
[['new-year', '2024-01-01'],
['mlk', '2024-01-15'],
['memorial', '2024-05-27'],
['juneteenth', '2024-06-19'],
['independence', '2024-07-04'],
['labor', '2024-09-02'],
['thanksgiving', '2024-11-28'],
['day-after-thanksgiving', '2024-11-29'],
['christmas', '2024-12-25']]),
('2019 november starts friday',
[2019],
[['new-year', '2019-01-01'],
['mlk', '2019-01-21'],
['memorial', '2019-05-27'],
['juneteenth', '2019-06-19'],
['independence', '2019-07-04'],
['labor', '2019-09-02'],
['thanksgiving', '2019-11-28'],
['day-after-thanksgiving', '2019-11-29'],
['christmas', '2019-12-25']]),
('2020 july 4 saturday',
[2020],
[['new-year', '2020-01-01'],
['mlk', '2020-01-20'],
['memorial', '2020-05-25'],
['juneteenth', '2020-06-19'],
['independence', '2020-07-03'],
['labor', '2020-09-07'],
['thanksgiving', '2020-11-26'],
['day-after-thanksgiving', '2020-11-27'],
['christmas', '2020-12-25']])]]
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: 2022 new year on saturday | [['mlk', '2022-01-17'], ['memorial', '2022-05-30'], ['juneteenth', '2022-06-20'], ['independence', '2022-07-04'], ['labor', '2022-09-05'], ['thanksgiving', '2022-11-24'], ['day-after-thanksgiving', '2022-11-25'], ['christmas', '2022-12-26']] | [['mlk', '2022-01-17'], ['memorial', '2022-05-30'], ['juneteenth', '2022-06-20'], ['independence', '2022-07-04'], ['labor', '2022-09-05'], ['thanksgiving', '2022-11-24'], ['day-after-thanksgiving', '2022-11-25'], ['christmas', '2022-12-26']] | Passed |
| 2021 next new year saturday | [['new-year', '2021-01-01'], ['mlk', '2021-01-18'], ['memorial', '2021-05-31'], ['juneteenth', '2021-06-18'], ['independence', '2021-07-05'], ['labor', '2021-09-06'], ['thanksgiving', '2021-11-25'], ['day-after-thanksgiving', '2021-11-26'], ['christmas', '2021-12-24'], ['new-year-observed', '2021-12-31']] | [['new-year', '2021-01-01'], ['mlk', '2021-01-18'], ['memorial', '2021-05-31'], ['juneteenth', '2021-06-18'], ['independence', '2021-07-05'], ['labor', '2021-09-06'], ['thanksgiving', '2021-11-25'], ['day-after-thanksgiving', '2021-11-26'], ['christmas', '2021-12-24'], ['new-year-observed', '2021-12-31']] | Passed |
| 2024 leap | [['new-year', '2024-01-01'], ['mlk', '2024-01-15'], ['memorial', '2024-05-27'], ['juneteenth', '2024-06-19'], ['independence', '2024-07-04'], ['labor', '2024-09-02'], ['thanksgiving', '2024-11-28'], ['day-after-thanksgiving', '2024-11-29'], ['christmas', '2024-12-25']] | [['new-year', '2024-01-01'], ['mlk', '2024-01-15'], ['memorial', '2024-05-27'], ['juneteenth', '2024-06-19'], ['independence', '2024-07-04'], ['labor', '2024-09-02'], ['thanksgiving', '2024-11-28'], ['day-after-thanksgiving', '2024-11-29'], ['christmas', '2024-12-25']] | Passed |
| 2019 november starts friday | [['new-year', '2019-01-01'], ['mlk', '2019-01-21'], ['memorial', '2019-05-27'], ['juneteenth', '2019-06-19'], ['independence', '2019-07-04'], ['labor', '2019-09-02'], ['thanksgiving', '2019-11-28'], ['day-after-thanksgiving', '2019-11-29'], ['christmas', '2019-12-25']] | [['new-year', '2019-01-01'], ['mlk', '2019-01-21'], ['memorial', '2019-05-27'], ['juneteenth', '2019-06-19'], ['independence', '2019-07-04'], ['labor', '2019-09-02'], ['thanksgiving', '2019-11-28'], ['day-after-thanksgiving', '2019-11-29'], ['christmas', '2019-12-25']] | Passed |
| 2020 july 4 saturday | [['new-year', '2020-01-01'], ['mlk', '2020-01-20'], ['memorial', '2020-06-01'], ['juneteenth', '2020-06-19'], ['independence', '2020-07-03'], ['labor', '2020-09-07'], ['thanksgiving', '2020-11-26'], ['day-after-thanksgiving', '2020-11-27'], ['christmas', '2020-12-25']] | [['new-year', '2020-01-01'], ['mlk', '2020-01-20'], ['memorial', '2020-05-25'], ['juneteenth', '2020-06-19'], ['independence', '2020-07-03'], ['labor', '2020-09-07'], ['thanksgiving', '2020-11-26'], ['day-after-thanksgiving', '2020-11-27'], ['christmas', '2020-12-25']] | Failed |
| 2016 next new year sunday | [['new-year', '2016-01-01'], ['mlk', '2016-01-18'], ['memorial', '2016-05-30'], ['juneteenth', '2016-06-20'], ['independence', '2016-07-04'], ['labor', '2016-09-05'], ['thanksgiving', '2016-11-24'], ['day-after-thanksgiving', '2016-11-25'], ['christmas', '2016-12-26']] | [['new-year', '2016-01-01'], ['mlk', '2016-01-18'], ['memorial', '2016-05-30'], ['juneteenth', '2016-06-20'], ['independence', '2016-07-04'], ['labor', '2016-09-05'], ['thanksgiving', '2016-11-24'], ['day-after-thanksgiving', '2016-11-25'], ['christmas', '2016-12-26']] | Passed |
| 2027 five mondays may | [['new-year', '2027-01-01'], ['mlk', '2027-01-18'], ['memorial', '2027-05-31'], ['juneteenth', '2027-06-18'], ['independence', '2027-07-05'], ['labor', '2027-09-06'], ['thanksgiving', '2027-11-25'], ['day-after-thanksgiving', '2027-11-26'], ['christmas', '2027-12-24'], ['new-year-observed', '2027-12-31']] | [['new-year', '2027-01-01'], ['mlk', '2027-01-18'], ['memorial', '2027-05-31'], ['juneteenth', '2027-06-18'], ['independence', '2027-07-05'], ['labor', '2027-09-06'], ['thanksgiving', '2027-11-25'], ['day-after-thanksgiving', '2027-11-26'], ['christmas', '2027-12-24'], ['new-year-observed', '2027-12-31']] | Passed |
SHA-256 / 9e0a4218660cfde96a433633626c45013ddfcd9df11917c408ce82a92cd71b8d
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:27.799932+00:00.
Case digest / 8db1c0ceb2d13d2e8c73f887073bbb2264310e8def011fdd7f9776b25e37b049