FA-78336 / Subtitle cue timing / Open access
Subtitle conform to an edit cut list: collapsed cue drop · case 01
Cues wholly inside a removed section survive as zero-length cues.
ROOT CAUSE
Mapped cues with equal start and end are kept.
VERIFIED REPAIR
Drop cues whose mapped end is not after the mapped start.
Unsuccessful approach: Testing the original times never drops cues collapsed by the cut.
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 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: collapsed cue drop', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('regression variant: collapsed cue drop', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('partial repair probe: collapsed cue drop', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: collapsed cue drop', [[[4000, 6000, 'c0'], [1600, 1700, 'c1']], [[500, 2000]]], [[2500, 4500, 'c0']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('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']])], [('regression: collapsed cue drop', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('regression variant: collapsed cue drop', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('partial repair probe: collapsed cue drop', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair variant: collapsed cue drop', [[[1600, 1900, 'c0'], [900, 1700, 'c1'], [3200, 3300, 'c2'], [0, 300, 'c3']], [[0, 500], [2000, 3500]]], [[1100, 1400, 'c0'], [400, 1200, 'c1']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('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']]), ('normal control', [[[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']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, 'c1']])], [('regression: collapsed cue drop', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: collapsed cue drop', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('partial repair probe: collapsed cue drop', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('partial repair variant: collapsed cue drop', [[[2500, 3300, 'c0'], [600, 1400, 'c1'], [1600, 3600, 'c2'], [600, 700, 'c3']], [[3000, 3500], [2000, 3000], [1000, 2000]]], [[600, 1000, 'c1'], [1000, 1100, 'c2'], [600, 700, 'c3']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[900, 1200, 'c0'], [2500, 3300, 'c1']], [[2000, 2500]]], [[900, 1200, 'c0'], [2000, 2800, 'c1']]), ('normal control', [[[2500, 2800, 'c0'], [600, 1400, 'c1']], []], [[2500, 2800, 'c0'], [600, 1400, 'c1']]), ('normal control', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']])], [('regression: collapsed cue drop', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('regression variant: collapsed cue drop', [[[1200, 1500, 'c0'], [1200, 2000, 'c1'], [600, 2600, 'c2']], [[1000, 2500], [1500, 2500], [1000, 1100]]], [[600, 1100, 'c2']]), ('partial repair probe: collapsed cue drop', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('partial repair variant: collapsed cue drop', [[[900, 2900, 'c0'], [3200, 3500, 'c1'], [2500, 2800, 'c2']], [[1500, 3000], [3000, 4000]]], [[900, 1500, 'c0']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[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']]), ('normal control', [[[1200, 2000, 'c0'], [0, 100, 'c1'], [3200, 4000, 'c2'], [2500, 2600, 'c3']], [[3000, 3100]]], [[1200, 2000, 'c0'], [0, 100, 'c1'], [3100, 3900, 'c2'], [2500, 2600, 'c3']]), ('normal control', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']])], [('regression: collapsed cue drop', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('regression variant: collapsed cue drop', [[[4000, 6000, 'c0'], [1600, 1700, 'c1']], [[500, 2000]]], [[2500, 4500, 'c0']]), ('partial repair probe: collapsed cue drop', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('partial repair variant: collapsed cue drop', [[[200, 1000, 'c0']], [[500, 1000], [0, 1000], [1000, 1500]]], []), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('normal control', [[[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']], []], [[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']]), ('normal control', [[[0, 800, 'c0'], [600, 1400, 'c1'], [600, 900, 'c2']], [[3000, 4500], [3000, 3100]]], [[0, 800, 'c0'], [600, 1400, 'c1'], [600, 900, 'c2']]), ('normal control', [[[1600, 2400, 'c0'], [4000, 4300, 'c1'], [1200, 3200, 'c2'], [2500, 2800, 'c3']], [[1000, 1500], [500, 600], [0, 1000]]], [[100, 900, 'c0'], [2500, 2800, 'c1'], [0, 1700, 'c2'], [1000, 1300, 'c3']])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: collapsed cue drop | [[1000, 1000, 'a']] | [] | Failed |
| regression variant: collapsed cue drop | [[0, 0, 'c0'], [1500, 1800, 'c1'], [0, 0, 'c2'], [700, 1500, 'c3']] | [[1500, 1800, 'c1'], [700, 1500, 'c3']] | Failed |
| partial repair probe: collapsed cue drop | [[0, 0, 'c0'], [1500, 1500, 'c1'], [0, 0, 'c2']] | [] | Failed |
| partial repair variant: collapsed cue drop | [[2500, 4500, 'c0'], [500, 500, 'c1']] | [[2500, 4500, 'c0']] | Failed |
| boundary control | [[1000, 1300, 'a']] | [[1000, 1300, 'a']] | Passed |
| boundary control | [[1500, 2000, 'a']] | [[1500, 2000, 'a']] | Passed |
| normal control | [[1200, 2200, 'x']] | [[1200, 2200, 'x']] | 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 |
SHA-256 / 66b67f504560d5011f57c288259bbd683151ac8e494464acc00d949e36ee8380
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):
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 e>s:
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: collapsed cue drop', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('regression variant: collapsed cue drop', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('partial repair probe: collapsed cue drop', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: collapsed cue drop', [[[4000, 6000, 'c0'], [1600, 1700, 'c1']], [[500, 2000]]], [[2500, 4500, 'c0']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('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']])], [('regression: collapsed cue drop', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('regression variant: collapsed cue drop', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('partial repair probe: collapsed cue drop', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair variant: collapsed cue drop', [[[1600, 1900, 'c0'], [900, 1700, 'c1'], [3200, 3300, 'c2'], [0, 300, 'c3']], [[0, 500], [2000, 3500]]], [[1100, 1400, 'c0'], [400, 1200, 'c1']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('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']]), ('normal control', [[[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']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, 'c1']])], [('regression: collapsed cue drop', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: collapsed cue drop', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('partial repair probe: collapsed cue drop', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('partial repair variant: collapsed cue drop', [[[2500, 3300, 'c0'], [600, 1400, 'c1'], [1600, 3600, 'c2'], [600, 700, 'c3']], [[3000, 3500], [2000, 3000], [1000, 2000]]], [[600, 1000, 'c1'], [1000, 1100, 'c2'], [600, 700, 'c3']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[900, 1200, 'c0'], [2500, 3300, 'c1']], [[2000, 2500]]], [[900, 1200, 'c0'], [2000, 2800, 'c1']]), ('normal control', [[[2500, 2800, 'c0'], [600, 1400, 'c1']], []], [[2500, 2800, 'c0'], [600, 1400, 'c1']]), ('normal control', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']])], [('regression: collapsed cue drop', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('regression variant: collapsed cue drop', [[[1200, 1500, 'c0'], [1200, 2000, 'c1'], [600, 2600, 'c2']], [[1000, 2500], [1500, 2500], [1000, 1100]]], [[600, 1100, 'c2']]), ('partial repair probe: collapsed cue drop', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('partial repair variant: collapsed cue drop', [[[900, 2900, 'c0'], [3200, 3500, 'c1'], [2500, 2800, 'c2']], [[1500, 3000], [3000, 4000]]], [[900, 1500, 'c0']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[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']]), ('normal control', [[[1200, 2000, 'c0'], [0, 100, 'c1'], [3200, 4000, 'c2'], [2500, 2600, 'c3']], [[3000, 3100]]], [[1200, 2000, 'c0'], [0, 100, 'c1'], [3100, 3900, 'c2'], [2500, 2600, 'c3']]), ('normal control', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']])], [('regression: collapsed cue drop', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('regression variant: collapsed cue drop', [[[4000, 6000, 'c0'], [1600, 1700, 'c1']], [[500, 2000]]], [[2500, 4500, 'c0']]), ('partial repair probe: collapsed cue drop', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('partial repair variant: collapsed cue drop', [[[200, 1000, 'c0']], [[500, 1000], [0, 1000], [1000, 1500]]], []), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('normal control', [[[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']], []], [[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']]), ('normal control', [[[0, 800, 'c0'], [600, 1400, 'c1'], [600, 900, 'c2']], [[3000, 4500], [3000, 3100]]], [[0, 800, 'c0'], [600, 1400, 'c1'], [600, 900, 'c2']]), ('normal control', [[[1600, 2400, 'c0'], [4000, 4300, 'c1'], [1200, 3200, 'c2'], [2500, 2800, 'c3']], [[1000, 1500], [500, 600], [0, 1000]]], [[100, 900, 'c0'], [2500, 2800, 'c1'], [0, 1700, 'c2'], [1000, 1300, 'c3']])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: collapsed cue drop | [[1000, 1000, 'a']] | [] | Failed |
| regression variant: collapsed cue drop | [[0, 0, 'c0'], [1500, 1800, 'c1'], [0, 0, 'c2'], [700, 1500, 'c3']] | [[1500, 1800, 'c1'], [700, 1500, 'c3']] | Failed |
| partial repair probe: collapsed cue drop | [[0, 0, 'c0'], [1500, 1500, 'c1'], [0, 0, 'c2']] | [] | Failed |
| partial repair variant: collapsed cue drop | [[2500, 4500, 'c0'], [500, 500, 'c1']] | [[2500, 4500, 'c0']] | Failed |
| boundary control | [[1000, 1300, 'a']] | [[1000, 1300, 'a']] | Passed |
| boundary control | [[1500, 2000, 'a']] | [[1500, 2000, 'a']] | Passed |
| normal control | [[1200, 2200, 'x']] | [[1200, 2200, 'x']] | 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 |
SHA-256 / 458deda261d788102a91f9d184940a8ed5da416154809fe053ce848ee8d57932
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: collapsed cue drop', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('regression variant: collapsed cue drop', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('partial repair probe: collapsed cue drop', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: collapsed cue drop', [[[4000, 6000, 'c0'], [1600, 1700, 'c1']], [[500, 2000]]], [[2500, 4500, 'c0']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('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']])], [('regression: collapsed cue drop', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('regression variant: collapsed cue drop', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('partial repair probe: collapsed cue drop', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair variant: collapsed cue drop', [[[1600, 1900, 'c0'], [900, 1700, 'c1'], [3200, 3300, 'c2'], [0, 300, 'c3']], [[0, 500], [2000, 3500]]], [[1100, 1400, 'c0'], [400, 1200, 'c1']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('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']]), ('normal control', [[[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']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, 'c1']])], [('regression: collapsed cue drop', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: collapsed cue drop', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('partial repair probe: collapsed cue drop', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('partial repair variant: collapsed cue drop', [[[2500, 3300, 'c0'], [600, 1400, 'c1'], [1600, 3600, 'c2'], [600, 700, 'c3']], [[3000, 3500], [2000, 3000], [1000, 2000]]], [[600, 1000, 'c1'], [1000, 1100, 'c2'], [600, 700, 'c3']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('normal control', [[[900, 1200, 'c0'], [2500, 3300, 'c1']], [[2000, 2500]]], [[900, 1200, 'c0'], [2000, 2800, 'c1']]), ('normal control', [[[2500, 2800, 'c0'], [600, 1400, 'c1']], []], [[2500, 2800, 'c0'], [600, 1400, 'c1']]), ('normal control', [[[200, 500, 'c0']], [[1500, 1600], [0, 100]]], [[100, 400, 'c0']])], [('regression: collapsed cue drop', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('regression variant: collapsed cue drop', [[[1200, 1500, 'c0'], [1200, 2000, 'c1'], [600, 2600, 'c2']], [[1000, 2500], [1500, 2500], [1000, 1100]]], [[600, 1100, 'c2']]), ('partial repair probe: collapsed cue drop', [[[1200, 2000, 'c0'], [4000, 4300, 'c1'], [200, 2200, 'c2'], [3200, 4000, 'c3']], [[1000, 2000], [0, 1500], [1500, 2500]]], [[1500, 1800, 'c1'], [700, 1500, 'c3']]), ('partial repair variant: collapsed cue drop', [[[900, 2900, 'c0'], [3200, 3500, 'c1'], [2500, 2800, 'c2']], [[1500, 3000], [3000, 4000]]], [[900, 1500, 'c0']]), ('boundary control', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[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']]), ('normal control', [[[1200, 2000, 'c0'], [0, 100, 'c1'], [3200, 4000, 'c2'], [2500, 2600, 'c3']], [[3000, 3100]]], [[1200, 2000, 'c0'], [0, 100, 'c1'], [3100, 3900, 'c2'], [2500, 2600, 'c3']]), ('normal control', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']])], [('regression: collapsed cue drop', [[[1600, 1900, 'c0'], [2500, 3300, 'c1'], [1600, 1900, 'c2'], [4000, 6000, 'c3']], [[500, 2000], [0, 1000]]], [[500, 1300, 'c1'], [2000, 4000, 'c3']]), ('regression variant: collapsed cue drop', [[[4000, 6000, 'c0'], [1600, 1700, 'c1']], [[500, 2000]]], [[2500, 4500, 'c0']]), ('partial repair probe: collapsed cue drop', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('partial repair variant: collapsed cue drop', [[[200, 1000, 'c0']], [[500, 1000], [0, 1000], [1000, 1500]]], []), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('normal control', [[[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']], []], [[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']]), ('normal control', [[[0, 800, 'c0'], [600, 1400, 'c1'], [600, 900, 'c2']], [[3000, 4500], [3000, 3100]]], [[0, 800, 'c0'], [600, 1400, 'c1'], [600, 900, 'c2']]), ('normal control', [[[1600, 2400, 'c0'], [4000, 4300, 'c1'], [1200, 3200, 'c2'], [2500, 2800, 'c3']], [[1000, 1500], [500, 600], [0, 1000]]], [[100, 900, 'c0'], [2500, 2800, 'c1'], [0, 1700, 'c2'], [1000, 1300, 'c3']])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: collapsed cue drop | [] | [] | Passed |
| regression variant: collapsed cue drop | [[1500, 1800, 'c1'], [700, 1500, 'c3']] | [[1500, 1800, 'c1'], [700, 1500, 'c3']] | Passed |
| partial repair probe: collapsed cue drop | [] | [] | Passed |
| partial repair variant: collapsed cue drop | [[2500, 4500, 'c0']] | [[2500, 4500, 'c0']] | Passed |
| boundary control | [[1000, 1300, 'a']] | [[1000, 1300, 'a']] | Passed |
| boundary control | [[1500, 2000, 'a']] | [[1500, 2000, 'a']] | Passed |
| normal control | [[1200, 2200, 'x']] | [[1200, 2200, 'x']] | 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 |
SHA-256 / a4f032db3084894503de981ae6c12c6b541ef6bba2379d461561a530bcc0fc07
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.383349+00:00.
Case digest / 1d7a9fe7614d9133f9b0676bfba538401646e3330fa484b2a63c24ed462a631c