FA-78316 / Subtitle cue timing / Open access
Subtitle conform to an edit cut list: inside-cut mapping · case 01
Cues that start inside a removed section keep a start inside material that no longer exists.
ROOT CAUSE
Times inside a cut are shifted only by earlier cuts.
VERIFIED REPAIR
Map times inside a cut to the cut point a-shift.
Unsuccessful approach: Mapping to b-shift places the time after the cut without subtracting its own length.
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 t-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: inside-cut mapping', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('regression variant: inside-cut mapping', [[[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']], [[3000, 4500]]], [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']]), ('partial repair probe: inside-cut mapping', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: inside-cut mapping', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('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'], [2500, 3300, 'c1'], [0, 2000, 'c2']], [[1000, 1100]]], [[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]), ('normal control', [[[2500, 2800, 'c0']], [[500, 600], [1000, 2500], [2000, 2500]]], [[900, 1200, 'c0']]), ('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']])], [('regression: inside-cut mapping', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('regression variant: inside-cut mapping', [[[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']]), ('partial repair probe: inside-cut mapping', [[[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']], [[3000, 4500]]], [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']]), ('partial repair variant: inside-cut mapping', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, '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: inside-cut mapping', [[[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 variant: inside-cut mapping', [[[3200, 3300, 'c0'], [1200, 2000, 'c1'], [0, 2000, 'c2'], [3200, 3300, 'c3']], [[1000, 1500]]], [[2700, 2800, 'c0'], [1000, 1500, 'c1'], [0, 1500, 'c2'], [2700, 2800, 'c3']]), ('partial repair probe: inside-cut mapping', [[[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']]), ('partial repair variant: inside-cut mapping', [[[4000, 6000, 'c0'], [200, 1000, 'c1']], [[0, 500], [500, 600]]], [[3400, 5400, 'c0'], [0, 400, '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', [[[900, 1000, 'c0'], [600, 2600, 'c1'], [4000, 4100, 'c2'], [900, 2900, 'c3']], [[1000, 1500], [2000, 2100], [2000, 2500]]], [[900, 1000, 'c0'], [600, 1600, 'c1'], [3000, 3100, 'c2'], [900, 1900, 'c3']]), ('normal control', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']]), ('normal control', [[[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']], []], [[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']])], [('regression: inside-cut mapping', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('regression variant: inside-cut mapping', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair probe: inside-cut mapping', [[[3200, 3300, 'c0'], [1200, 2000, 'c1'], [0, 2000, 'c2'], [3200, 3300, 'c3']], [[1000, 1500]]], [[2700, 2800, 'c0'], [1000, 1500, 'c1'], [0, 1500, 'c2'], [2700, 2800, 'c3']]), ('partial repair variant: inside-cut mapping', [[[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']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[1600, 1900, 'c0'], [1600, 3600, 'c1']], []], [[1600, 1900, 'c0'], [1600, 3600, 'c1']]), ('normal control', [[[600, 1400, 'c0'], [0, 300, 'c1']], [[3000, 4000]]], [[600, 1400, 'c0'], [0, 300, 'c1']]), ('normal control', [[[4000, 4300, 'c0'], [3200, 3500, 'c1']], [[1000, 2500], [1500, 2500], [1500, 2000]]], [[2500, 2800, 'c0'], [1700, 2000, 'c1']])], [('regression: inside-cut mapping', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: inside-cut mapping', [[[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 probe: inside-cut mapping', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair variant: inside-cut mapping', [[[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', [[[900, 1200, 'c0'], [900, 1700, 'c1']], []], [[900, 1200, 'c0'], [900, 1700, 'c1']]), ('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: inside-cut mapping | [[1200, 1300, 'a']] | [[1000, 1300, 'a']] | Failed |
| regression variant: inside-cut mapping | [[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']] | [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']] | Failed |
| partial repair probe: inside-cut mapping | [[0, 800, 'c0'], [2500, 2800, 'c1'], [0, 800, 'c2']] | [] | Failed |
| partial repair variant: inside-cut mapping | [[1600, 1700, 'c0'], [2500, 2800, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']] | [[900, 1000, 'c2']] | Failed |
| boundary control | [[1500, 2000, 'a']] | [[1500, 2000, 'a']] | Passed |
| boundary 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 | [[900, 1200, 'c0']] | [[900, 1200, 'c0']] | Passed |
| normal control | [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']] | [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']] | Passed |
SHA-256 / c4799388f3443e2cbc6cab95dc99df39cc6a7e866fa0b5cfccf2ed8fe0aad227
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 b-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: inside-cut mapping', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('regression variant: inside-cut mapping', [[[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']], [[3000, 4500]]], [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']]), ('partial repair probe: inside-cut mapping', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: inside-cut mapping', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('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'], [2500, 3300, 'c1'], [0, 2000, 'c2']], [[1000, 1100]]], [[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]), ('normal control', [[[2500, 2800, 'c0']], [[500, 600], [1000, 2500], [2000, 2500]]], [[900, 1200, 'c0']]), ('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']])], [('regression: inside-cut mapping', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('regression variant: inside-cut mapping', [[[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']]), ('partial repair probe: inside-cut mapping', [[[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']], [[3000, 4500]]], [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']]), ('partial repair variant: inside-cut mapping', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, '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: inside-cut mapping', [[[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 variant: inside-cut mapping', [[[3200, 3300, 'c0'], [1200, 2000, 'c1'], [0, 2000, 'c2'], [3200, 3300, 'c3']], [[1000, 1500]]], [[2700, 2800, 'c0'], [1000, 1500, 'c1'], [0, 1500, 'c2'], [2700, 2800, 'c3']]), ('partial repair probe: inside-cut mapping', [[[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']]), ('partial repair variant: inside-cut mapping', [[[4000, 6000, 'c0'], [200, 1000, 'c1']], [[0, 500], [500, 600]]], [[3400, 5400, 'c0'], [0, 400, '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', [[[900, 1000, 'c0'], [600, 2600, 'c1'], [4000, 4100, 'c2'], [900, 2900, 'c3']], [[1000, 1500], [2000, 2100], [2000, 2500]]], [[900, 1000, 'c0'], [600, 1600, 'c1'], [3000, 3100, 'c2'], [900, 1900, 'c3']]), ('normal control', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']]), ('normal control', [[[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']], []], [[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']])], [('regression: inside-cut mapping', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('regression variant: inside-cut mapping', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair probe: inside-cut mapping', [[[3200, 3300, 'c0'], [1200, 2000, 'c1'], [0, 2000, 'c2'], [3200, 3300, 'c3']], [[1000, 1500]]], [[2700, 2800, 'c0'], [1000, 1500, 'c1'], [0, 1500, 'c2'], [2700, 2800, 'c3']]), ('partial repair variant: inside-cut mapping', [[[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']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[1600, 1900, 'c0'], [1600, 3600, 'c1']], []], [[1600, 1900, 'c0'], [1600, 3600, 'c1']]), ('normal control', [[[600, 1400, 'c0'], [0, 300, 'c1']], [[3000, 4000]]], [[600, 1400, 'c0'], [0, 300, 'c1']]), ('normal control', [[[4000, 4300, 'c0'], [3200, 3500, 'c1']], [[1000, 2500], [1500, 2500], [1500, 2000]]], [[2500, 2800, 'c0'], [1700, 2000, 'c1']])], [('regression: inside-cut mapping', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: inside-cut mapping', [[[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 probe: inside-cut mapping', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair variant: inside-cut mapping', [[[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', [[[900, 1200, 'c0'], [900, 1700, 'c1']], []], [[900, 1200, 'c0'], [900, 1700, 'c1']]), ('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: inside-cut mapping | [] | [[1000, 1300, 'a']] | Failed |
| regression variant: inside-cut mapping | [[200, 300, 'c0'], [1600, 4500, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']] | [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']] | Failed |
| partial repair probe: inside-cut mapping | [[0, 1500, 'c0'], [0, 1500, 'c2']] | [] | Failed |
| partial repair variant: inside-cut mapping | [[900, 2500, 'c2']] | [[900, 1000, 'c2']] | Failed |
| boundary control | [[1500, 2000, 'a']] | [[1500, 2000, 'a']] | Passed |
| boundary 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 | [[900, 1200, 'c0']] | [[900, 1200, 'c0']] | Passed |
| normal control | [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']] | [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']] | Passed |
SHA-256 / 625396f121e50e7bf740e27e5896328931521ab7e35dd83b68b9c80a4ec5abbd
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: inside-cut mapping', [[[1200, 1800, 'a']], [[1000, 1500]]], [[1000, 1300, 'a']]), ('regression variant: inside-cut mapping', [[[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']], [[3000, 4500]]], [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']]), ('partial repair probe: inside-cut mapping', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('partial repair variant: inside-cut mapping', [[[1600, 1700, 'c0'], [4000, 4300, 'c1'], [900, 1700, 'c2'], [1600, 1900, 'c3']], [[1000, 2500], [3000, 4500]]], [[900, 1000, 'c2']]), ('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'], [2500, 3300, 'c1'], [0, 2000, 'c2']], [[1000, 1100]]], [[600, 2500, 'c0'], [2400, 3200, 'c1'], [0, 1900, 'c2']]), ('normal control', [[[2500, 2800, 'c0']], [[500, 600], [1000, 2500], [2000, 2500]]], [[900, 1200, 'c0']]), ('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']])], [('regression: inside-cut mapping', [[[1100, 1400, 'a']], [[1000, 1500]]], []), ('regression variant: inside-cut mapping', [[[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']]), ('partial repair probe: inside-cut mapping', [[[200, 300, 'c0'], [1600, 3600, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']], [[3000, 4500]]], [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']]), ('partial repair variant: inside-cut mapping', [[[2500, 3300, 'c0'], [200, 500, 'c1']], [[1500, 1600], [0, 1000], [1500, 3000]]], [[500, 800, 'c0']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[0, 2000, 'c0'], [0, 300, 'c1']], []], [[0, 2000, 'c0'], [0, 300, '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: inside-cut mapping', [[[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 variant: inside-cut mapping', [[[3200, 3300, 'c0'], [1200, 2000, 'c1'], [0, 2000, 'c2'], [3200, 3300, 'c3']], [[1000, 1500]]], [[2700, 2800, 'c0'], [1000, 1500, 'c1'], [0, 1500, 'c2'], [2700, 2800, 'c3']]), ('partial repair probe: inside-cut mapping', [[[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']]), ('partial repair variant: inside-cut mapping', [[[4000, 6000, 'c0'], [200, 1000, 'c1']], [[0, 500], [500, 600]]], [[3400, 5400, 'c0'], [0, 400, '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', [[[900, 1000, 'c0'], [600, 2600, 'c1'], [4000, 4100, 'c2'], [900, 2900, 'c3']], [[1000, 1500], [2000, 2100], [2000, 2500]]], [[900, 1000, 'c0'], [600, 1600, 'c1'], [3000, 3100, 'c2'], [900, 1900, 'c3']]), ('normal control', [[[4000, 4300, 'c0'], [1200, 3200, 'c1']], [[1500, 2000], [0, 100]]], [[3400, 3700, 'c0'], [1100, 2600, 'c1']]), ('normal control', [[[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']], []], [[600, 2600, 'c0'], [200, 2200, 'c1'], [4000, 4300, 'c2']])], [('regression: inside-cut mapping', [[[3200, 5200, 'c0'], [1200, 1300, 'c1']], [[500, 2000], [2000, 2100], [1500, 1600]]], [[1600, 3600, 'c0']]), ('regression variant: inside-cut mapping', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair probe: inside-cut mapping', [[[3200, 3300, 'c0'], [1200, 2000, 'c1'], [0, 2000, 'c2'], [3200, 3300, 'c3']], [[1000, 1500]]], [[2700, 2800, 'c0'], [1000, 1500, 'c1'], [0, 1500, 'c2'], [2700, 2800, 'c3']]), ('partial repair variant: inside-cut mapping', [[[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']]), ('boundary control', [[[2000, 3000, 'x']], [[1000, 1500], [1200, 1800]]], [[1200, 2200, 'x']]), ('boundary control', [[[3000, 3500, 'a']], [[0, 500], [1000, 2000]]], [[1500, 2000, 'a']]), ('normal control', [[[1600, 1900, 'c0'], [1600, 3600, 'c1']], []], [[1600, 1900, 'c0'], [1600, 3600, 'c1']]), ('normal control', [[[600, 1400, 'c0'], [0, 300, 'c1']], [[3000, 4000]]], [[600, 1400, 'c0'], [0, 300, 'c1']]), ('normal control', [[[4000, 4300, 'c0'], [3200, 3500, 'c1']], [[1000, 2500], [1500, 2500], [1500, 2000]]], [[2500, 2800, 'c0'], [1700, 2000, 'c1']])], [('regression: inside-cut mapping', [[[0, 800, 'c0'], [4000, 4300, 'c1'], [0, 800, 'c2']], [[3000, 3100], [3000, 4500], [0, 1500]]], []), ('regression variant: inside-cut mapping', [[[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 probe: inside-cut mapping', [[[900, 1700, 'c0'], [2500, 3300, 'c1'], [1200, 2000, 'c2']], [[1000, 2500]]], [[900, 1000, 'c0'], [1000, 1800, 'c1']]), ('partial repair variant: inside-cut mapping', [[[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', [[[900, 1200, 'c0'], [900, 1700, 'c1']], []], [[900, 1200, 'c0'], [900, 1700, 'c1']]), ('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: inside-cut mapping | [[1000, 1300, 'a']] | [[1000, 1300, 'a']] | Passed |
| regression variant: inside-cut mapping | [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']] | [[200, 300, 'c0'], [1600, 3000, 'c1'], [1200, 1500, 'c2'], [600, 900, 'c3']] | Passed |
| partial repair probe: inside-cut mapping | [] | [] | Passed |
| partial repair variant: inside-cut mapping | [[900, 1000, 'c2']] | [[900, 1000, 'c2']] | Passed |
| boundary control | [[1500, 2000, 'a']] | [[1500, 2000, 'a']] | Passed |
| boundary 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 | [[900, 1200, 'c0']] | [[900, 1200, 'c0']] | Passed |
| normal control | [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']] | [[3000, 5000, 'c0'], [200, 2100, 'c1'], [200, 500, 'c2'], [1200, 1300, 'c3']] | Passed |
SHA-256 / 88aad64ed991bfd234f70366d55849d4e324ac5f6eafbad0d52fabbb400e36f5
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.040799+00:00.
Case digest / a3171d1839abd610af1eea6c366b6d6357cfc9a48f68303b90b3d980ad605c88