FA-77681 / Legal deadline computation / Open access
Service by publication: schedule validity and completion date: week key · case 01
A Saturday and the following Sunday publication are treated as the same week.
ROOT CAUSE
Publication weeks are computed Monday to Sunday.
VERIFIED REPAIR
At the week key decision use `p - dt.timedelta(days=(p.weekday() + 1) % 7)`, leaving the other decision sites of the model unchanged.
Unsuccessful approach: The partial repair `p - dt.timedelta(days=p.weekday() + 1)` subtracts one extra day and maps Sunday publications into the previous week.
Case contract
Stipulated: service by publication requires at least four publications, one in each of successive calendar weeks (weeks run Sunday to Saturday), with no two in the same week. Service is complete on the 28th day after the first publication, and the response is due 30 days after completion (a closed last day moves to the next open day). Return {"valid": false} or {"valid": true, "complete", "respond"}.
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(publications, holidays):
pubs = sorted(dt.date.fromisoformat(p) for p in publications)
hol = {dt.date.fromisoformat(x) for x in holidays}
weeks = [p - dt.timedelta(days=p.weekday()) for p in pubs]
uw = sorted(set(weeks))
if len(set(weeks)) != len(weeks):
return {'valid': False}
if len(pubs) < 4 or any((uw[i + 1] - uw[i]).days != 7 for i in range(len(uw) - 1)):
return {'valid': False}
complete = pubs[0] + dt.timedelta(days=28)
respond = complete + dt.timedelta(days=30)
while respond.weekday() >= 5 or respond in hol:
respond += dt.timedelta(days=1)
return {'valid': True, 'complete': complete.isoformat(), 'respond': respond.isoformat()}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False}),
('weekly thursdays',
[['2024-03-07', '2024-03-14', '2024-03-21', '2024-03-28'],
['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']],
{'valid': True, 'complete': '2024-04-04', 'respond': '2024-05-06'}),
('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False}),
('two in one week of five',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26', '2024-04-02'],
['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']],
{'valid': False}),
('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False})],
[('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False}),
('two in one week of five',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26', '2024-04-02'],
['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']],
{'valid': False}),
('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'})],
[('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'})],
[('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'}),
('monday sunday same week',
[['2024-10-06', '2024-10-07', '2024-10-14', '2024-10-21', '2024-10-28'],
['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']],
{'valid': False}),
('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False})],
[('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'}),
('monday sunday same week',
[['2024-10-06', '2024-10-07', '2024-10-14', '2024-10-21', '2024-10-28'],
['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']],
{'valid': False}),
('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False}),
('weekly thursdays',
[['2024-03-07', '2024-03-14', '2024-03-21', '2024-03-28'],
['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']],
{'valid': True, 'complete': '2024-04-04', 'respond': '2024-05-06'}),
('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False})]]
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: saturday then sunday publications | {'complete': '2024-03-30', 'respond': '2024-04-29', 'valid': True} | {'valid': False} | Failed |
| weekly thursdays | {'complete': '2024-04-04', 'respond': '2024-05-06', 'valid': True} | {'complete': '2024-04-04', 'respond': '2024-05-06', 'valid': True} | Passed |
| two in one week | {'valid': False} | {'valid': False} | Passed |
| two in one week of five | {'valid': False} | {'valid': False} | Passed |
| uneven successive weeks | {'complete': '2024-04-29', 'respond': '2024-05-29', 'valid': True} | {'complete': '2024-04-29', 'respond': '2024-05-29', 'valid': True} | Passed |
| gap week | {'valid': False} | {'valid': False} | Passed |
| only three | {'valid': False} | {'valid': False} | Passed |
SHA-256 / a703c5a0bfc740d593e46ebebd0fac8e9f44e6b1efc1b6e0718a38d653e00494
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(publications, holidays):
pubs = sorted(dt.date.fromisoformat(p) for p in publications)
hol = {dt.date.fromisoformat(x) for x in holidays}
weeks = [p - dt.timedelta(days=p.weekday() + 1) for p in pubs]
uw = sorted(set(weeks))
if len(set(weeks)) != len(weeks):
return {'valid': False}
if len(pubs) < 4 or any((uw[i + 1] - uw[i]).days != 7 for i in range(len(uw) - 1)):
return {'valid': False}
complete = pubs[0] + dt.timedelta(days=28)
respond = complete + dt.timedelta(days=30)
while respond.weekday() >= 5 or respond in hol:
respond += dt.timedelta(days=1)
return {'valid': True, 'complete': complete.isoformat(), 'respond': respond.isoformat()}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False}),
('weekly thursdays',
[['2024-03-07', '2024-03-14', '2024-03-21', '2024-03-28'],
['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']],
{'valid': True, 'complete': '2024-04-04', 'respond': '2024-05-06'}),
('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False}),
('two in one week of five',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26', '2024-04-02'],
['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']],
{'valid': False}),
('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False})],
[('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False}),
('two in one week of five',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26', '2024-04-02'],
['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']],
{'valid': False}),
('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'})],
[('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'})],
[('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'}),
('monday sunday same week',
[['2024-10-06', '2024-10-07', '2024-10-14', '2024-10-21', '2024-10-28'],
['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']],
{'valid': False}),
('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False})],
[('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'}),
('monday sunday same week',
[['2024-10-06', '2024-10-07', '2024-10-14', '2024-10-21', '2024-10-28'],
['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']],
{'valid': False}),
('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False}),
('weekly thursdays',
[['2024-03-07', '2024-03-14', '2024-03-21', '2024-03-28'],
['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']],
{'valid': True, 'complete': '2024-04-04', 'respond': '2024-05-06'}),
('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False})]]
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: saturday then sunday publications | {'complete': '2024-03-30', 'respond': '2024-04-29', 'valid': True} | {'valid': False} | Failed |
| weekly thursdays | {'complete': '2024-04-04', 'respond': '2024-05-06', 'valid': True} | {'complete': '2024-04-04', 'respond': '2024-05-06', 'valid': True} | Passed |
| two in one week | {'valid': False} | {'valid': False} | Passed |
| two in one week of five | {'valid': False} | {'valid': False} | Passed |
| uneven successive weeks | {'complete': '2024-04-29', 'respond': '2024-05-29', 'valid': True} | {'complete': '2024-04-29', 'respond': '2024-05-29', 'valid': True} | Passed |
| gap week | {'valid': False} | {'valid': False} | Passed |
| only three | {'valid': False} | {'valid': False} | Passed |
SHA-256 / d37aa6b117ea4963f4d569eadae3b759efbbc3e5ce6cce0e38c0c2ca0439c51b
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(publications, holidays):
pubs = sorted(dt.date.fromisoformat(p) for p in publications)
hol = {dt.date.fromisoformat(x) for x in holidays}
weeks = [p - dt.timedelta(days=(p.weekday() + 1) % 7) for p in pubs]
uw = sorted(set(weeks))
if len(set(weeks)) != len(weeks):
return {'valid': False}
if len(pubs) < 4 or any((uw[i + 1] - uw[i]).days != 7 for i in range(len(uw) - 1)):
return {'valid': False}
complete = pubs[0] + dt.timedelta(days=28)
respond = complete + dt.timedelta(days=30)
while respond.weekday() >= 5 or respond in hol:
respond += dt.timedelta(days=1)
return {'valid': True, 'complete': complete.isoformat(), 'respond': respond.isoformat()}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False}),
('weekly thursdays',
[['2024-03-07', '2024-03-14', '2024-03-21', '2024-03-28'],
['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']],
{'valid': True, 'complete': '2024-04-04', 'respond': '2024-05-06'}),
('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False}),
('two in one week of five',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26', '2024-04-02'],
['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']],
{'valid': False}),
('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False})],
[('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False}),
('two in one week of five',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26', '2024-04-02'],
['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']],
{'valid': False}),
('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'})],
[('uneven successive weeks',
[['2024-04-01', '2024-04-12', '2024-04-15', '2024-04-26'],
['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']],
{'valid': True, 'complete': '2024-04-29', 'respond': '2024-05-29'}),
('gap week',
[['2024-04-01', '2024-04-08', '2024-04-22', '2024-04-29'],
['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']],
{'valid': False}),
('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'})],
[('only three',
[['2024-05-01', '2024-05-08', '2024-05-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']],
{'valid': False}),
('five publications',
[['2024-05-02', '2024-05-09', '2024-05-16', '2024-05-23', '2024-05-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']],
{'valid': True, 'complete': '2024-05-30', 'respond': '2024-07-01'}),
('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'}),
('monday sunday same week',
[['2024-10-06', '2024-10-07', '2024-10-14', '2024-10-21', '2024-10-28'],
['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']],
{'valid': False}),
('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False})],
[('sunday saturday pairs',
[['2024-06-02', '2024-06-15', '2024-06-16', '2024-06-29'],
['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']],
{'valid': True, 'complete': '2024-06-30', 'respond': '2024-07-30'}),
('respond lands holiday',
[['2024-08-07', '2024-08-14', '2024-08-21', '2024-08-28'],
['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']],
{'valid': True, 'complete': '2024-09-04', 'respond': '2024-10-04'}),
('unsorted input',
[['2024-09-24', '2024-09-03', '2024-09-17', '2024-09-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']],
{'valid': True, 'complete': '2024-10-01', 'respond': '2024-10-31'}),
('monday sunday same week',
[['2024-10-06', '2024-10-07', '2024-10-14', '2024-10-21', '2024-10-28'],
['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']],
{'valid': False}),
('regression: saturday then sunday publications',
[['2024-03-02', '2024-03-10', '2024-03-17', '2024-03-24'],
['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']],
{'valid': False}),
('weekly thursdays',
[['2024-03-07', '2024-03-14', '2024-03-21', '2024-03-28'],
['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']],
{'valid': True, 'complete': '2024-04-04', 'respond': '2024-05-06'}),
('two in one week',
[['2024-03-04', '2024-03-08', '2024-03-12', '2024-03-19', '2024-03-26'],
['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']],
{'valid': False})]]
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: saturday then sunday publications | {'valid': False} | {'valid': False} | Passed |
| weekly thursdays | {'complete': '2024-04-04', 'respond': '2024-05-06', 'valid': True} | {'complete': '2024-04-04', 'respond': '2024-05-06', 'valid': True} | Passed |
| two in one week | {'valid': False} | {'valid': False} | Passed |
| two in one week of five | {'valid': False} | {'valid': False} | Passed |
| uneven successive weeks | {'complete': '2024-04-29', 'respond': '2024-05-29', 'valid': True} | {'complete': '2024-04-29', 'respond': '2024-05-29', 'valid': True} | Passed |
| gap week | {'valid': False} | {'valid': False} | Passed |
| only three | {'valid': False} | {'valid': False} | Passed |
SHA-256 / 83b5f0a1128b93d94197bc37020d192a128255e8123506e19ac7a0907debb609
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.926184+00:00.
Case digest / 07ca5ff939642f50466e7aa9800ce7934e9f62dc22bd1a9ae3c2dabd1a723bd4