FA-68096 / Traffic signal timing plans / Open access
Time-of-day plan schedule: holidays are matched by day of month alone · case 01
Time-of-day plan schedule returns a wrong result when holidays are matched by day of month alone.
ROOT CAUSE
Any date with the same day of month triggers the holiday program.
VERIFIED REPAIR
Restore the holiday date match rule so that the step reads `if hmo == mo and hdy == dy:`.
Unsuccessful approach: An or-condition still matches every day of the holiday month.
Case contract
Input {events: [[day mask (bit0 = Sunday), 'HH:MM', plan]], holidays: [[month, day, as_dow]], now: [dow, 'HH:MM', month, day]}. A holiday makes today's events come from its as_dow day type. The active plan is the event for today with the latest start <= now (later-listed wins at equal start). If none, the latest event of the most recent earlier real weekday that has events (up to 7 days back, same tie rule). Otherwise 'free'.
Why this case matters
Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def mins(s):
h, m = s.split(':')
return int(h) * 60 + int(m)
dow, hm, mo, dy = x['now']
t = mins(hm)
eff = dow
for hmo, hdy, as_dow in x['holidays']:
if hdy == dy:
eff = as_dow
best = None
for mask, st, plan in x['events']:
if mask >> eff & 1 and mins(st) <= t:
if best is None or mins(st) >= best[0]:
best = (mins(st), plan)
if best is not None:
return best[1]
for back in range(1, 8):
d = (dow - back) % 7
cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]
if cand:
return sorted(cand, key=lambda c: c[0])[-1][1]
return 'free'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[107, '09:30', 7], [65, '16:45', 5], [2, '15:45', 9], [1, '07:15', 9], [96, '14:00', 7], [62, '14:15', 7]], 'holidays': [[3, 22, 2], [9, 28, 0]], 'now': [4, '16:45', 2, 28]}, 7), ({'events': [[127, '21:30', 6], [25, '04:45', 5], [62, '15:00', 1]], 'holidays': [[10, 22, 5], [6, 20, 0]], 'now': [2, '04:45', 6, 16]}, 6), ({'events': [[1, '21:45', 6], [1, '18:30', 8], [69, '08:15', 4]], 'holidays': [[2, 10, 3], [10, 19, 2]], 'now': [4, '20:07', 10, 19]}, 4), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[127, '10:30', 7], [62, '21:30', 6]], 'holidays': [], 'now': [2, '07:30', 7, 13]}, 6), ({'events': [[31, '11:45', 9], [54, '05:00', 7]], 'holidays': [[2, 10, 3], [5, 4, 1]], 'now': [5, '13:00', 11, 4]}, 7), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5)], [({'events': [[64, '15:30', 9], [2, '11:00', 3], [25, '03:45', 7]], 'holidays': [[12, 11, 2], [10, 8, 1]], 'now': [0, '13:30', 9, 11]}, 7), ({'events': [[3, '03:00', 1], [127, '22:15', 8]], 'holidays': [[3, 13, 0]], 'now': [6, '15:07', 11, 13]}, 8), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[29, '17:45', 2], [65, '17:15', 6], [94, '09:45', 5], [65, '22:45', 7]], 'holidays': [], 'now': [0, '13:30', 8, 15]}, 7), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[1, '21:00', 3], [64, '01:45', 4]], 'holidays': [], 'now': [1, '20:07', 4, 8]}, 3)], [({'events': [[96, '23:45', 3], [96, '04:45', 6], [127, '11:45', 5], [44, '12:15', 4], [2, '18:30', 5], [3, '22:00', 6]], 'holidays': [[5, 19, 2], [2, 25, 1]], 'now': [2, '23:15', 2, 22]}, 4), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[37, '17:45', 1], [2, '12:00', 2], [62, '18:30', 1]], 'holidays': [[7, 17, 6]], 'now': [2, '05:30', 7, 17]}, 1), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '00:30', 6], [65, '19:30', 9], [32, '07:00', 5], [32, '02:00', 2]], 'holidays': [[1, 13, 3], [3, 23, 1]], 'now': [5, '08:45', 3, 14]}, 5), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[64, '10:45', 5], [13, '04:30', 3], [8, '15:45', 4], [64, '16:45', 7]], 'holidays': [[3, 3, 2], [6, 4, 1]], 'now': [2, '16:15', 10, 18]}, 3)], [({'events': [[65, '04:00', 3]], 'holidays': [[7, 19, 5], [11, 17, 0]], 'now': [0, '12:30', 6, 28]}, 3), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '13:45', 5], [96, '00:15', 7]], 'holidays': [[7, 6, 4], [2, 7, 3]], 'now': [5, '02:30', 6, 6]}, 7), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[60, '18:45', 8], [64, '12:45', 7], [1, '14:15', 8]], 'holidays': [[12, 7, 1], [12, 8, 0]], 'now': [6, '20:00', 12, 23]}, 7), ({'events': [[64, '05:45', 6]], 'holidays': [[12, 16, 0]], 'now': [2, '21:45', 12, 16]}, 6), ({'events': [[70, '05:45', 7], [62, '13:45', 4], [9, '02:45', 5], [2, '17:30', 5]], 'holidays': [[7, 23, 1], [6, 14, 1]], 'now': [6, '21:45', 7, 14]}, 7)], [({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[101, '20:15', 3], [1, '23:45', 5], [62, '20:15', 1]], 'holidays': [[3, 3, 0]], 'now': [1, '23:00', 10, 3]}, 1), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '17:15', 6], [1, '03:15', 8], [6, '21:00', 8], [117, '19:15', 7], [1, '23:15', 8]], 'holidays': [[5, 26, 1]], 'now': [0, '11:44', 3, 26]}, 8), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[65, '06:45', 1], [1, '04:45', 2], [62, '21:00', 3]], 'holidays': [[12, 23, 4]], 'now': [3, '03:30', 9, 20]}, 3), ({'events': [[37, '17:15', 8]], 'holidays': [[1, 20, 6], [8, 15, 5]], 'now': [2, '21:00', 11, 8]}, 8), ({'events': [[120, '07:15', 7], [99, '16:45', 3]], 'holidays': [[12, 13, 0]], 'now': [5, '19:00', 12, 13]}, 3)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %d' % i, 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 |
|---|---|---|---|
| timing oracle 0 | 6 | 2 | Failed |
| timing oracle 1 | 5 | 7 | Failed |
| timing oracle 2 | 6 | 6 | Passed |
| timing oracle 3 | 4 | 4 | Passed |
| timing oracle 4 | 9 | 9 | Passed |
| timing oracle 5 | 6 | 6 | Passed |
| timing oracle 6 | 9 | 7 | Failed |
| timing oracle 7 | 5 | 5 | Passed |
SHA-256 / 1129833b85a332954669c1916e9b309154cd6978d58519a758e5874ebb29191a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def mins(s):
h, m = s.split(':')
return int(h) * 60 + int(m)
dow, hm, mo, dy = x['now']
t = mins(hm)
eff = dow
for hmo, hdy, as_dow in x['holidays']:
if hmo == mo or hdy == dy:
eff = as_dow
best = None
for mask, st, plan in x['events']:
if mask >> eff & 1 and mins(st) <= t:
if best is None or mins(st) >= best[0]:
best = (mins(st), plan)
if best is not None:
return best[1]
for back in range(1, 8):
d = (dow - back) % 7
cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]
if cand:
return sorted(cand, key=lambda c: c[0])[-1][1]
return 'free'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[107, '09:30', 7], [65, '16:45', 5], [2, '15:45', 9], [1, '07:15', 9], [96, '14:00', 7], [62, '14:15', 7]], 'holidays': [[3, 22, 2], [9, 28, 0]], 'now': [4, '16:45', 2, 28]}, 7), ({'events': [[127, '21:30', 6], [25, '04:45', 5], [62, '15:00', 1]], 'holidays': [[10, 22, 5], [6, 20, 0]], 'now': [2, '04:45', 6, 16]}, 6), ({'events': [[1, '21:45', 6], [1, '18:30', 8], [69, '08:15', 4]], 'holidays': [[2, 10, 3], [10, 19, 2]], 'now': [4, '20:07', 10, 19]}, 4), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[127, '10:30', 7], [62, '21:30', 6]], 'holidays': [], 'now': [2, '07:30', 7, 13]}, 6), ({'events': [[31, '11:45', 9], [54, '05:00', 7]], 'holidays': [[2, 10, 3], [5, 4, 1]], 'now': [5, '13:00', 11, 4]}, 7), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5)], [({'events': [[64, '15:30', 9], [2, '11:00', 3], [25, '03:45', 7]], 'holidays': [[12, 11, 2], [10, 8, 1]], 'now': [0, '13:30', 9, 11]}, 7), ({'events': [[3, '03:00', 1], [127, '22:15', 8]], 'holidays': [[3, 13, 0]], 'now': [6, '15:07', 11, 13]}, 8), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[29, '17:45', 2], [65, '17:15', 6], [94, '09:45', 5], [65, '22:45', 7]], 'holidays': [], 'now': [0, '13:30', 8, 15]}, 7), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[1, '21:00', 3], [64, '01:45', 4]], 'holidays': [], 'now': [1, '20:07', 4, 8]}, 3)], [({'events': [[96, '23:45', 3], [96, '04:45', 6], [127, '11:45', 5], [44, '12:15', 4], [2, '18:30', 5], [3, '22:00', 6]], 'holidays': [[5, 19, 2], [2, 25, 1]], 'now': [2, '23:15', 2, 22]}, 4), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[37, '17:45', 1], [2, '12:00', 2], [62, '18:30', 1]], 'holidays': [[7, 17, 6]], 'now': [2, '05:30', 7, 17]}, 1), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '00:30', 6], [65, '19:30', 9], [32, '07:00', 5], [32, '02:00', 2]], 'holidays': [[1, 13, 3], [3, 23, 1]], 'now': [5, '08:45', 3, 14]}, 5), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[64, '10:45', 5], [13, '04:30', 3], [8, '15:45', 4], [64, '16:45', 7]], 'holidays': [[3, 3, 2], [6, 4, 1]], 'now': [2, '16:15', 10, 18]}, 3)], [({'events': [[65, '04:00', 3]], 'holidays': [[7, 19, 5], [11, 17, 0]], 'now': [0, '12:30', 6, 28]}, 3), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '13:45', 5], [96, '00:15', 7]], 'holidays': [[7, 6, 4], [2, 7, 3]], 'now': [5, '02:30', 6, 6]}, 7), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[60, '18:45', 8], [64, '12:45', 7], [1, '14:15', 8]], 'holidays': [[12, 7, 1], [12, 8, 0]], 'now': [6, '20:00', 12, 23]}, 7), ({'events': [[64, '05:45', 6]], 'holidays': [[12, 16, 0]], 'now': [2, '21:45', 12, 16]}, 6), ({'events': [[70, '05:45', 7], [62, '13:45', 4], [9, '02:45', 5], [2, '17:30', 5]], 'holidays': [[7, 23, 1], [6, 14, 1]], 'now': [6, '21:45', 7, 14]}, 7)], [({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[101, '20:15', 3], [1, '23:45', 5], [62, '20:15', 1]], 'holidays': [[3, 3, 0]], 'now': [1, '23:00', 10, 3]}, 1), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '17:15', 6], [1, '03:15', 8], [6, '21:00', 8], [117, '19:15', 7], [1, '23:15', 8]], 'holidays': [[5, 26, 1]], 'now': [0, '11:44', 3, 26]}, 8), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[65, '06:45', 1], [1, '04:45', 2], [62, '21:00', 3]], 'holidays': [[12, 23, 4]], 'now': [3, '03:30', 9, 20]}, 3), ({'events': [[37, '17:15', 8]], 'holidays': [[1, 20, 6], [8, 15, 5]], 'now': [2, '21:00', 11, 8]}, 8), ({'events': [[120, '07:15', 7], [99, '16:45', 3]], 'holidays': [[12, 13, 0]], 'now': [5, '19:00', 12, 13]}, 3)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %d' % i, 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 |
|---|---|---|---|
| timing oracle 0 | 6 | 2 | Failed |
| timing oracle 1 | 5 | 7 | Failed |
| timing oracle 2 | 5 | 6 | Failed |
| timing oracle 3 | 4 | 4 | Passed |
| timing oracle 4 | 9 | 9 | Passed |
| timing oracle 5 | 6 | 6 | Passed |
| timing oracle 6 | 9 | 7 | Failed |
| timing oracle 7 | 5 | 5 | Passed |
SHA-256 / 4e8757caa424a08269dfd929136fbdb596d022d69f290356838d3f1eef66ab08
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def mins(s):
h, m = s.split(':')
return int(h) * 60 + int(m)
dow, hm, mo, dy = x['now']
t = mins(hm)
eff = dow
for hmo, hdy, as_dow in x['holidays']:
if hmo == mo and hdy == dy:
eff = as_dow
best = None
for mask, st, plan in x['events']:
if mask >> eff & 1 and mins(st) <= t:
if best is None or mins(st) >= best[0]:
best = (mins(st), plan)
if best is not None:
return best[1]
for back in range(1, 8):
d = (dow - back) % 7
cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]
if cand:
return sorted(cand, key=lambda c: c[0])[-1][1]
return 'free'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[107, '09:30', 7], [65, '16:45', 5], [2, '15:45', 9], [1, '07:15', 9], [96, '14:00', 7], [62, '14:15', 7]], 'holidays': [[3, 22, 2], [9, 28, 0]], 'now': [4, '16:45', 2, 28]}, 7), ({'events': [[127, '21:30', 6], [25, '04:45', 5], [62, '15:00', 1]], 'holidays': [[10, 22, 5], [6, 20, 0]], 'now': [2, '04:45', 6, 16]}, 6), ({'events': [[1, '21:45', 6], [1, '18:30', 8], [69, '08:15', 4]], 'holidays': [[2, 10, 3], [10, 19, 2]], 'now': [4, '20:07', 10, 19]}, 4), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[127, '10:30', 7], [62, '21:30', 6]], 'holidays': [], 'now': [2, '07:30', 7, 13]}, 6), ({'events': [[31, '11:45', 9], [54, '05:00', 7]], 'holidays': [[2, 10, 3], [5, 4, 1]], 'now': [5, '13:00', 11, 4]}, 7), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5)], [({'events': [[64, '15:30', 9], [2, '11:00', 3], [25, '03:45', 7]], 'holidays': [[12, 11, 2], [10, 8, 1]], 'now': [0, '13:30', 9, 11]}, 7), ({'events': [[3, '03:00', 1], [127, '22:15', 8]], 'holidays': [[3, 13, 0]], 'now': [6, '15:07', 11, 13]}, 8), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[29, '17:45', 2], [65, '17:15', 6], [94, '09:45', 5], [65, '22:45', 7]], 'holidays': [], 'now': [0, '13:30', 8, 15]}, 7), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[1, '21:00', 3], [64, '01:45', 4]], 'holidays': [], 'now': [1, '20:07', 4, 8]}, 3)], [({'events': [[96, '23:45', 3], [96, '04:45', 6], [127, '11:45', 5], [44, '12:15', 4], [2, '18:30', 5], [3, '22:00', 6]], 'holidays': [[5, 19, 2], [2, 25, 1]], 'now': [2, '23:15', 2, 22]}, 4), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[37, '17:45', 1], [2, '12:00', 2], [62, '18:30', 1]], 'holidays': [[7, 17, 6]], 'now': [2, '05:30', 7, 17]}, 1), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '00:30', 6], [65, '19:30', 9], [32, '07:00', 5], [32, '02:00', 2]], 'holidays': [[1, 13, 3], [3, 23, 1]], 'now': [5, '08:45', 3, 14]}, 5), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[64, '10:45', 5], [13, '04:30', 3], [8, '15:45', 4], [64, '16:45', 7]], 'holidays': [[3, 3, 2], [6, 4, 1]], 'now': [2, '16:15', 10, 18]}, 3)], [({'events': [[65, '04:00', 3]], 'holidays': [[7, 19, 5], [11, 17, 0]], 'now': [0, '12:30', 6, 28]}, 3), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '13:45', 5], [96, '00:15', 7]], 'holidays': [[7, 6, 4], [2, 7, 3]], 'now': [5, '02:30', 6, 6]}, 7), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[60, '18:45', 8], [64, '12:45', 7], [1, '14:15', 8]], 'holidays': [[12, 7, 1], [12, 8, 0]], 'now': [6, '20:00', 12, 23]}, 7), ({'events': [[64, '05:45', 6]], 'holidays': [[12, 16, 0]], 'now': [2, '21:45', 12, 16]}, 6), ({'events': [[70, '05:45', 7], [62, '13:45', 4], [9, '02:45', 5], [2, '17:30', 5]], 'holidays': [[7, 23, 1], [6, 14, 1]], 'now': [6, '21:45', 7, 14]}, 7)], [({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[101, '20:15', 3], [1, '23:45', 5], [62, '20:15', 1]], 'holidays': [[3, 3, 0]], 'now': [1, '23:00', 10, 3]}, 1), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '17:15', 6], [1, '03:15', 8], [6, '21:00', 8], [117, '19:15', 7], [1, '23:15', 8]], 'holidays': [[5, 26, 1]], 'now': [0, '11:44', 3, 26]}, 8), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[65, '06:45', 1], [1, '04:45', 2], [62, '21:00', 3]], 'holidays': [[12, 23, 4]], 'now': [3, '03:30', 9, 20]}, 3), ({'events': [[37, '17:15', 8]], 'holidays': [[1, 20, 6], [8, 15, 5]], 'now': [2, '21:00', 11, 8]}, 8), ({'events': [[120, '07:15', 7], [99, '16:45', 3]], 'holidays': [[12, 13, 0]], 'now': [5, '19:00', 12, 13]}, 3)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %d' % i, 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 |
|---|---|---|---|
| timing oracle 0 | 2 | 2 | Passed |
| timing oracle 1 | 7 | 7 | Passed |
| timing oracle 2 | 6 | 6 | Passed |
| timing oracle 3 | 4 | 4 | Passed |
| timing oracle 4 | 9 | 9 | Passed |
| timing oracle 5 | 6 | 6 | Passed |
| timing oracle 6 | 7 | 7 | Passed |
| timing oracle 7 | 5 | 5 | Passed |
SHA-256 / 1f0f67a34db8fc36a1f374935c432c41dfe45b0df8375b39a65f3b6ccbcccc00
Verification & scope
A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:47:59.014976+00:00.
Case digest / 4f1c632f62aba14fc2a6487c535fba3479b80d8e4e3db48741d265dbff9882aa