FA-81436 / MIDI event timing / Open access
Note-on and note-off pairing into durations: overlapping same-pitch notes matched last-in first-out · case 01
With two overlapping C4 notes, the first note-off ends the later note, swapping the two durations.
ROOT CAUSE
Open notes for a key are matched from the end of the list (LIFO) instead of the front (FIFO).
VERIFIED REPAIR
Restore the overlap matching order step so that it reads `start, v, c, n = active[key].pop(0) done.append([start, tick, c, n, v])`.
Unsuccessful approach: Ending all open notes of the key at the first note-off truncates the later note.
Case contract
Input time-ordered events [tick, kind, channel, note, velocity] with kind on or off. A note-on with velocity 0 acts as a note-off. Each off ends the earliest still-open note with the same channel and note (FIFO); unmatched offs are ignored. Notes still open at the end end at the last event tick. Return [start, end, channel, note, on-velocity] sorted by start, note, channel, end.
Why this case matters
MIDI sequencers, file readers and synth drivers depend on exact event ordering and tick/time arithmetic.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list):
return None
active = {}
done = []
last = 0
for tick, kind, ch, note, vel in x:
last = max(last, tick)
key = (ch, note)
if kind == 'on' and vel > 0:
active.setdefault(key, []).append((tick, vel, ch, note))
elif kind in ('on', 'off'):
if active.get(key):
start, v, c, n = active[key].pop()
done.append([start, tick, c, n, v])
for stack in active.values():
for start, v, c, n in stack:
done.append([start, last, c, n, v])
done.sort(key=lambda e: (e[0], e[3], e[2], e[1]))
return done
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [5, 'on', 1, 60, 80], [10, 'off', 1, 60, 0], [20, 'off', 0, 60, 0]], [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 0, 64, 100], [0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0], [12, 'off', 0, 64, 0]], [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]])], [([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 0, 64, 100], [0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0], [12, 'off', 0, 64, 0]], [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 60, 1], [3, 'off', 0, 60, 64]], [[0, 3, 0, 60, 1]]), ([], []), ([[0, 'on', 0, 60, 100], [5, 'off', 0, 60, 64], [6, 'on', 0, 60, 100], [9, 'off', 0, 60, 64]], [[0, 5, 0, 60, 100], [6, 9, 0, 60, 100]])], [([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 60, 1], [3, 'off', 0, 60, 64]], [[0, 3, 0, 60, 1]]), ([], []), ([[0, 'on', 0, 60, 100], [5, 'off', 0, 60, 64], [6, 'on', 0, 60, 100], [9, 'off', 0, 60, 64]], [[0, 5, 0, 60, 100], [6, 9, 0, 60, 100]]), ([[0, 'on', 0, 62, 100], [2, 'on', 0, 60, 100], [4, 'off', 0, 62, 0], [8, 'off', 0, 60, 0]], [[0, 4, 0, 62, 100], [2, 8, 0, 60, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]]), ([[0, 'on', 0, 60, 100], [2, 'on', 1, 60, 50], [4, 'off', 0, 60, 0], [6, 'off', 1, 60, 0]], [[0, 4, 0, 60, 100], [2, 6, 1, 60, 50]]), ([[0, 'on', 3, 70, 100], [1, 'on', 4, 70, 100], [5, 'off', 3, 70, 0], [6, 'off', 4, 70, 0]], [[0, 5, 3, 70, 100], [1, 6, 4, 70, 100]])], [([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 62, 100], [2, 'on', 0, 60, 100], [4, 'off', 0, 62, 0], [8, 'off', 0, 60, 0]], [[0, 4, 0, 62, 100], [2, 8, 0, 60, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]]), ([[0, 'on', 0, 60, 100], [2, 'on', 1, 60, 50], [4, 'off', 0, 60, 0], [6, 'off', 1, 60, 0]], [[0, 4, 0, 60, 100], [2, 6, 1, 60, 50]]), ([[0, 'on', 3, 70, 100], [1, 'on', 4, 70, 100], [5, 'off', 3, 70, 0], [6, 'off', 4, 70, 0]], [[0, 5, 3, 70, 100], [1, 6, 4, 70, 100]])], [([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [5, 'on', 1, 60, 80], [10, 'off', 1, 60, 0], [20, 'off', 0, 60, 0]], [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("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 |
|---|---|---|---|
| oracle 0 | [[0, 10, 0, 60, 100]] | [[0, 10, 0, 60, 100]] | Passed |
| oracle 1 | [[0, 10, 0, 60, 100]] | [[0, 10, 0, 60, 100]] | Passed |
| oracle 2 | [[0, 20, 0, 60, 100], [5, 10, 0, 60, 80]] | [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]] | Failed |
| oracle 3 | [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]] | [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]] | Passed |
| oracle 4 | [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]] | [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]] | Passed |
| oracle 5 | [[5, 9, 0, 62, 70]] | [[5, 9, 0, 62, 70]] | Passed |
| oracle 6 | [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]] | [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]] | Passed |
| oracle 7 | [[1, 9, 0, 60, 100], [3, 7, 0, 60, 50], [9, 9, 0, 72, 10]] | [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]] | Failed |
SHA-256 / c179a1cad61dbc5d32f4594457bb01b6c579b7e8c95f82ed35fd91ab6d59323e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list):
return None
active = {}
done = []
last = 0
for tick, kind, ch, note, vel in x:
last = max(last, tick)
key = (ch, note)
if kind == 'on' and vel > 0:
active.setdefault(key, []).append((tick, vel, ch, note))
elif kind in ('on', 'off'):
if active.get(key):
for start, v, c, n in active.pop(key):
done.append([start, tick, c, n, v])
for stack in active.values():
for start, v, c, n in stack:
done.append([start, last, c, n, v])
done.sort(key=lambda e: (e[0], e[3], e[2], e[1]))
return done
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [5, 'on', 1, 60, 80], [10, 'off', 1, 60, 0], [20, 'off', 0, 60, 0]], [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 0, 64, 100], [0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0], [12, 'off', 0, 64, 0]], [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]])], [([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 0, 64, 100], [0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0], [12, 'off', 0, 64, 0]], [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 60, 1], [3, 'off', 0, 60, 64]], [[0, 3, 0, 60, 1]]), ([], []), ([[0, 'on', 0, 60, 100], [5, 'off', 0, 60, 64], [6, 'on', 0, 60, 100], [9, 'off', 0, 60, 64]], [[0, 5, 0, 60, 100], [6, 9, 0, 60, 100]])], [([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 60, 1], [3, 'off', 0, 60, 64]], [[0, 3, 0, 60, 1]]), ([], []), ([[0, 'on', 0, 60, 100], [5, 'off', 0, 60, 64], [6, 'on', 0, 60, 100], [9, 'off', 0, 60, 64]], [[0, 5, 0, 60, 100], [6, 9, 0, 60, 100]]), ([[0, 'on', 0, 62, 100], [2, 'on', 0, 60, 100], [4, 'off', 0, 62, 0], [8, 'off', 0, 60, 0]], [[0, 4, 0, 62, 100], [2, 8, 0, 60, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]]), ([[0, 'on', 0, 60, 100], [2, 'on', 1, 60, 50], [4, 'off', 0, 60, 0], [6, 'off', 1, 60, 0]], [[0, 4, 0, 60, 100], [2, 6, 1, 60, 50]]), ([[0, 'on', 3, 70, 100], [1, 'on', 4, 70, 100], [5, 'off', 3, 70, 0], [6, 'off', 4, 70, 0]], [[0, 5, 3, 70, 100], [1, 6, 4, 70, 100]])], [([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 62, 100], [2, 'on', 0, 60, 100], [4, 'off', 0, 62, 0], [8, 'off', 0, 60, 0]], [[0, 4, 0, 62, 100], [2, 8, 0, 60, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]]), ([[0, 'on', 0, 60, 100], [2, 'on', 1, 60, 50], [4, 'off', 0, 60, 0], [6, 'off', 1, 60, 0]], [[0, 4, 0, 60, 100], [2, 6, 1, 60, 50]]), ([[0, 'on', 3, 70, 100], [1, 'on', 4, 70, 100], [5, 'off', 3, 70, 0], [6, 'off', 4, 70, 0]], [[0, 5, 3, 70, 100], [1, 6, 4, 70, 100]])], [([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [5, 'on', 1, 60, 80], [10, 'off', 1, 60, 0], [20, 'off', 0, 60, 0]], [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("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 |
|---|---|---|---|
| oracle 0 | [[0, 10, 0, 60, 100]] | [[0, 10, 0, 60, 100]] | Passed |
| oracle 1 | [[0, 10, 0, 60, 100]] | [[0, 10, 0, 60, 100]] | Passed |
| oracle 2 | [[0, 10, 0, 60, 100], [5, 10, 0, 60, 80]] | [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]] | Failed |
| oracle 3 | [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]] | [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]] | Passed |
| oracle 4 | [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]] | [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]] | Passed |
| oracle 5 | [[5, 9, 0, 62, 70]] | [[5, 9, 0, 62, 70]] | Passed |
| oracle 6 | [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]] | [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]] | Passed |
| oracle 7 | [[1, 7, 0, 60, 100], [3, 7, 0, 60, 50], [9, 9, 0, 72, 10]] | [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]] | Failed |
SHA-256 / d02ea5031e463c5ebe9d4238610f2e41d2eccad733c68d6a49ef2f128e684457
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list):
return None
active = {}
done = []
last = 0
for tick, kind, ch, note, vel in x:
last = max(last, tick)
key = (ch, note)
if kind == 'on' and vel > 0:
active.setdefault(key, []).append((tick, vel, ch, note))
elif kind in ('on', 'off'):
if active.get(key):
start, v, c, n = active[key].pop(0)
done.append([start, tick, c, n, v])
for stack in active.values():
for start, v, c, n in stack:
done.append([start, last, c, n, v])
done.sort(key=lambda e: (e[0], e[3], e[2], e[1]))
return done
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [5, 'on', 1, 60, 80], [10, 'off', 1, 60, 0], [20, 'off', 0, 60, 0]], [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 0, 64, 100], [0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0], [12, 'off', 0, 64, 0]], [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]])], [([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 0, 64, 100], [0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0], [12, 'off', 0, 64, 0]], [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 60, 1], [3, 'off', 0, 60, 64]], [[0, 3, 0, 60, 1]]), ([], []), ([[0, 'on', 0, 60, 100], [5, 'off', 0, 60, 64], [6, 'on', 0, 60, 100], [9, 'off', 0, 60, 64]], [[0, 5, 0, 60, 100], [6, 9, 0, 60, 100]])], [([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 60, 1], [3, 'off', 0, 60, 64]], [[0, 3, 0, 60, 1]]), ([], []), ([[0, 'on', 0, 60, 100], [5, 'off', 0, 60, 64], [6, 'on', 0, 60, 100], [9, 'off', 0, 60, 64]], [[0, 5, 0, 60, 100], [6, 9, 0, 60, 100]]), ([[0, 'on', 0, 62, 100], [2, 'on', 0, 60, 100], [4, 'off', 0, 62, 0], [8, 'off', 0, 60, 0]], [[0, 4, 0, 62, 100], [2, 8, 0, 60, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]]), ([[0, 'on', 0, 60, 100], [2, 'on', 1, 60, 50], [4, 'off', 0, 60, 0], [6, 'off', 1, 60, 0]], [[0, 4, 0, 60, 100], [2, 6, 1, 60, 50]]), ([[0, 'on', 3, 70, 100], [1, 'on', 4, 70, 100], [5, 'off', 3, 70, 0], [6, 'off', 4, 70, 0]], [[0, 5, 3, 70, 100], [1, 6, 4, 70, 100]])], [([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[0, 'on', 0, 62, 100], [2, 'on', 0, 60, 100], [4, 'off', 0, 62, 0], [8, 'off', 0, 60, 0]], [[0, 4, 0, 62, 100], [2, 8, 0, 60, 100]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]]), ([[0, 'on', 0, 60, 100], [2, 'on', 1, 60, 50], [4, 'off', 0, 60, 0], [6, 'off', 1, 60, 0]], [[0, 4, 0, 60, 100], [2, 6, 1, 60, 50]]), ([[0, 'on', 3, 70, 100], [1, 'on', 4, 70, 100], [5, 'off', 3, 70, 0], [6, 'off', 4, 70, 0]], [[0, 5, 3, 70, 100], [1, 6, 4, 70, 100]])], [([[0, 'on', 0, 60, 100], [10, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [10, 'on', 0, 60, 0]], [[0, 10, 0, 60, 100]]), ([[0, 'on', 0, 60, 100], [5, 'on', 0, 60, 80], [10, 'off', 0, 60, 0], [20, 'off', 0, 60, 0]], [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]]), ([[0, 'on', 0, 60, 100], [5, 'on', 1, 60, 80], [10, 'off', 1, 60, 0], [20, 'off', 0, 60, 0]], [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]]), ([[0, 'on', 0, 60, 100], [30, 'on', 0, 64, 90]], [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]]), ([[0, 'off', 0, 60, 0], [5, 'on', 0, 62, 70], [9, 'off', 0, 62, 40]], [[5, 9, 0, 62, 70]]), ([[0, 'on', 2, 60, 100], [4, 'on', 2, 60, 90], [8, 'on', 2, 60, 0], [9, 'on', 2, 60, 0]], [[0, 8, 2, 60, 100], [4, 9, 2, 60, 90]]), ([[1, 'on', 0, 60, 100], [3, 'on', 0, 60, 50], [7, 'off', 0, 60, 0], [9, 'on', 0, 72, 10]], [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("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 |
|---|---|---|---|
| oracle 0 | [[0, 10, 0, 60, 100]] | [[0, 10, 0, 60, 100]] | Passed |
| oracle 1 | [[0, 10, 0, 60, 100]] | [[0, 10, 0, 60, 100]] | Passed |
| oracle 2 | [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]] | [[0, 10, 0, 60, 100], [5, 20, 0, 60, 80]] | Passed |
| oracle 3 | [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]] | [[0, 20, 0, 60, 100], [5, 10, 1, 60, 80]] | Passed |
| oracle 4 | [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]] | [[0, 30, 0, 60, 100], [30, 30, 0, 64, 90]] | Passed |
| oracle 5 | [[5, 9, 0, 62, 70]] | [[5, 9, 0, 62, 70]] | Passed |
| oracle 6 | [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]] | [[0, 10, 0, 60, 100], [0, 12, 0, 64, 100]] | Passed |
| oracle 7 | [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]] | [[1, 7, 0, 60, 100], [3, 9, 0, 60, 50], [9, 9, 0, 72, 10]] | Passed |
SHA-256 / e7f98b767dc2df854c0143d425b257c84cfe9725acccdfd46ef91a7f11c22146
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:50:03.099517+00:00.
Case digest / 7746db830c07c8a3b052ed2a676f6fe31ed1c25722d9a0ab64299c6ac856459c