FAILURE MAP
← Case archive

FA-81611 / MIDI event timing / Open access

Format 1 to format 0 track merge: last track's end-of-track wins · case 01

If an earlier track ends later than the last track, the merged end-of-track moves earlier.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The end time is overwritten by each end-of-track instead of keeping the maximum.

VERIFIED REPAIR

Restore the merged end time step so that it reads `end = max(end, tick)`.

Unsuccessful approach: Subtracting the end-of-track delta records the time of the previous event instead of the end marker.

Case contract

Input a list of tracks, each a list of [delta, event]. The event "eot" marks end of track and is not copied. Merge all events by absolute time; ties go to the lower track index, then original order. Output [delta, event] pairs followed by one final [delta, "eot"] at the latest end-of-track or last event time.

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
    events = []
    end = 0
    for ti, track in enumerate(x):
        tick = 0
        for seq, (delta, ev) in enumerate(track):
            tick += delta
            if ev == 'eot':
                end = tick
                continue
            events.append((tick, ti, seq, ev))
    events.sort()
    out = []
    prev = 0
    for tick, ti, seq, ev in events:
        out.append([tick - prev, ev])
        prev = tick
    end = max(end, prev)
    out.append([end - prev, 'eot'])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']])], [([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])]]
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 fixtureActualExpectedOutcome
oracle 0[[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']][[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]Passed
oracle 1[[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']][[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]Passed
oracle 2[[10, 'z'], [0, 'a'], [0, 'eot']][[10, 'z'], [0, 'a'], [0, 'eot']]Passed
oracle 3[[0, 'x'], [50, 'y'], [0, 'eot']][[0, 'x'], [50, 'y'], [50, 'eot']]Failed
oracle 4[[0, 'x'], [50, 'y'], [0, 'eot']][[0, 'x'], [50, 'y'], [0, 'eot']]Passed
oracle 5[[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']][[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]Passed
oracle 6[[0, 'eot']][[0, 'eot']]Passed
oracle 7[[0, 'eot']][[0, 'eot']]Passed

SHA-256 / ec4f7682e1ea2de69fb0e30de1a42baf09be64aff5256deb33750d2660b8f423

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
    events = []
    end = 0
    for ti, track in enumerate(x):
        tick = 0
        for seq, (delta, ev) in enumerate(track):
            tick += delta
            if ev == 'eot':
                end = max(end, tick - delta)
                continue
            events.append((tick, ti, seq, ev))
    events.sort()
    out = []
    prev = 0
    for tick, ti, seq, ev in events:
        out.append([tick - prev, ev])
        prev = tick
    end = max(end, prev)
    out.append([end - prev, 'eot'])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']])], [([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])]]
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 fixtureActualExpectedOutcome
oracle 0[[0, 'a'], [5, 'c'], [5, 'b'], [0, 'eot']][[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]Failed
oracle 1[[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']][[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]Passed
oracle 2[[10, 'z'], [0, 'a'], [0, 'eot']][[10, 'z'], [0, 'a'], [0, 'eot']]Passed
oracle 3[[0, 'x'], [50, 'y'], [0, 'eot']][[0, 'x'], [50, 'y'], [50, 'eot']]Failed
oracle 4[[0, 'x'], [50, 'y'], [0, 'eot']][[0, 'x'], [50, 'y'], [0, 'eot']]Passed
oracle 5[[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']][[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]Passed
oracle 6[[0, 'eot']][[0, 'eot']]Passed
oracle 7[[0, 'eot']][[0, 'eot']]Passed

SHA-256 / e58e569a64ed17e4ddb5538df4a2bf5eeab6433beba32d4d3fc4b065100490b9

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
    events = []
    end = 0
    for ti, track in enumerate(x):
        tick = 0
        for seq, (delta, ev) in enumerate(track):
            tick += delta
            if ev == 'eot':
                end = max(end, tick)
                continue
            events.append((tick, ti, seq, ev))
    events.sort()
    out = []
    prev = 0
    for tick, ti, seq, ev in events:
        out.append([tick - prev, ev])
        prev = tick
    end = max(end, prev)
    out.append([end - prev, 'eot'])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']])], [([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])]]
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 fixtureActualExpectedOutcome
oracle 0[[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']][[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]Passed
oracle 1[[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']][[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]Passed
oracle 2[[10, 'z'], [0, 'a'], [0, 'eot']][[10, 'z'], [0, 'a'], [0, 'eot']]Passed
oracle 3[[0, 'x'], [50, 'y'], [50, 'eot']][[0, 'x'], [50, 'y'], [50, 'eot']]Passed
oracle 4[[0, 'x'], [50, 'y'], [0, 'eot']][[0, 'x'], [50, 'y'], [0, 'eot']]Passed
oracle 5[[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']][[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]Passed
oracle 6[[0, 'eot']][[0, 'eot']]Passed
oracle 7[[0, 'eot']][[0, 'eot']]Passed

SHA-256 / 94ede73612601d06d2dbac06180f469bab8621bbccb7fe880017dcfb0239fdff

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:04.483747+00:00.

Case digest / edc0bce9d5219105328d3c8b3d48438d8f2911645c1907fa84d34976aaec82c3