{"abstract":"Events inserted out of time order are dispatched out of order within a window.","category":"MIDI event timing","checks":8,"contract":"Input [events, windows]: events are [time_ms, id]; windows are [now, lookahead] processed in order. In each window, walk not-yet-handled events in time order: an event more than 20 ms late (time < now - 20) is dropped (reported once); an event with time < now + lookahead is dispatched in that window (late events within tolerance included). Return {\"batches\": ids per window, \"dropped\": ids}.","contract_signature":"x","evaluation_group":"w2-midi-event-timing-lookahead-dispatch","failed_approach":"Sorting by identifier is still not chronological.","family":"w2-midi-event-timing-lookahead-dispatch-dispatch-order","id":"FA-81636","implementations":{"attempt":{"sha256":"281410be477d37fb85abb7e73d0cabcaff72d485061fe78db6ee9e69bac3bdb2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if not isinstance(x, list) or len(x) != 2:\n        return None\n    events, windows = x\n    sent = set()\n    batches = []\n    dropped = []\n    for now, ahead in windows:\n        batch = []\n        for t, eid in sorted(events, key=lambda e: e[1]):\n            if eid in sent:\n                continue\n            if t < now - 20:\n                sent.add(eid)\n                dropped.append(eid)\n            elif t < now + ahead:\n                sent.add(eid)\n                batch.append(eid)\n        batches.append(batch)\n    return {'batches': batches, 'dropped': dropped}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([[[0, 'a'], [25, 'b'], [50, 'c']], [[0, 25], [25, 25], [50, 25]]], {'batches': [['a'], ['b'], ['c']], 'dropped': []}), ([[[10, 'a'], [30, 'b']], [[0, 30], [30, 30]]], {'batches': [['a'], ['b']], 'dropped': []}), ([[[5, 'a']], [[30, 10]]], {'batches': [[]], 'dropped': ['a']}), ([[[9, 'a']], [[30, 10], [40, 10]]], {'batches': [[], []], 'dropped': ['a']}), ([[[10, 'a']], [[30, 10]]], {'batches': [['a']], 'dropped': []}), ([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[9, 'a']], [[30, 10], [40, 10]]], {'batches': [[], []], 'dropped': ['a']}), ([[[10, 'a']], [[30, 10]]], {'batches': [['a']], 'dropped': []}), ([[[100, 'x'], [0, 'y']], [[0, 50], [50, 100]]], {'batches': [['y'], ['x']], 'dropped': []}), ([[[3, 'z'], [3, 'y']], [[0, 10]]], {'batches': [['y', 'z']], 'dropped': []}), ([[[0, 'a'], [100, 'b']], [[200, 10], [210, 10]]], {'batches': [[], []], 'dropped': ['a', 'b']}), ([[[49, 'a'], [50, 'b']], [[0, 50]]], {'batches': [['a']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[0, 'a'], [100, 'b']], [[200, 10], [210, 10]]], {'batches': [[], []], 'dropped': ['a', 'b']}), ([[[49, 'a'], [50, 'b']], [[0, 50]]], {'batches': [['a']], 'dropped': []}), ([[[15, 'q'], [70, 'r']], [[40, 20], [60, 20], [80, 20]]], {'batches': [[], ['r'], []], 'dropped': ['q']}), ([[], [[0, 10]]], {'batches': [[]], 'dropped': []}), ([[[5, 'late']], [[25, 5], [26, 5]]], {'batches': [['late'], []], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[0, 'a'], [25, 'b'], [50, 'c']], [[0, 25], [25, 25], [50, 25]]], {'batches': [['a'], ['b'], ['c']], 'dropped': []}), ([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[3, 'z'], [3, 'y']], [[0, 10]]], {'batches': [['y', 'z']], 'dropped': []}), ([[], [[0, 10]]], {'batches': [[]], 'dropped': []}), ([[[5, 'late']], [[25, 5], [26, 5]]], {'batches': [['late'], []], 'dropped': []}), ([[[60, 'm'], [61, 'n']], [[0, 60], [60, 1]]], {'batches': [[], ['m']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[0, 'a'], [25, 'b'], [50, 'c']], [[0, 25], [25, 25], [50, 25]]], {'batches': [['a'], ['b'], ['c']], 'dropped': []}), ([[[10, 'a'], [30, 'b']], [[0, 30], [30, 30]]], {'batches': [['a'], ['b']], 'dropped': []}), ([[[5, 'a']], [[30, 10]]], {'batches': [[]], 'dropped': ['a']}), ([[[9, 'a']], [[30, 10], [40, 10]]], {'batches': [[], []], 'dropped': ['a']}), ([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[3, 'z'], [3, 'y']], [[0, 10]]], {'batches': [['y', 'z']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"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":"c26c6bd2176fef2bbd1756ff5798abb96d0b8fa5620a2a5ae789ac063224b7c5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if not isinstance(x, list) or len(x) != 2:\n        return None\n    events, windows = x\n    sent = set()\n    batches = []\n    dropped = []\n    for now, ahead in windows:\n        batch = []\n        for t, eid in events:\n            if eid in sent:\n                continue\n            if t < now - 20:\n                sent.add(eid)\n                dropped.append(eid)\n            elif t < now + ahead:\n                sent.add(eid)\n                batch.append(eid)\n        batches.append(batch)\n    return {'batches': batches, 'dropped': dropped}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([[[0, 'a'], [25, 'b'], [50, 'c']], [[0, 25], [25, 25], [50, 25]]], {'batches': [['a'], ['b'], ['c']], 'dropped': []}), ([[[10, 'a'], [30, 'b']], [[0, 30], [30, 30]]], {'batches': [['a'], ['b']], 'dropped': []}), ([[[5, 'a']], [[30, 10]]], {'batches': [[]], 'dropped': ['a']}), ([[[9, 'a']], [[30, 10], [40, 10]]], {'batches': [[], []], 'dropped': ['a']}), ([[[10, 'a']], [[30, 10]]], {'batches': [['a']], 'dropped': []}), ([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[9, 'a']], [[30, 10], [40, 10]]], {'batches': [[], []], 'dropped': ['a']}), ([[[10, 'a']], [[30, 10]]], {'batches': [['a']], 'dropped': []}), ([[[100, 'x'], [0, 'y']], [[0, 50], [50, 100]]], {'batches': [['y'], ['x']], 'dropped': []}), ([[[3, 'z'], [3, 'y']], [[0, 10]]], {'batches': [['y', 'z']], 'dropped': []}), ([[[0, 'a'], [100, 'b']], [[200, 10], [210, 10]]], {'batches': [[], []], 'dropped': ['a', 'b']}), ([[[49, 'a'], [50, 'b']], [[0, 50]]], {'batches': [['a']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[0, 'a'], [100, 'b']], [[200, 10], [210, 10]]], {'batches': [[], []], 'dropped': ['a', 'b']}), ([[[49, 'a'], [50, 'b']], [[0, 50]]], {'batches': [['a']], 'dropped': []}), ([[[15, 'q'], [70, 'r']], [[40, 20], [60, 20], [80, 20]]], {'batches': [[], ['r'], []], 'dropped': ['q']}), ([[], [[0, 10]]], {'batches': [[]], 'dropped': []}), ([[[5, 'late']], [[25, 5], [26, 5]]], {'batches': [['late'], []], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[0, 'a'], [25, 'b'], [50, 'c']], [[0, 25], [25, 25], [50, 25]]], {'batches': [['a'], ['b'], ['c']], 'dropped': []}), ([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[3, 'z'], [3, 'y']], [[0, 10]]], {'batches': [['y', 'z']], 'dropped': []}), ([[], [[0, 10]]], {'batches': [[]], 'dropped': []}), ([[[5, 'late']], [[25, 5], [26, 5]]], {'batches': [['late'], []], 'dropped': []}), ([[[60, 'm'], [61, 'n']], [[0, 60], [60, 1]]], {'batches': [[], ['m']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})], [([[[0, 'a'], [25, 'b'], [50, 'c']], [[0, 25], [25, 25], [50, 25]]], {'batches': [['a'], ['b'], ['c']], 'dropped': []}), ([[[10, 'a'], [30, 'b']], [[0, 30], [30, 30]]], {'batches': [['a'], ['b']], 'dropped': []}), ([[[5, 'a']], [[30, 10]]], {'batches': [[]], 'dropped': ['a']}), ([[[9, 'a']], [[30, 10], [40, 10]]], {'batches': [[], []], 'dropped': ['a']}), ([[[30, 'b'], [20, 'a']], [[0, 40]]], {'batches': [['a', 'b']], 'dropped': []}), ([[[3, 'z'], [3, 'y']], [[0, 10]]], {'batches': [['y', 'z']], 'dropped': []}), ([[[30, 'a'], [20, 'b']], [[0, 40]]], {'batches': [['b', 'a']], 'dropped': []}), ([[[5, 'z'], [1, 'y'], [3, 'x']], [[0, 10]]], {'batches': [['y', 'x', 'z']], 'dropped': []})]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"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 teaching model with a stipulated toy contract; it is not a complete Standard MIDI File or MIDI 1.0/2.0 implementation. 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-midi-event-timing-lookahead-dispatch-dispatch-order","generated_at":"2026-09-29T14:50:04.924629+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"MIDI sequencers, file readers and synth drivers depend on exact event ordering and tick/time arithmetic.","root_cause":"The scheduler walks the event list as inserted instead of by time.","sha256":"b8d47b53fa7270af654b0899cb7f77d72f17b038c0ae3ad18a59527d855930af","title":"Lookahead scheduler dispatch windows: events dispatched in insertion order · 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":40.412,"exit_code":1,"observations":[{"actual":{"batches":[["a"],["b"],["c"]],"dropped":[]},"check":"oracle 0","expected":{"batches":[["a"],["b"],["c"]],"dropped":[]},"passed":true},{"actual":{"batches":[["a"],["b"]],"dropped":[]},"check":"oracle 1","expected":{"batches":[["a"],["b"]],"dropped":[]},"passed":true},{"actual":{"batches":[[]],"dropped":["a"]},"check":"oracle 2","expected":{"batches":[[]],"dropped":["a"]},"passed":true},{"actual":{"batches":[[],[]],"dropped":["a"]},"check":"oracle 3","expected":{"batches":[[],[]],"dropped":["a"]},"passed":true},{"actual":{"batches":[["a"]],"dropped":[]},"check":"oracle 4","expected":{"batches":[["a"]],"dropped":[]},"passed":true},{"actual":{"batches":[["a","b"]],"dropped":[]},"check":"oracle 5","expected":{"batches":[["a","b"]],"dropped":[]},"passed":true},{"actual":{"batches":[["a","b"]],"dropped":[]},"check":"oracle 6","expected":{"batches":[["b","a"]],"dropped":[]},"passed":false},{"actual":{"batches":[["x","y","z"]],"dropped":[]},"check":"oracle 7","expected":{"batches":[["y","x","z"]],"dropped":[]},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"oracle 0\", \"actual\": {\"batches\": [[\"a\"], [\"b\"], [\"c\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\"], [\"b\"], [\"c\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 1\", \"actual\": {\"batches\": [[\"a\"], [\"b\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\"], [\"b\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 2\", \"actual\": {\"batches\": [[]], \"dropped\": [\"a\"]}, \"expected\": {\"batches\": [[]], \"dropped\": [\"a\"]}, \"passed\": true}, {\"check\": \"oracle 3\", \"actual\": {\"batches\": [[], []], \"dropped\": [\"a\"]}, \"expected\": {\"batches\": [[], []], \"dropped\": [\"a\"]}, \"passed\": true}, {\"check\": \"oracle 4\", \"actual\": {\"batches\": [[\"a\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 5\", \"actual\": {\"batches\": [[\"a\", \"b\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\", \"b\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 6\", \"actual\": {\"batches\": [[\"a\", \"b\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"b\", \"a\"]], \"dropped\": []}, \"passed\": false}, {\"check\": \"oracle 7\", \"actual\": {\"batches\": [[\"x\", \"y\", \"z\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"y\", \"x\", \"z\"]], \"dropped\": []}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.6,"exit_code":1,"observations":[{"actual":{"batches":[["a"],["b"],["c"]],"dropped":[]},"check":"oracle 0","expected":{"batches":[["a"],["b"],["c"]],"dropped":[]},"passed":true},{"actual":{"batches":[["a"],["b"]],"dropped":[]},"check":"oracle 1","expected":{"batches":[["a"],["b"]],"dropped":[]},"passed":true},{"actual":{"batches":[[]],"dropped":["a"]},"check":"oracle 2","expected":{"batches":[[]],"dropped":["a"]},"passed":true},{"actual":{"batches":[[],[]],"dropped":["a"]},"check":"oracle 3","expected":{"batches":[[],[]],"dropped":["a"]},"passed":true},{"actual":{"batches":[["a"]],"dropped":[]},"check":"oracle 4","expected":{"batches":[["a"]],"dropped":[]},"passed":true},{"actual":{"batches":[["b","a"]],"dropped":[]},"check":"oracle 5","expected":{"batches":[["a","b"]],"dropped":[]},"passed":false},{"actual":{"batches":[["a","b"]],"dropped":[]},"check":"oracle 6","expected":{"batches":[["b","a"]],"dropped":[]},"passed":false},{"actual":{"batches":[["z","y","x"]],"dropped":[]},"check":"oracle 7","expected":{"batches":[["y","x","z"]],"dropped":[]},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"oracle 0\", \"actual\": {\"batches\": [[\"a\"], [\"b\"], [\"c\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\"], [\"b\"], [\"c\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 1\", \"actual\": {\"batches\": [[\"a\"], [\"b\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\"], [\"b\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 2\", \"actual\": {\"batches\": [[]], \"dropped\": [\"a\"]}, \"expected\": {\"batches\": [[]], \"dropped\": [\"a\"]}, \"passed\": true}, {\"check\": \"oracle 3\", \"actual\": {\"batches\": [[], []], \"dropped\": [\"a\"]}, \"expected\": {\"batches\": [[], []], \"dropped\": [\"a\"]}, \"passed\": true}, {\"check\": \"oracle 4\", \"actual\": {\"batches\": [[\"a\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\"]], \"dropped\": []}, \"passed\": true}, {\"check\": \"oracle 5\", \"actual\": {\"batches\": [[\"b\", \"a\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"a\", \"b\"]], \"dropped\": []}, \"passed\": false}, {\"check\": \"oracle 6\", \"actual\": {\"batches\": [[\"a\", \"b\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"b\", \"a\"]], \"dropped\": []}, \"passed\": false}, {\"check\": \"oracle 7\", \"actual\": {\"batches\": [[\"z\", \"y\", \"x\"]], \"dropped\": []}, \"expected\": {\"batches\": [[\"y\", \"x\", \"z\"]], \"dropped\": []}, \"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."}}