{"abstract":"Time-of-day plan schedule returns a wrong result when carryover takes the earliest event of the previous day.","category":"Traffic signal timing plans","checks":8,"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'.","contract_signature":"x","evaluation_group":"w2-traffic_signal_timing_plans-tod-schedule","failed_approach":"Taking the last listed event assumes the table is sorted by start time.","family":"w2-traffic_signal_timing_plans-tod-schedule-carryover-latest","id":"FA-68101","implementations":{"attempt":{"sha256":"ddea57ee78d072d9b07d6f2313c7450a2d52b3267b42abf66646f71683ecac58","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def mins(s):\n        h, m = s.split(':')\n        return int(h) * 60 + int(m)\n    dow, hm, mo, dy = x['now']\n    t = mins(hm)\n    eff = dow\n    for hmo, hdy, as_dow in x['holidays']:\n        if hmo == mo and hdy == dy:\n            eff = as_dow\n    best = None\n    for mask, st, plan in x['events']:\n        if mask >> eff & 1 and mins(st) <= t:\n            if best is None or mins(st) >= best[0]:\n                best = (mins(st), plan)\n    if best is not None:\n        return best[1]\n    for back in range(1, 8):\n        d = (dow - back) % 7\n        cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]\n        if cand:\n            return cand[-1][1]\n    return 'free'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[127, '13:15', 6], [65, '07:15', 9], [32, '07:45', 8], [46, '13:45', 6], [64, '21:30', 7], [1, '22:30', 3]], 'holidays': [[11, 26, 1]], 'now': [1, '10:45', 11, 26]}, 3), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '21:00', 2], [65, '22:45', 1], [2, '12:15', 9], [2, '02:45', 9], [1, '05:45', 3], [2, '10:15', 2]], 'holidays': [[11, 13, 4]], 'now': [3, '08:07', 9, 11]}, 9), ({'events': [[127, '16:30', 9]], 'holidays': [], 'now': [2, '16:30', 3, 26]}, 9), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[96, '20:30', 8], [96, '05:45', 1]], 'holidays': [[4, 6, 0]], 'now': [0, '06:30', 4, 6]}, 8), ({'events': [[25, '06:00', 7], [3, '10:00', 6], [127, '21:45', 9]], 'holidays': [], 'now': [2, '06:00', 3, 8]}, 9)], [({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 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': [[96, '17:00', 9], [1, '18:00', 6], [2, '04:00', 4], [65, '10:45', 7], [96, '16:15', 5], [1, '10:45', 9]], 'holidays': [[9, 20, 4]], 'now': [3, '10:45', 9, 20]}, 4), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[65, '21:15', 8], [65, '18:45', 4], [1, '13:30', 1], [45, '12:15', 5]], 'holidays': [], 'now': [1, '02:15', 8, 18]}, 8), ({'events': [[23, '04:45', 7], [62, '23:15', 3], [65, '21:30', 1], [6, '12:00', 9]], 'holidays': [[2, 22, 2]], 'now': [3, '04:45', 2, 22]}, 7), ({'events': [[127, '19:15', 8], [2, '15:45', 9]], 'holidays': [[1, 11, 0]], 'now': [4, '22:07', 1, 11]}, 8), ({'events': [[59, '12:15', 6], [3, '21:30', 2], [44, '04:15', 3], [92, '04:15', 2], [37, '22:00', 1], [1, '02:00', 6]], 'holidays': [[5, 14, 1]], 'now': [1, '04:15', 8, 10]}, 1)], [({'events': [[49, '19:45', 4], [1, '17:30', 1], [3, '09:00', 7], [122, '11:00', 3]], 'holidays': [[2, 20, 6], [12, 24, 6]], 'now': [2, '19:45', 11, 23]}, 3), ({'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': [[3, '05:00', 3], [25, '04:30', 6], [62, '17:00', 6]], 'holidays': [[1, 5, 4]], 'now': [0, '11:30', 1, 5]}, 6), ({'events': [[64, '13:00', 3], [3, '02:00', 9], [109, '16:15', 3], [52, '07:15', 7]], 'holidays': [[5, 14, 4]], 'now': [3, '13:00', 5, 14]}, 7), ({'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': [[3, '05:15', 9], [64, '16:45', 8]], 'holidays': [[1, 1, 2], [2, 6, 0]], 'now': [1, '18:07', 2, 6]}, 9), ({'events': [[64, '16:45', 7], [107, '11:30', 5], [126, '09:00', 1], [1, '05:00', 1]], 'holidays': [[3, 15, 5], [4, 4, 5]], 'now': [1, '01:44', 3, 15]}, 5)], [({'events': [[127, '07:30', 2], [64, '13:00', 2], [65, '21:15', 1]], 'holidays': [[10, 24, 2], [12, 19, 3]], 'now': [1, '21:44', 10, 3]}, 2), ({'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': [[96, '10:30', 9], [32, '02:00', 6], [2, '15:45', 5], [62, '18:45', 4], [47, '23:45', 3], [15, '19:15', 6]], 'holidays': [[6, 20, 2]], 'now': [3, '00:30', 9, 17]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '19:30', 5], [96, '19:15', 6], [3, '22:00', 1], [127, '02:00', 6], [127, '11:30', 3]], 'holidays': [], 'now': [6, '12:45', 9, 8]}, 3), ({'events': [[2, '20:30', 8], [1, '15:15', 6], [64, '08:00', 6], [125, '04:45', 1], [96, '11:15', 3]], 'holidays': [], 'now': [4, '22:30', 10, 18]}, 1), ({'events': [[2, '04:15', 7], [17, '08:15', 1], [34, '05:30', 1]], 'holidays': [[12, 6, 2], [4, 19, 3]], 'now': [3, '04:15', 12, 6]}, 1)], [({'events': [[3, '17:00', 4], [127, '11:00', 7], [32, '09:15', 1], [2, '07:00', 7], [1, '10:00', 4], [41, '10:30', 6]], 'holidays': [], 'now': [2, '04:44', 10, 18]}, 4), ({'events': [[1, '02:15', 7], [65, '20:30', 8], [65, '11:15', 3], [1, '01:45', 7]], 'holidays': [[4, 7, 1], [2, 14, 5]], 'now': [1, '11:15', 2, 14]}, 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': [[49, '17:30', 4], [62, '03:30', 3], [64, '22:00', 6], [2, '02:30', 2], [3, '12:30', 7]], 'holidays': [[3, 9, 5], [8, 11, 6]], 'now': [5, '12:30', 10, 27]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[126, '23:30', 5], [62, '16:30', 6], [64, '17:15', 9], [2, '20:45', 7]], 'holidays': [[9, 18, 5]], 'now': [2, '16:30', 9, 18]}, 6), ({'events': [[127, '02:45', 7], [64, '10:45', 2], [3, '04:00', 1], [1, '12:15', 7], [1, '16:30', 4]], 'holidays': [], 'now': [3, '10:45', 6, 13]}, 7)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check('timing oracle' + ' %d' % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"19861542b8917d0c836e12e4fc1ba2959eeac9d5d31be79656e3952ae27ffd9f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def mins(s):\n        h, m = s.split(':')\n        return int(h) * 60 + int(m)\n    dow, hm, mo, dy = x['now']\n    t = mins(hm)\n    eff = dow\n    for hmo, hdy, as_dow in x['holidays']:\n        if hmo == mo and hdy == dy:\n            eff = as_dow\n    best = None\n    for mask, st, plan in x['events']:\n        if mask >> eff & 1 and mins(st) <= t:\n            if best is None or mins(st) >= best[0]:\n                best = (mins(st), plan)\n    if best is not None:\n        return best[1]\n    for back in range(1, 8):\n        d = (dow - back) % 7\n        cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]\n        if cand:\n            return sorted(cand, key=lambda c: c[0])[0][1]\n    return 'free'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[127, '13:15', 6], [65, '07:15', 9], [32, '07:45', 8], [46, '13:45', 6], [64, '21:30', 7], [1, '22:30', 3]], 'holidays': [[11, 26, 1]], 'now': [1, '10:45', 11, 26]}, 3), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '21:00', 2], [65, '22:45', 1], [2, '12:15', 9], [2, '02:45', 9], [1, '05:45', 3], [2, '10:15', 2]], 'holidays': [[11, 13, 4]], 'now': [3, '08:07', 9, 11]}, 9), ({'events': [[127, '16:30', 9]], 'holidays': [], 'now': [2, '16:30', 3, 26]}, 9), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[96, '20:30', 8], [96, '05:45', 1]], 'holidays': [[4, 6, 0]], 'now': [0, '06:30', 4, 6]}, 8), ({'events': [[25, '06:00', 7], [3, '10:00', 6], [127, '21:45', 9]], 'holidays': [], 'now': [2, '06:00', 3, 8]}, 9)], [({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 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': [[96, '17:00', 9], [1, '18:00', 6], [2, '04:00', 4], [65, '10:45', 7], [96, '16:15', 5], [1, '10:45', 9]], 'holidays': [[9, 20, 4]], 'now': [3, '10:45', 9, 20]}, 4), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[65, '21:15', 8], [65, '18:45', 4], [1, '13:30', 1], [45, '12:15', 5]], 'holidays': [], 'now': [1, '02:15', 8, 18]}, 8), ({'events': [[23, '04:45', 7], [62, '23:15', 3], [65, '21:30', 1], [6, '12:00', 9]], 'holidays': [[2, 22, 2]], 'now': [3, '04:45', 2, 22]}, 7), ({'events': [[127, '19:15', 8], [2, '15:45', 9]], 'holidays': [[1, 11, 0]], 'now': [4, '22:07', 1, 11]}, 8), ({'events': [[59, '12:15', 6], [3, '21:30', 2], [44, '04:15', 3], [92, '04:15', 2], [37, '22:00', 1], [1, '02:00', 6]], 'holidays': [[5, 14, 1]], 'now': [1, '04:15', 8, 10]}, 1)], [({'events': [[49, '19:45', 4], [1, '17:30', 1], [3, '09:00', 7], [122, '11:00', 3]], 'holidays': [[2, 20, 6], [12, 24, 6]], 'now': [2, '19:45', 11, 23]}, 3), ({'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': [[3, '05:00', 3], [25, '04:30', 6], [62, '17:00', 6]], 'holidays': [[1, 5, 4]], 'now': [0, '11:30', 1, 5]}, 6), ({'events': [[64, '13:00', 3], [3, '02:00', 9], [109, '16:15', 3], [52, '07:15', 7]], 'holidays': [[5, 14, 4]], 'now': [3, '13:00', 5, 14]}, 7), ({'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': [[3, '05:15', 9], [64, '16:45', 8]], 'holidays': [[1, 1, 2], [2, 6, 0]], 'now': [1, '18:07', 2, 6]}, 9), ({'events': [[64, '16:45', 7], [107, '11:30', 5], [126, '09:00', 1], [1, '05:00', 1]], 'holidays': [[3, 15, 5], [4, 4, 5]], 'now': [1, '01:44', 3, 15]}, 5)], [({'events': [[127, '07:30', 2], [64, '13:00', 2], [65, '21:15', 1]], 'holidays': [[10, 24, 2], [12, 19, 3]], 'now': [1, '21:44', 10, 3]}, 2), ({'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': [[96, '10:30', 9], [32, '02:00', 6], [2, '15:45', 5], [62, '18:45', 4], [47, '23:45', 3], [15, '19:15', 6]], 'holidays': [[6, 20, 2]], 'now': [3, '00:30', 9, 17]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '19:30', 5], [96, '19:15', 6], [3, '22:00', 1], [127, '02:00', 6], [127, '11:30', 3]], 'holidays': [], 'now': [6, '12:45', 9, 8]}, 3), ({'events': [[2, '20:30', 8], [1, '15:15', 6], [64, '08:00', 6], [125, '04:45', 1], [96, '11:15', 3]], 'holidays': [], 'now': [4, '22:30', 10, 18]}, 1), ({'events': [[2, '04:15', 7], [17, '08:15', 1], [34, '05:30', 1]], 'holidays': [[12, 6, 2], [4, 19, 3]], 'now': [3, '04:15', 12, 6]}, 1)], [({'events': [[3, '17:00', 4], [127, '11:00', 7], [32, '09:15', 1], [2, '07:00', 7], [1, '10:00', 4], [41, '10:30', 6]], 'holidays': [], 'now': [2, '04:44', 10, 18]}, 4), ({'events': [[1, '02:15', 7], [65, '20:30', 8], [65, '11:15', 3], [1, '01:45', 7]], 'holidays': [[4, 7, 1], [2, 14, 5]], 'now': [1, '11:15', 2, 14]}, 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': [[49, '17:30', 4], [62, '03:30', 3], [64, '22:00', 6], [2, '02:30', 2], [3, '12:30', 7]], 'holidays': [[3, 9, 5], [8, 11, 6]], 'now': [5, '12:30', 10, 27]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[126, '23:30', 5], [62, '16:30', 6], [64, '17:15', 9], [2, '20:45', 7]], 'holidays': [[9, 18, 5]], 'now': [2, '16:30', 9, 18]}, 6), ({'events': [[127, '02:45', 7], [64, '10:45', 2], [3, '04:00', 1], [1, '12:15', 7], [1, '16:30', 4]], 'holidays': [], 'now': [3, '10:45', 6, 13]}, 7)]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check('timing oracle' + ' %d' % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-traffic_signal_timing_plans-tod-schedule-carryover-latest","generated_at":"2026-09-29T14:47:59.092624+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.","root_cause":"The morning event of the previous day is chosen instead of the last event still in effect overnight.","sha256":"77a2d66997d6e7f9e85c05a3fbe7902b8be06efda88605bd9269a439b1956c14","title":"Time-of-day plan schedule: carryover takes the earliest event of the previous day · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":39.54,"exit_code":1,"observations":[{"actual":2,"check":"timing oracle 0","expected":2,"passed":true},{"actual":3,"check":"timing oracle 1","expected":3,"passed":true},{"actual":2,"check":"timing oracle 2","expected":2,"passed":true},{"actual":2,"check":"timing oracle 3","expected":9,"passed":false},{"actual":9,"check":"timing oracle 4","expected":9,"passed":true},{"actual":7,"check":"timing oracle 5","expected":7,"passed":true},{"actual":1,"check":"timing oracle 6","expected":8,"passed":false},{"actual":9,"check":"timing oracle 7","expected":9,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"timing oracle 0\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"timing oracle 1\", \"actual\": 3, \"expected\": 3, \"passed\": true}, {\"check\": \"timing oracle 2\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"timing oracle 3\", \"actual\": 2, \"expected\": 9, \"passed\": false}, {\"check\": \"timing oracle 4\", \"actual\": 9, \"expected\": 9, \"passed\": true}, {\"check\": \"timing oracle 5\", \"actual\": 7, \"expected\": 7, \"passed\": true}, {\"check\": \"timing oracle 6\", \"actual\": 1, \"expected\": 8, \"passed\": false}, {\"check\": \"timing oracle 7\", \"actual\": 9, \"expected\": 9, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.2,"exit_code":1,"observations":[{"actual":2,"check":"timing oracle 0","expected":2,"passed":true},{"actual":9,"check":"timing oracle 1","expected":3,"passed":false},{"actual":2,"check":"timing oracle 2","expected":2,"passed":true},{"actual":9,"check":"timing oracle 3","expected":9,"passed":true},{"actual":9,"check":"timing oracle 4","expected":9,"passed":true},{"actual":7,"check":"timing oracle 5","expected":7,"passed":true},{"actual":1,"check":"timing oracle 6","expected":8,"passed":false},{"actual":6,"check":"timing oracle 7","expected":9,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"timing oracle 0\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"timing oracle 1\", \"actual\": 9, \"expected\": 3, \"passed\": false}, {\"check\": \"timing oracle 2\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"timing oracle 3\", \"actual\": 9, \"expected\": 9, \"passed\": true}, {\"check\": \"timing oracle 4\", \"actual\": 9, \"expected\": 9, \"passed\": true}, {\"check\": \"timing oracle 5\", \"actual\": 7, \"expected\": 7, \"passed\": true}, {\"check\": \"timing oracle 6\", \"actual\": 1, \"expected\": 8, \"passed\": false}, {\"check\": \"timing oracle 7\", \"actual\": 6, \"expected\": 9, \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}