FAILURE MAP
← Case archive

FA-77366 / Legal deadline computation / Open access

Short periods counted in court days with observed holidays: observed shift · case 01

A July 4 falling on Sunday does not close the court on Monday July 5.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Holidays are applied on their nominal date only, never on the observed weekday.

VERIFIED REPAIR

At the observed shift decision use `x - dt.timedelta(days=1) if x.weekday() == 5 else x + dt.timedelta(days=1) if x.weekday() == 6 else x`, leaving the other decision sites of the model unchanged.

Unsuccessful approach: The partial repair `x + dt.timedelta(days=(7 - x.weekday()) % 7) if x.weekday() >= 5 else x` moves Saturday holidays to Monday instead of the preceding Friday.

Case contract

Stipulated legacy rule: a period of fewer than 11 days excludes intermediate Saturdays, Sundays and holidays; longer periods count every calendar day. The trigger day is excluded, and for any period a last day that is closed rolls forward to the next open day. Holidays are listed by nominal date; a holiday on Saturday is observed the preceding Friday and one on Sunday the following Monday.

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(trigger, days, holidays):
    t = dt.date.fromisoformat(trigger)
    hol = set()
    for h in holidays:
        x = dt.date.fromisoformat(h)
        hol.add(x)
    def closed(d):
        return d.weekday() >= 5 or d in hol
    short = days < 11
    d = t
    n = 0
    while n < days:
        d += dt.timedelta(days=1)
        if short and closed(d):
            continue
        n += 1
    while closed(d):
        d += dt.timedelta(days=1)
    return d.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: observed monday holiday', ['2021-06-28', 7, ['2021-07-04']], '2021-07-08'),
  ('saturday holiday observed friday', ['2020-06-29', 5, ['2020-07-04']], '2020-07-07'),
  ('eleven day period',
   ['2024-01-02',
    11,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-01-16'),
  ('ten day period',
   ['2024-01-02',
    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-01-17'),
  ('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06')],
 [('eleven day period',
   ['2024-01-02',
    11,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-01-16'),
  ('ten day period',
   ['2024-01-02',
    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-01-17'),
  ('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06')],
 [('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06')],
 [('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06')],
 [('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06'),
  ('regression: observed monday holiday', ['2021-06-28', 7, ['2021-07-04']], '2021-07-08'),
  ('saturday holiday observed friday', ['2020-06-29', 5, ['2020-07-04']], '2020-07-07')]]
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 fixtureActualExpectedOutcome
regression: observed monday holiday2021-07-072021-07-08Failed
saturday holiday observed friday2020-07-062020-07-07Failed
eleven day period2024-01-162024-01-16Passed
ten day period2024-01-172024-01-17Passed
short spanning holiday2024-06-032024-06-03Passed
long ends sunday2024-03-042024-03-04Passed
long ends on holiday2024-05-282024-05-28Passed
short ends on observed friday2020-07-032020-07-06Failed

SHA-256 / 79ff21100f93f8d1bc13efc86e15eefc092d4c48b39605d2bcd58614b3d66cfc

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(trigger, days, holidays):
    t = dt.date.fromisoformat(trigger)
    hol = set()
    for h in holidays:
        x = dt.date.fromisoformat(h)
        hol.add(x + dt.timedelta(days=(7 - x.weekday()) % 7) if x.weekday() >= 5 else x)
    def closed(d):
        return d.weekday() >= 5 or d in hol
    short = days < 11
    d = t
    n = 0
    while n < days:
        d += dt.timedelta(days=1)
        if short and closed(d):
            continue
        n += 1
    while closed(d):
        d += dt.timedelta(days=1)
    return d.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: observed monday holiday', ['2021-06-28', 7, ['2021-07-04']], '2021-07-08'),
  ('saturday holiday observed friday', ['2020-06-29', 5, ['2020-07-04']], '2020-07-07'),
  ('eleven day period',
   ['2024-01-02',
    11,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-01-16'),
  ('ten day period',
   ['2024-01-02',
    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-01-17'),
  ('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06')],
 [('eleven day period',
   ['2024-01-02',
    11,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-01-16'),
  ('ten day period',
   ['2024-01-02',
    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-01-17'),
  ('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06')],
 [('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06')],
 [('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06')],
 [('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06'),
  ('regression: observed monday holiday', ['2021-06-28', 7, ['2021-07-04']], '2021-07-08'),
  ('saturday holiday observed friday', ['2020-06-29', 5, ['2020-07-04']], '2020-07-07')]]
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 fixtureActualExpectedOutcome
regression: observed monday holiday2021-07-082021-07-08Passed
saturday holiday observed friday2020-07-072020-07-07Passed
eleven day period2024-01-162024-01-16Passed
ten day period2024-01-172024-01-17Passed
short spanning holiday2024-06-032024-06-03Passed
long ends sunday2024-03-042024-03-04Passed
long ends on holiday2024-05-282024-05-28Passed
short ends on observed friday2020-07-032020-07-06Failed

SHA-256 / 9d6f2eaf809374a05a6e0370472d014aa6af4cee61942e4e52272a93b895b609

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(trigger, days, holidays):
    t = dt.date.fromisoformat(trigger)
    hol = set()
    for h in holidays:
        x = dt.date.fromisoformat(h)
        hol.add(x - dt.timedelta(days=1) if x.weekday() == 5 else x + dt.timedelta(days=1) if x.weekday() == 6 else x)
    def closed(d):
        return d.weekday() >= 5 or d in hol
    short = days < 11
    d = t
    n = 0
    while n < days:
        d += dt.timedelta(days=1)
        if short and closed(d):
            continue
        n += 1
    while closed(d):
        d += dt.timedelta(days=1)
    return d.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: observed monday holiday', ['2021-06-28', 7, ['2021-07-04']], '2021-07-08'),
  ('saturday holiday observed friday', ['2020-06-29', 5, ['2020-07-04']], '2020-07-07'),
  ('eleven day period',
   ['2024-01-02',
    11,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-01-16'),
  ('ten day period',
   ['2024-01-02',
    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-01-17'),
  ('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06')],
 [('eleven day period',
   ['2024-01-02',
    11,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-01-16'),
  ('ten day period',
   ['2024-01-02',
    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-01-17'),
  ('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06')],
 [('short spanning holiday',
   ['2024-05-22',
    7,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-06-03'),
  ('long ends sunday',
   ['2024-02-02',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-04'),
  ('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06')],
 [('long ends on holiday',
   ['2024-04-27',
    30,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-05-28'),
  ('short ends at weekend',
   ['2024-03-04',
    5,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-03-11'),
  ('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06')],
 [('christmas short', ['2021-12-20', 5, ['2021-12-25', '2022-01-01']], '2021-12-28'),
  ('long 14 across holiday',
   ['2024-11-20',
    14,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   '2024-12-04'),
  ('short one day friday',
   ['2024-03-08',
    1,
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-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-11'),
  ('short ends on observed friday', ['2020-06-29', 4, ['2020-07-04']], '2020-07-06'),
  ('long ends on observed friday', ['2020-06-03', 30, ['2020-07-04']], '2020-07-06'),
  ('regression: observed monday holiday', ['2021-06-28', 7, ['2021-07-04']], '2021-07-08'),
  ('saturday holiday observed friday', ['2020-06-29', 5, ['2020-07-04']], '2020-07-07')]]
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 fixtureActualExpectedOutcome
regression: observed monday holiday2021-07-082021-07-08Passed
saturday holiday observed friday2020-07-072020-07-07Passed
eleven day period2024-01-162024-01-16Passed
ten day period2024-01-172024-01-17Passed
short spanning holiday2024-06-032024-06-03Passed
long ends sunday2024-03-042024-03-04Passed
long ends on holiday2024-05-282024-05-28Passed
short ends on observed friday2020-07-062020-07-06Passed

SHA-256 / 9f3d5641c0700723b2413b0261c2e20da3b69cf113a56651e19aaa7a792caaf2

Verification & scope

Stipulated toy deadline rules evaluated offline on explicit fixtures. The contract is inspired by common court-rule structures but is not legal advice and makes no claim to reproduce any jurisdiction's rules. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:25.020035+00:00.

Case digest / c43d47e86282957b50e812b0077393c2e075c4c6b780e7a3ae88e57121f1783f