FAILURE MAP
← Case archive

FA-78326 / Subtitle cue timing / Open access

Subtitle conform to an edit cut list: cut ordering · case 01

Unordered cut lists produce wrong shifts after the first cut.

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

ROOT CAUSE

Cuts are merged in the order supplied.

VERIFIED REPAIR

Sort cuts by start before merging.

Unsuccessful approach: Sorting in descending order breaks both merging and the cumulative walk.

Case contract

Cuts [a,b) are removed from the programme (they may overlap or be unsorted and are merged first). A time after a cut shifts left by the removed length; a time inside a cut maps to the cut point. Cues [start,end,text] are mapped and dropped when the mapped end is not after the mapped start.

Why this case matters

Subtitle timing defects shift, hide or overlap captions that viewers depend on for comprehension and accessibility.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cues, cuts):
    merged=[]
    for a,b in cuts:
        if merged and a<=merged[-1][1]:
            merged[-1][1]=max(merged[-1][1],b)
        else:
            merged.append([a,b])
    def mapt(t):
        shift=0
        for a,b in merged:
            if t>=b:
                shift+=b-a
            elif t>a:
                return a-shift
        return t-shift
    out=[]
    for s,e,txt in cues:
        ns,ne=mapt(s),mapt(e)
        if ne>ns:
            out.append([ns,ne,txt])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cut ordering', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: cut ordering', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('partial repair probe: cut ordering', [[[2500, 2800, 'c0']], [[500, 600], [1000, 2500], [2000, 2500]]], [[900, 1200, 'c0']]), ('partial repair variant: cut ordering', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[600, 2600, 'c0'], [2500, 3300, 'c1'], [0, 2000, 'c2']], [[1000, 1100]]], [[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]), ('normal control', [[[200, 1000, 'c0'], [200, 2200, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']], [[2000, 2500]]], [[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']]), ('normal control', [[[2500, 4500, 'c0'], [4000, 6000, 'c1'], [900, 2900, 'c2'], [200, 2200, 'c3']], [[500, 600], [500, 1000]]], [[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']])], [('regression: cut ordering', [[[3200, 5200, 'c0'], [200, 2200, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']], [[3000, 3100], [2000, 2100]]], [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']]), ('regression variant: cut ordering', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']]), ('partial repair probe: cut ordering', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('partial repair variant: cut ordering', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[600, 700, 'c0'], [900, 1000, 'c1'], [4000, 6000, 'c2']], [[500, 600]]], [[500, 600, 'c0'], [800, 900, 'c1'], [3900, 5900, 'c2']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, 'c1']]), ('normal control', [[[600, 700, 'c0'], [3200, 3500, 'c1'], [600, 1400, 'c2'], [200, 2200, 'c3']], [[1500, 2500]]], [[600, 700, 'c0'], [2200, 2500, 'c1'], [600, 1400, 'c2'], [200, 1500, 'c3']])], [('regression: cut ordering', [[[600, 2600, 'c0'], [1200, 2000, 'c1'], [200, 2200, 'c2'], [1200, 3200, 'c3']], [[3000, 4000], [1500, 2500], [2000, 3500]]], [[600, 1500, 'c0'], [1200, 1500, 'c1'], [200, 1500, 'c2'], [1200, 1500, 'c3']]), ('regression variant: cut ordering', [[[200, 300, 'c0'], [600, 900, 'c1'], [4000, 4300, 'c2'], [2500, 3300, 'c3']], [[2000, 2500], [2000, 3000], [1500, 2500]]], [[200, 300, 'c0'], [600, 900, 'c1'], [2500, 2800, 'c2'], [1500, 1800, 'c3']]), ('partial repair probe: cut ordering', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: cut ordering', [[[1200, 1500, 'c0'], [1200, 2000, 'c1'], [600, 2600, 'c2']], [[1000, 2500], [1500, 2500], [1000, 1100]]], [[600, 1100, 'c2']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[2500, 2800, 'c0'], [600, 1400, 'c1']], []], [[2500, 2800, 'c0'], [600, 1400, 'c1']]), ('normal control', [[[2500, 3300, 'c0']], []], [[2500, 3300, 'c0']]), ('normal control', [[[3200, 3300, 'c0'], [200, 500, 'c1'], [900, 2900, 'c2']], []], [[3200, 3300, 'c0'], [200, 500, 'c1'], [900, 2900, 'c2']])], [('regression: cut ordering', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('regression variant: cut ordering', [[[1200, 1500, 'c0']], [[1500, 2500], [2000, 2100], [500, 1000]]], [[700, 1000, 'c0']]), ('partial repair probe: cut ordering', [[[3200, 5200, 'c0'], [200, 2200, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']], [[3000, 3100], [2000, 2100]]], [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']]), ('partial repair variant: cut ordering', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[1200, 2000, 'c0'], [3200, 3300, 'c1'], [900, 1000, 'c2'], [1200, 1300, 'c3']], []], [[1200, 2000, 'c0'], [3200, 3300, 'c1'], [900, 1000, 'c2'], [1200, 1300, 'c3']]), ('normal control', [[[600, 1400, 'c0'], [0, 300, 'c1']], [[3000, 4000]]], [[600, 1400, 'c0'], [0, 300, 'c1']]), ('normal control', [[[200, 500, 'c0'], [1200, 2000, 'c1']], [[2000, 2500], [2000, 3000]]], [[200, 500, 'c0'], [1200, 2000, 'c1']])], [('regression: cut ordering', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('regression variant: cut ordering', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']]), ('partial repair probe: cut ordering', [[[600, 2600, 'c0'], [1200, 2000, 'c1'], [200, 2200, 'c2'], [1200, 3200, 'c3']], [[3000, 4000], [1500, 2500], [2000, 3500]]], [[600, 1500, 'c0'], [1200, 1500, 'c1'], [200, 1500, 'c2'], [1200, 1500, 'c3']]), ('partial repair variant: cut ordering', [[[4000, 6000, 'c0'], [200, 1000, 'c1']], [[0, 500], [500, 600]]], [[3400, 5400, 'c0'], [0, 400, 'c1']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[2500, 2600, 'c0']], []], [[2500, 2600, 'c0']]), ('normal control', [[[2500, 4500, 'c0'], [1600, 3600, 'c1']], [[0, 1500]]], [[1000, 3000, 'c0'], [100, 2100, 'c1']]), ('normal control', [[[900, 1200, 'c0'], [200, 1000, 'c1'], [1200, 2000, 'c2']], []], [[900, 1200, 'c0'], [200, 1000, 'c1'], [1200, 2000, 'c2']])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: cut ordering[[0, 800, 'c0'], [0, 800, 'c2']][]Failed
regression variant: cut ordering[[1500, 1800, 'c0'], [200, 500, 'c1']][[500, 800, 'c0']]Failed
partial repair probe: cut ordering[[900, 1200, 'c0']][[900, 1200, 'c0']]Passed
partial repair variant: cut ordering[[900, 1000, 'c2']][[900, 1000, 'c2']]Passed
boundary control[[1000, 1300, 'a']][[1000, 1300, 'a']]Passed
boundary control[][]Passed
normal control[[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']][[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]Passed
normal control[[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']][[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']]Passed
normal control[[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']][[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']]Passed

SHA-256 / 0a44571cd084d74962aad77cae8414a5b419185f318be89a7d71313b7895865b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cues, cuts):
    merged=[]
    for a,b in sorted(cuts,reverse=True):
        if merged and a<=merged[-1][1]:
            merged[-1][1]=max(merged[-1][1],b)
        else:
            merged.append([a,b])
    def mapt(t):
        shift=0
        for a,b in merged:
            if t>=b:
                shift+=b-a
            elif t>a:
                return a-shift
        return t-shift
    out=[]
    for s,e,txt in cues:
        ns,ne=mapt(s),mapt(e)
        if ne>ns:
            out.append([ns,ne,txt])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cut ordering', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: cut ordering', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('partial repair probe: cut ordering', [[[2500, 2800, 'c0']], [[500, 600], [1000, 2500], [2000, 2500]]], [[900, 1200, 'c0']]), ('partial repair variant: cut ordering', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[600, 2600, 'c0'], [2500, 3300, 'c1'], [0, 2000, 'c2']], [[1000, 1100]]], [[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]), ('normal control', [[[200, 1000, 'c0'], [200, 2200, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']], [[2000, 2500]]], [[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']]), ('normal control', [[[2500, 4500, 'c0'], [4000, 6000, 'c1'], [900, 2900, 'c2'], [200, 2200, 'c3']], [[500, 600], [500, 1000]]], [[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']])], [('regression: cut ordering', [[[3200, 5200, 'c0'], [200, 2200, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']], [[3000, 3100], [2000, 2100]]], [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']]), ('regression variant: cut ordering', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']]), ('partial repair probe: cut ordering', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('partial repair variant: cut ordering', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[600, 700, 'c0'], [900, 1000, 'c1'], [4000, 6000, 'c2']], [[500, 600]]], [[500, 600, 'c0'], [800, 900, 'c1'], [3900, 5900, 'c2']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, 'c1']]), ('normal control', [[[600, 700, 'c0'], [3200, 3500, 'c1'], [600, 1400, 'c2'], [200, 2200, 'c3']], [[1500, 2500]]], [[600, 700, 'c0'], [2200, 2500, 'c1'], [600, 1400, 'c2'], [200, 1500, 'c3']])], [('regression: cut ordering', [[[600, 2600, 'c0'], [1200, 2000, 'c1'], [200, 2200, 'c2'], [1200, 3200, 'c3']], [[3000, 4000], [1500, 2500], [2000, 3500]]], [[600, 1500, 'c0'], [1200, 1500, 'c1'], [200, 1500, 'c2'], [1200, 1500, 'c3']]), ('regression variant: cut ordering', [[[200, 300, 'c0'], [600, 900, 'c1'], [4000, 4300, 'c2'], [2500, 3300, 'c3']], [[2000, 2500], [2000, 3000], [1500, 2500]]], [[200, 300, 'c0'], [600, 900, 'c1'], [2500, 2800, 'c2'], [1500, 1800, 'c3']]), ('partial repair probe: cut ordering', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: cut ordering', [[[1200, 1500, 'c0'], [1200, 2000, 'c1'], [600, 2600, 'c2']], [[1000, 2500], [1500, 2500], [1000, 1100]]], [[600, 1100, 'c2']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[2500, 2800, 'c0'], [600, 1400, 'c1']], []], [[2500, 2800, 'c0'], [600, 1400, 'c1']]), ('normal control', [[[2500, 3300, 'c0']], []], [[2500, 3300, 'c0']]), ('normal control', [[[3200, 3300, 'c0'], [200, 500, 'c1'], [900, 2900, 'c2']], []], [[3200, 3300, 'c0'], [200, 500, 'c1'], [900, 2900, 'c2']])], [('regression: cut ordering', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('regression variant: cut ordering', [[[1200, 1500, 'c0']], [[1500, 2500], [2000, 2100], [500, 1000]]], [[700, 1000, 'c0']]), ('partial repair probe: cut ordering', [[[3200, 5200, 'c0'], [200, 2200, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']], [[3000, 3100], [2000, 2100]]], [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']]), ('partial repair variant: cut ordering', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[1200, 2000, 'c0'], [3200, 3300, 'c1'], [900, 1000, 'c2'], [1200, 1300, 'c3']], []], [[1200, 2000, 'c0'], [3200, 3300, 'c1'], [900, 1000, 'c2'], [1200, 1300, 'c3']]), ('normal control', [[[600, 1400, 'c0'], [0, 300, 'c1']], [[3000, 4000]]], [[600, 1400, 'c0'], [0, 300, 'c1']]), ('normal control', [[[200, 500, 'c0'], [1200, 2000, 'c1']], [[2000, 2500], [2000, 3000]]], [[200, 500, 'c0'], [1200, 2000, 'c1']])], [('regression: cut ordering', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('regression variant: cut ordering', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']]), ('partial repair probe: cut ordering', [[[600, 2600, 'c0'], [1200, 2000, 'c1'], [200, 2200, 'c2'], [1200, 3200, 'c3']], [[3000, 4000], [1500, 2500], [2000, 3500]]], [[600, 1500, 'c0'], [1200, 1500, 'c1'], [200, 1500, 'c2'], [1200, 1500, 'c3']]), ('partial repair variant: cut ordering', [[[4000, 6000, 'c0'], [200, 1000, 'c1']], [[0, 500], [500, 600]]], [[3400, 5400, 'c0'], [0, 400, 'c1']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[2500, 2600, 'c0']], []], [[2500, 2600, 'c0']]), ('normal control', [[[2500, 4500, 'c0'], [1600, 3600, 'c1']], [[0, 1500]]], [[1000, 3000, 'c0'], [100, 2100, 'c1']]), ('normal control', [[[900, 1200, 'c0'], [200, 1000, 'c1'], [1200, 2000, 'c2']], []], [[900, 1200, 'c0'], [200, 1000, 'c1'], [1200, 2000, 'c2']])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: cut ordering[[0, 800, 'c0'], [0, 800, 'c2']][]Failed
regression variant: cut ordering[[1500, 1800, 'c0'], [200, 500, 'c1']][[500, 800, 'c0']]Failed
partial repair probe: cut ordering[[2000, 2300, 'c0']][[900, 1200, 'c0']]Failed
partial repair variant: cut ordering[[1600, 1700, 'c0'], [900, 1700, 'c2'], [1600, 1900, 'c3']][[900, 1000, 'c2']]Failed
boundary control[[1000, 1300, 'a']][[1000, 1300, 'a']]Passed
boundary control[][]Passed
normal control[[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']][[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]Passed
normal control[[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']][[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']]Passed
normal control[[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']][[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']]Passed

SHA-256 / b1d0183ed9576477d58a2ac3df92bf661e14218c0f1c730ba5af7e70073b3cbe

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cues, cuts):
    merged=[]
    for a,b in sorted(cuts):
        if merged and a<=merged[-1][1]:
            merged[-1][1]=max(merged[-1][1],b)
        else:
            merged.append([a,b])
    def mapt(t):
        shift=0
        for a,b in merged:
            if t>=b:
                shift+=b-a
            elif t>a:
                return a-shift
        return t-shift
    out=[]
    for s,e,txt in cues:
        ns,ne=mapt(s),mapt(e)
        if ne>ns:
            out.append([ns,ne,txt])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cut ordering', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: cut ordering', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('partial repair probe: cut ordering', [[[2500, 2800, 'c0']], [[500, 600], [1000, 2500], [2000, 2500]]], [[900, 1200, 'c0']]), ('partial repair variant: cut ordering', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[600, 2600, 'c0'], [2500, 3300, 'c1'], [0, 2000, 'c2']], [[1000, 1100]]], [[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]), ('normal control', [[[200, 1000, 'c0'], [200, 2200, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']], [[2000, 2500]]], [[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']]), ('normal control', [[[2500, 4500, 'c0'], [4000, 6000, 'c1'], [900, 2900, 'c2'], [200, 2200, 'c3']], [[500, 600], [500, 1000]]], [[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']])], [('regression: cut ordering', [[[3200, 5200, 'c0'], [200, 2200, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']], [[3000, 3100], [2000, 2100]]], [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']]), ('regression variant: cut ordering', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']]), ('partial repair probe: cut ordering', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('partial repair variant: cut ordering', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[600, 700, 'c0'], [900, 1000, 'c1'], [4000, 6000, 'c2']], [[500, 600]]], [[500, 600, 'c0'], [800, 900, 'c1'], [3900, 5900, 'c2']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, 'c1']]), ('normal control', [[[600, 700, 'c0'], [3200, 3500, 'c1'], [600, 1400, 'c2'], [200, 2200, 'c3']], [[1500, 2500]]], [[600, 700, 'c0'], [2200, 2500, 'c1'], [600, 1400, 'c2'], [200, 1500, 'c3']])], [('regression: cut ordering', [[[600, 2600, 'c0'], [1200, 2000, 'c1'], [200, 2200, 'c2'], [1200, 3200, 'c3']], [[3000, 4000], [1500, 2500], [2000, 3500]]], [[600, 1500, 'c0'], [1200, 1500, 'c1'], [200, 1500, 'c2'], [1200, 1500, 'c3']]), ('regression variant: cut ordering', [[[200, 300, 'c0'], [600, 900, 'c1'], [4000, 4300, 'c2'], [2500, 3300, 'c3']], [[2000, 2500], [2000, 3000], [1500, 2500]]], [[200, 300, 'c0'], [600, 900, 'c1'], [2500, 2800, 'c2'], [1500, 1800, 'c3']]), ('partial repair probe: cut ordering', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: cut ordering', [[[1200, 1500, 'c0'], [1200, 2000, 'c1'], [600, 2600, 'c2']], [[1000, 2500], [1500, 2500], [1000, 1100]]], [[600, 1100, 'c2']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[2500, 2800, 'c0'], [600, 1400, 'c1']], []], [[2500, 2800, 'c0'], [600, 1400, 'c1']]), ('normal control', [[[2500, 3300, 'c0']], []], [[2500, 3300, 'c0']]), ('normal control', [[[3200, 3300, 'c0'], [200, 500, 'c1'], [900, 2900, 'c2']], []], [[3200, 3300, 'c0'], [200, 500, 'c1'], [900, 2900, 'c2']])], [('regression: cut ordering', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('regression variant: cut ordering', [[[1200, 1500, 'c0']], [[1500, 2500], [2000, 2100], [500, 1000]]], [[700, 1000, 'c0']]), ('partial repair probe: cut ordering', [[[3200, 5200, 'c0'], [200, 2200, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']], [[3000, 3100], [2000, 2100]]], [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']]), ('partial repair variant: cut ordering', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[1200, 2000, 'c0'], [3200, 3300, 'c1'], [900, 1000, 'c2'], [1200, 1300, 'c3']], []], [[1200, 2000, 'c0'], [3200, 3300, 'c1'], [900, 1000, 'c2'], [1200, 1300, 'c3']]), ('normal control', [[[600, 1400, 'c0'], [0, 300, 'c1']], [[3000, 4000]]], [[600, 1400, 'c0'], [0, 300, 'c1']]), ('normal control', [[[200, 500, 'c0'], [1200, 2000, 'c1']], [[2000, 2500], [2000, 3000]]], [[200, 500, 'c0'], [1200, 2000, 'c1']])], [('regression: cut ordering', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('regression variant: cut ordering', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']]), ('partial repair probe: cut ordering', [[[600, 2600, 'c0'], [1200, 2000, 'c1'], [200, 2200, 'c2'], [1200, 3200, 'c3']], [[3000, 4000], [1500, 2500], [2000, 3500]]], [[600, 1500, 'c0'], [1200, 1500, 'c1'], [200, 1500, 'c2'], [1200, 1500, 'c3']]), ('partial repair variant: cut ordering', [[[4000, 6000, 'c0'], [200, 1000, 'c1']], [[0, 500], [500, 600]]], [[3400, 5400, 'c0'], [0, 400, 'c1']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('normal control', [[[2500, 2600, 'c0']], []], [[2500, 2600, 'c0']]), ('normal control', [[[2500, 4500, 'c0'], [1600, 3600, 'c1']], [[0, 1500]]], [[1000, 3000, 'c0'], [100, 2100, 'c1']]), ('normal control', [[[900, 1200, 'c0'], [200, 1000, 'c1'], [1200, 2000, 'c2']], []], [[900, 1200, 'c0'], [200, 1000, 'c1'], [1200, 2000, 'c2']])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: cut ordering[][]Passed
regression variant: cut ordering[[500, 800, 'c0']][[500, 800, 'c0']]Passed
partial repair probe: cut ordering[[900, 1200, 'c0']][[900, 1200, 'c0']]Passed
partial repair variant: cut ordering[[900, 1000, 'c2']][[900, 1000, 'c2']]Passed
boundary control[[1000, 1300, 'a']][[1000, 1300, 'a']]Passed
boundary control[][]Passed
normal control[[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']][[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]Passed
normal control[[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']][[200, 1000, 'c0'], [200, 2000, 'c1'], [0, 100, 'c2'], [200, 300, 'c3']]Passed
normal control[[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']][[2000, 4000, 'c0'], [3500, 5500, 'c1'], [500, 2400, 'c2'], [200, 1700, 'c3']]Passed

SHA-256 / e92fc64410c14f7b23837692dfccb96530a6f6e776e7eb42058432d1c0afd739

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; it does not claim conformance to any subtitle 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:49:34.076630+00:00.

Case digest / 876d7dc8f2e4540a3932c23f81524f51ced6ca686a4a4605fdf65d7c8b5fc3b7