FA-77901 / Subtitle cue timing / Open access
Partial subtitle resync from a point: negative start clamp · case 01
Cues that straddle zero after an early shift disappear entirely.
ROOT CAUSE
A negative start discards the cue instead of clamping it to zero.
VERIFIED REPAIR
Clamp a negative start to 0 and leave the end untouched.
Unsuccessful approach: Preserving the duration by moving the end later displays the cue longer than the shifted timeline allows.
Case contract
Cues [start,end,text] (sorted by start) whose start is at or after from_ms are shifted by offset ms (start and end). A cue whose end becomes <= 0 is dropped; a negative start is clamped to 0 without moving its end. The result is re-sorted by (start,end) and numbered from 1 as [n,start,end,text].
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, offset, from_ms):
out=[]
for start,end,text in cues:
if start>=from_ms:
start+=offset
end+=offset
if end<=0:
continue
if start<0:
continue
out.append([start,end,text])
out.sort(key=lambda c:(c[0],c[1]))
return [[i+1]+c for i,c in enumerate(out)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: negative start clamp', [[[1000, 2000, 'a'], [3000, 4000, 'b']], -1500, 0], [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']]), ('regression variant: negative start clamp', [[[2050, 2850, 'c'], [2550, 4050, 'e'], [3000, 3001, 'c'], [4950, 5750, 'a']], -3000, 2050], [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']]), ('partial repair probe: negative start clamp', [[[500, 3500, 'b'], [3000, 4500, 'd'], [4400, 4600, 'a']], -1200, 500], [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']]), ('partial repair variant: negative start clamp', [[[-200, 2800, 'e'], [300, 1100, 'c']], 1000, 1409], [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[150, 151, 'd'], [200, 400, 'e']], 1000, 3319], [[1, 150, 151, 'd'], [2, 200, 400, 'e']]), ('normal control', [[[300, 3300, 'c'], [1500, 2300, 'e'], [2500, 2501, 'c'], [3750, 5250, 'a']], 1000, 4076], [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']]), ('normal control', [[[2500, 5500, 'e']], 4000, 2500], [[1, 6500, 9500, 'e']])], [('regression: negative start clamp', [[[150, 151, 'e'], [450, 3450, 'b'], [1850, 4850, 'd']], -800, 0], [[1, 0, 2650, 'b'], [2, 1050, 4050, 'd']]), ('regression variant: negative start clamp', [[[550, 3550, 'd']], -800, 550], [[1, 0, 2750, 'd']]), ('partial repair probe: negative start clamp', [[[-200, 2800, 'b'], [0, 1500, 'd']], 250, 2098], [[1, 0, 1500, 'd'], [2, 0, 2800, 'b']]), ('partial repair variant: negative start clamp', [[[550, 2050, 'd'], [1950, 3450, 'e']], -3000, 1950], [[1, 0, 450, 'e'], [2, 550, 2050, 'd']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('normal control', [[[400, 401, 'e'], [2900, 3700, 'd'], [5400, 5401, 'd'], [6600, 9600, 'e'], [8600, 8601, 'a']], 250, 1518], [[1, 400, 401, 'e'], [2, 3150, 3950, 'd'], [3, 5650, 5651, 'd'], [4, 6850, 9850, 'e'], [5, 8850, 8851, 'a']]), ('normal control', [[[2500, 2501, 'b']], -300, 2500], [[1, 2200, 2201, 'b']]), ('normal control', [[[2300, 5300, 'c'], [3300, 4800, 'e']], -1200, 813], [[1, 1100, 4100, 'c'], [2, 2100, 3600, 'e']])], [('regression: negative start clamp', [[[500, 3500, 'b'], [3000, 4500, 'd'], [4400, 4600, 'a']], -1200, 500], [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']]), ('regression variant: negative start clamp', [[[300, 3300, 'b'], [3200, 4000, 'a'], [3500, 6500, 'd']], -800, 0], [[1, 0, 2500, 'b'], [2, 2400, 3200, 'a'], [3, 2700, 5700, 'd']]), ('partial repair probe: negative start clamp', [[[1100, 1300, 'c'], [3600, 3601, 'c']], -1200, 1100], [[1, 0, 100, 'c'], [2, 2400, 2401, 'c']]), ('partial repair variant: negative start clamp', [[[-300, -100, 'c'], [150, 1650, 'a']], -800, 0], [[1, 0, 850, 'a']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[3000, 3800, 'c'], [3700, 6700, 'd']], -1200, 3000], [[1, 1800, 2600, 'c'], [2, 2500, 5500, 'd']]), ('normal control', [[[500, 2000, 'b'], [1750, 1751, 'b'], [3750, 3751, 'c']], -300, 500], [[1, 200, 1700, 'b'], [2, 1450, 1451, 'b'], [3, 3450, 3451, 'c']]), ('normal control', [[[150, 1650, 'b'], [250, 3250, 'b'], [450, 451, 'e'], [1450, 1451, 'd'], [2700, 3500, 'c']], 4000, 4769], [[1, 150, 1650, 'b'], [2, 250, 3250, 'b'], [3, 450, 451, 'e'], [4, 1450, 1451, 'd'], [5, 2700, 3500, 'c']])], [('regression: negative start clamp', [[[-200, 2800, 'b'], [0, 1500, 'd']], 250, 2098], [[1, 0, 1500, 'd'], [2, 0, 2800, 'b']]), ('regression variant: negative start clamp', [[[0, 1500, 'c'], [300, 500, 'b'], [3200, 3201, 'e']], -800, 0], [[1, 0, 700, 'c'], [2, 2400, 2401, 'e']]), ('partial repair probe: negative start clamp', [[[2050, 2850, 'c'], [2550, 4050, 'e'], [3000, 3001, 'c'], [4950, 5750, 'a']], -3000, 2050], [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']]), ('partial repair variant: negative start clamp', [[[150, 3150, 'a'], [1150, 1350, 'b'], [2850, 2851, 'a'], [3350, 4850, 'e'], [3850, 5350, 'd']], -800, 0], [[1, 0, 2350, 'a'], [2, 350, 550, 'b'], [3, 2050, 2051, 'a'], [4, 2550, 4050, 'e'], [5, 3050, 4550, 'd']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('normal control', [[[400, 600, 'a'], [3300, 6300, 'b'], [3600, 4400, 'b']], -300, 0], [[1, 100, 300, 'a'], [2, 3000, 6000, 'b'], [3, 3300, 4100, 'b']]), ('normal control', [[[550, 1350, 'b']], 4000, 1350], [[1, 550, 1350, 'b']]), ('normal control', [[[0, 800, 'b'], [2500, 3300, 'c']], 4000, 0], [[1, 4000, 4800, 'b'], [2, 6500, 7300, 'c']])], [('regression: negative start clamp', [[[1100, 1300, 'c'], [3600, 3601, 'c']], -1200, 1100], [[1, 0, 100, 'c'], [2, 2400, 2401, 'c']]), ('regression variant: negative start clamp', [[[-200, 2800, 'e'], [300, 1100, 'c']], 1000, 1409], [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']]), ('partial repair probe: negative start clamp', [[[550, 3550, 'd']], -800, 550], [[1, 0, 2750, 'd']]), ('partial repair variant: negative start clamp', [[[1800, 3300, 'e'], [1850, 2050, 'e'], [2000, 2001, 'b'], [4350, 4351, 'd'], [5600, 8600, 'd']], -3000, 0], [[1, 0, 300, 'e'], [2, 1350, 1351, 'd'], [3, 2600, 5600, 'd']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[500, 2000, 'c'], [3000, 4500, 'e'], [4200, 4201, 'e'], [5700, 8700, 'c']], -300, 0], [[1, 200, 1700, 'c'], [2, 2700, 4200, 'e'], [3, 3900, 3901, 'e'], [4, 5400, 8400, 'c']]), ('normal control', [[[800, 3800, 'a'], [1100, 1101, 'e'], [1550, 2350, 'b'], [2000, 2200, 'd'], [2450, 5450, 'c']], 250, 2350], [[1, 800, 3800, 'a'], [2, 1100, 1101, 'e'], [3, 1550, 2350, 'b'], [4, 2000, 2200, 'd'], [5, 2700, 5700, 'c']]), ('normal control', [[[150, 1650, 'a'], [550, 1350, 'e'], [4250, 7250, 'd'], [6450, 6451, 'c'], [6750, 9750, 'e']], 4000, 5053], [[1, 150, 1650, 'a'], [2, 550, 1350, 'e'], [3, 4250, 7250, 'd'], [4, 10450, 10451, 'c'], [5, 10750, 13750, 'e']])]]
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: negative start clamp | [[1, 1500, 2500, 'b']] | [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']] | Failed |
| regression variant: negative start clamp | [[1, 0, 1, 'c'], [2, 1950, 2750, 'a']] | [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']] | Failed |
| partial repair probe: negative start clamp | [[1, 1800, 3300, 'd'], [2, 3200, 3400, 'a']] | [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']] | Failed |
| partial repair variant: negative start clamp | [[1, 300, 1100, 'c']] | [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']] | Failed |
| boundary control | [[1, 0, 500, 'a'], [2, 100, 400, 'b']] | [[1, 0, 500, 'a'], [2, 100, 400, 'b']] | Passed |
| boundary control | [[1, 150, 250, 'x']] | [[1, 150, 250, 'x']] | Passed |
| normal control | [[1, 150, 151, 'd'], [2, 200, 400, 'e']] | [[1, 150, 151, 'd'], [2, 200, 400, 'e']] | Passed |
| normal control | [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']] | [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']] | Passed |
| normal control | [[1, 6500, 9500, 'e']] | [[1, 6500, 9500, 'e']] | Passed |
SHA-256 / e7377f2c0b65c84800e4248f158cab1786cad479a28f32d76a3658c998f3d000
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cues, offset, from_ms):
out=[]
for start,end,text in cues:
if start>=from_ms:
start+=offset
end+=offset
if end<=0:
continue
if start<0:
end-=start
start=0
out.append([start,end,text])
out.sort(key=lambda c:(c[0],c[1]))
return [[i+1]+c for i,c in enumerate(out)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: negative start clamp', [[[1000, 2000, 'a'], [3000, 4000, 'b']], -1500, 0], [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']]), ('regression variant: negative start clamp', [[[2050, 2850, 'c'], [2550, 4050, 'e'], [3000, 3001, 'c'], [4950, 5750, 'a']], -3000, 2050], [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']]), ('partial repair probe: negative start clamp', [[[500, 3500, 'b'], [3000, 4500, 'd'], [4400, 4600, 'a']], -1200, 500], [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']]), ('partial repair variant: negative start clamp', [[[-200, 2800, 'e'], [300, 1100, 'c']], 1000, 1409], [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[150, 151, 'd'], [200, 400, 'e']], 1000, 3319], [[1, 150, 151, 'd'], [2, 200, 400, 'e']]), ('normal control', [[[300, 3300, 'c'], [1500, 2300, 'e'], [2500, 2501, 'c'], [3750, 5250, 'a']], 1000, 4076], [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']]), ('normal control', [[[2500, 5500, 'e']], 4000, 2500], [[1, 6500, 9500, 'e']])], [('regression: negative start clamp', [[[150, 151, 'e'], [450, 3450, 'b'], [1850, 4850, 'd']], -800, 0], [[1, 0, 2650, 'b'], [2, 1050, 4050, 'd']]), ('regression variant: negative start clamp', [[[550, 3550, 'd']], -800, 550], [[1, 0, 2750, 'd']]), ('partial repair probe: negative start clamp', [[[-200, 2800, 'b'], [0, 1500, 'd']], 250, 2098], [[1, 0, 1500, 'd'], [2, 0, 2800, 'b']]), ('partial repair variant: negative start clamp', [[[550, 2050, 'd'], [1950, 3450, 'e']], -3000, 1950], [[1, 0, 450, 'e'], [2, 550, 2050, 'd']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('normal control', [[[400, 401, 'e'], [2900, 3700, 'd'], [5400, 5401, 'd'], [6600, 9600, 'e'], [8600, 8601, 'a']], 250, 1518], [[1, 400, 401, 'e'], [2, 3150, 3950, 'd'], [3, 5650, 5651, 'd'], [4, 6850, 9850, 'e'], [5, 8850, 8851, 'a']]), ('normal control', [[[2500, 2501, 'b']], -300, 2500], [[1, 2200, 2201, 'b']]), ('normal control', [[[2300, 5300, 'c'], [3300, 4800, 'e']], -1200, 813], [[1, 1100, 4100, 'c'], [2, 2100, 3600, 'e']])], [('regression: negative start clamp', [[[500, 3500, 'b'], [3000, 4500, 'd'], [4400, 4600, 'a']], -1200, 500], [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']]), ('regression variant: negative start clamp', [[[300, 3300, 'b'], [3200, 4000, 'a'], [3500, 6500, 'd']], -800, 0], [[1, 0, 2500, 'b'], [2, 2400, 3200, 'a'], [3, 2700, 5700, 'd']]), ('partial repair probe: negative start clamp', [[[1100, 1300, 'c'], [3600, 3601, 'c']], -1200, 1100], [[1, 0, 100, 'c'], [2, 2400, 2401, 'c']]), ('partial repair variant: negative start clamp', [[[-300, -100, 'c'], [150, 1650, 'a']], -800, 0], [[1, 0, 850, 'a']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[3000, 3800, 'c'], [3700, 6700, 'd']], -1200, 3000], [[1, 1800, 2600, 'c'], [2, 2500, 5500, 'd']]), ('normal control', [[[500, 2000, 'b'], [1750, 1751, 'b'], [3750, 3751, 'c']], -300, 500], [[1, 200, 1700, 'b'], [2, 1450, 1451, 'b'], [3, 3450, 3451, 'c']]), ('normal control', [[[150, 1650, 'b'], [250, 3250, 'b'], [450, 451, 'e'], [1450, 1451, 'd'], [2700, 3500, 'c']], 4000, 4769], [[1, 150, 1650, 'b'], [2, 250, 3250, 'b'], [3, 450, 451, 'e'], [4, 1450, 1451, 'd'], [5, 2700, 3500, 'c']])], [('regression: negative start clamp', [[[-200, 2800, 'b'], [0, 1500, 'd']], 250, 2098], [[1, 0, 1500, 'd'], [2, 0, 2800, 'b']]), ('regression variant: negative start clamp', [[[0, 1500, 'c'], [300, 500, 'b'], [3200, 3201, 'e']], -800, 0], [[1, 0, 700, 'c'], [2, 2400, 2401, 'e']]), ('partial repair probe: negative start clamp', [[[2050, 2850, 'c'], [2550, 4050, 'e'], [3000, 3001, 'c'], [4950, 5750, 'a']], -3000, 2050], [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']]), ('partial repair variant: negative start clamp', [[[150, 3150, 'a'], [1150, 1350, 'b'], [2850, 2851, 'a'], [3350, 4850, 'e'], [3850, 5350, 'd']], -800, 0], [[1, 0, 2350, 'a'], [2, 350, 550, 'b'], [3, 2050, 2051, 'a'], [4, 2550, 4050, 'e'], [5, 3050, 4550, 'd']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('normal control', [[[400, 600, 'a'], [3300, 6300, 'b'], [3600, 4400, 'b']], -300, 0], [[1, 100, 300, 'a'], [2, 3000, 6000, 'b'], [3, 3300, 4100, 'b']]), ('normal control', [[[550, 1350, 'b']], 4000, 1350], [[1, 550, 1350, 'b']]), ('normal control', [[[0, 800, 'b'], [2500, 3300, 'c']], 4000, 0], [[1, 4000, 4800, 'b'], [2, 6500, 7300, 'c']])], [('regression: negative start clamp', [[[1100, 1300, 'c'], [3600, 3601, 'c']], -1200, 1100], [[1, 0, 100, 'c'], [2, 2400, 2401, 'c']]), ('regression variant: negative start clamp', [[[-200, 2800, 'e'], [300, 1100, 'c']], 1000, 1409], [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']]), ('partial repair probe: negative start clamp', [[[550, 3550, 'd']], -800, 550], [[1, 0, 2750, 'd']]), ('partial repair variant: negative start clamp', [[[1800, 3300, 'e'], [1850, 2050, 'e'], [2000, 2001, 'b'], [4350, 4351, 'd'], [5600, 8600, 'd']], -3000, 0], [[1, 0, 300, 'e'], [2, 1350, 1351, 'd'], [3, 2600, 5600, 'd']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[500, 2000, 'c'], [3000, 4500, 'e'], [4200, 4201, 'e'], [5700, 8700, 'c']], -300, 0], [[1, 200, 1700, 'c'], [2, 2700, 4200, 'e'], [3, 3900, 3901, 'e'], [4, 5400, 8400, 'c']]), ('normal control', [[[800, 3800, 'a'], [1100, 1101, 'e'], [1550, 2350, 'b'], [2000, 2200, 'd'], [2450, 5450, 'c']], 250, 2350], [[1, 800, 3800, 'a'], [2, 1100, 1101, 'e'], [3, 1550, 2350, 'b'], [4, 2000, 2200, 'd'], [5, 2700, 5700, 'c']]), ('normal control', [[[150, 1650, 'a'], [550, 1350, 'e'], [4250, 7250, 'd'], [6450, 6451, 'c'], [6750, 9750, 'e']], 4000, 5053], [[1, 150, 1650, 'a'], [2, 550, 1350, 'e'], [3, 4250, 7250, 'd'], [4, 10450, 10451, 'c'], [5, 10750, 13750, 'e']])]]
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: negative start clamp | [[1, 0, 1000, 'a'], [2, 1500, 2500, 'b']] | [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']] | Failed |
| regression variant: negative start clamp | [[1, 0, 1, 'c'], [2, 0, 1500, 'e'], [3, 1950, 2750, 'a']] | [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']] | Failed |
| partial repair probe: negative start clamp | [[1, 0, 3000, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']] | [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']] | Failed |
| partial repair variant: negative start clamp | [[1, 0, 3000, 'e'], [2, 300, 1100, 'c']] | [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']] | Failed |
| boundary control | [[1, 0, 500, 'a'], [2, 100, 400, 'b']] | [[1, 0, 500, 'a'], [2, 100, 400, 'b']] | Passed |
| boundary control | [[1, 150, 250, 'x']] | [[1, 150, 250, 'x']] | Passed |
| normal control | [[1, 150, 151, 'd'], [2, 200, 400, 'e']] | [[1, 150, 151, 'd'], [2, 200, 400, 'e']] | Passed |
| normal control | [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']] | [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']] | Passed |
| normal control | [[1, 6500, 9500, 'e']] | [[1, 6500, 9500, 'e']] | Passed |
SHA-256 / 2ac5fc614707af79b52a2faa4c7d1ac3c61036b443aaf389dce03e18e55c6754
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cues, offset, from_ms):
out=[]
for start,end,text in cues:
if start>=from_ms:
start+=offset
end+=offset
if end<=0:
continue
if start<0:
start=0
out.append([start,end,text])
out.sort(key=lambda c:(c[0],c[1]))
return [[i+1]+c for i,c in enumerate(out)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: negative start clamp', [[[1000, 2000, 'a'], [3000, 4000, 'b']], -1500, 0], [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']]), ('regression variant: negative start clamp', [[[2050, 2850, 'c'], [2550, 4050, 'e'], [3000, 3001, 'c'], [4950, 5750, 'a']], -3000, 2050], [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']]), ('partial repair probe: negative start clamp', [[[500, 3500, 'b'], [3000, 4500, 'd'], [4400, 4600, 'a']], -1200, 500], [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']]), ('partial repair variant: negative start clamp', [[[-200, 2800, 'e'], [300, 1100, 'c']], 1000, 1409], [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[150, 151, 'd'], [200, 400, 'e']], 1000, 3319], [[1, 150, 151, 'd'], [2, 200, 400, 'e']]), ('normal control', [[[300, 3300, 'c'], [1500, 2300, 'e'], [2500, 2501, 'c'], [3750, 5250, 'a']], 1000, 4076], [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']]), ('normal control', [[[2500, 5500, 'e']], 4000, 2500], [[1, 6500, 9500, 'e']])], [('regression: negative start clamp', [[[150, 151, 'e'], [450, 3450, 'b'], [1850, 4850, 'd']], -800, 0], [[1, 0, 2650, 'b'], [2, 1050, 4050, 'd']]), ('regression variant: negative start clamp', [[[550, 3550, 'd']], -800, 550], [[1, 0, 2750, 'd']]), ('partial repair probe: negative start clamp', [[[-200, 2800, 'b'], [0, 1500, 'd']], 250, 2098], [[1, 0, 1500, 'd'], [2, 0, 2800, 'b']]), ('partial repair variant: negative start clamp', [[[550, 2050, 'd'], [1950, 3450, 'e']], -3000, 1950], [[1, 0, 450, 'e'], [2, 550, 2050, 'd']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('normal control', [[[400, 401, 'e'], [2900, 3700, 'd'], [5400, 5401, 'd'], [6600, 9600, 'e'], [8600, 8601, 'a']], 250, 1518], [[1, 400, 401, 'e'], [2, 3150, 3950, 'd'], [3, 5650, 5651, 'd'], [4, 6850, 9850, 'e'], [5, 8850, 8851, 'a']]), ('normal control', [[[2500, 2501, 'b']], -300, 2500], [[1, 2200, 2201, 'b']]), ('normal control', [[[2300, 5300, 'c'], [3300, 4800, 'e']], -1200, 813], [[1, 1100, 4100, 'c'], [2, 2100, 3600, 'e']])], [('regression: negative start clamp', [[[500, 3500, 'b'], [3000, 4500, 'd'], [4400, 4600, 'a']], -1200, 500], [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']]), ('regression variant: negative start clamp', [[[300, 3300, 'b'], [3200, 4000, 'a'], [3500, 6500, 'd']], -800, 0], [[1, 0, 2500, 'b'], [2, 2400, 3200, 'a'], [3, 2700, 5700, 'd']]), ('partial repair probe: negative start clamp', [[[1100, 1300, 'c'], [3600, 3601, 'c']], -1200, 1100], [[1, 0, 100, 'c'], [2, 2400, 2401, 'c']]), ('partial repair variant: negative start clamp', [[[-300, -100, 'c'], [150, 1650, 'a']], -800, 0], [[1, 0, 850, 'a']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[3000, 3800, 'c'], [3700, 6700, 'd']], -1200, 3000], [[1, 1800, 2600, 'c'], [2, 2500, 5500, 'd']]), ('normal control', [[[500, 2000, 'b'], [1750, 1751, 'b'], [3750, 3751, 'c']], -300, 500], [[1, 200, 1700, 'b'], [2, 1450, 1451, 'b'], [3, 3450, 3451, 'c']]), ('normal control', [[[150, 1650, 'b'], [250, 3250, 'b'], [450, 451, 'e'], [1450, 1451, 'd'], [2700, 3500, 'c']], 4000, 4769], [[1, 150, 1650, 'b'], [2, 250, 3250, 'b'], [3, 450, 451, 'e'], [4, 1450, 1451, 'd'], [5, 2700, 3500, 'c']])], [('regression: negative start clamp', [[[-200, 2800, 'b'], [0, 1500, 'd']], 250, 2098], [[1, 0, 1500, 'd'], [2, 0, 2800, 'b']]), ('regression variant: negative start clamp', [[[0, 1500, 'c'], [300, 500, 'b'], [3200, 3201, 'e']], -800, 0], [[1, 0, 700, 'c'], [2, 2400, 2401, 'e']]), ('partial repair probe: negative start clamp', [[[2050, 2850, 'c'], [2550, 4050, 'e'], [3000, 3001, 'c'], [4950, 5750, 'a']], -3000, 2050], [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']]), ('partial repair variant: negative start clamp', [[[150, 3150, 'a'], [1150, 1350, 'b'], [2850, 2851, 'a'], [3350, 4850, 'e'], [3850, 5350, 'd']], -800, 0], [[1, 0, 2350, 'a'], [2, 350, 550, 'b'], [3, 2050, 2051, 'a'], [4, 2550, 4050, 'e'], [5, 3050, 4550, 'd']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('normal control', [[[400, 600, 'a'], [3300, 6300, 'b'], [3600, 4400, 'b']], -300, 0], [[1, 100, 300, 'a'], [2, 3000, 6000, 'b'], [3, 3300, 4100, 'b']]), ('normal control', [[[550, 1350, 'b']], 4000, 1350], [[1, 550, 1350, 'b']]), ('normal control', [[[0, 800, 'b'], [2500, 3300, 'c']], 4000, 0], [[1, 4000, 4800, 'b'], [2, 6500, 7300, 'c']])], [('regression: negative start clamp', [[[1100, 1300, 'c'], [3600, 3601, 'c']], -1200, 1100], [[1, 0, 100, 'c'], [2, 2400, 2401, 'c']]), ('regression variant: negative start clamp', [[[-200, 2800, 'e'], [300, 1100, 'c']], 1000, 1409], [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']]), ('partial repair probe: negative start clamp', [[[550, 3550, 'd']], -800, 550], [[1, 0, 2750, 'd']]), ('partial repair variant: negative start clamp', [[[1800, 3300, 'e'], [1850, 2050, 'e'], [2000, 2001, 'b'], [4350, 4351, 'd'], [5600, 8600, 'd']], -3000, 0], [[1, 0, 300, 'e'], [2, 1350, 1351, 'd'], [3, 2600, 5600, 'd']]), ('boundary control', [[[0, 500, 'a'], [600, 900, 'b']], -500, 600], [[1, 0, 500, 'a'], [2, 100, 400, 'b']]), ('boundary control', [[[100, 200, 'x']], 50, 100], [[1, 150, 250, 'x']]), ('normal control', [[[500, 2000, 'c'], [3000, 4500, 'e'], [4200, 4201, 'e'], [5700, 8700, 'c']], -300, 0], [[1, 200, 1700, 'c'], [2, 2700, 4200, 'e'], [3, 3900, 3901, 'e'], [4, 5400, 8400, 'c']]), ('normal control', [[[800, 3800, 'a'], [1100, 1101, 'e'], [1550, 2350, 'b'], [2000, 2200, 'd'], [2450, 5450, 'c']], 250, 2350], [[1, 800, 3800, 'a'], [2, 1100, 1101, 'e'], [3, 1550, 2350, 'b'], [4, 2000, 2200, 'd'], [5, 2700, 5700, 'c']]), ('normal control', [[[150, 1650, 'a'], [550, 1350, 'e'], [4250, 7250, 'd'], [6450, 6451, 'c'], [6750, 9750, 'e']], 4000, 5053], [[1, 150, 1650, 'a'], [2, 550, 1350, 'e'], [3, 4250, 7250, 'd'], [4, 10450, 10451, 'c'], [5, 10750, 13750, 'e']])]]
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: negative start clamp | [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']] | [[1, 0, 500, 'a'], [2, 1500, 2500, 'b']] | Passed |
| regression variant: negative start clamp | [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']] | [[1, 0, 1, 'c'], [2, 0, 1050, 'e'], [3, 1950, 2750, 'a']] | Passed |
| partial repair probe: negative start clamp | [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']] | [[1, 0, 2300, 'b'], [2, 1800, 3300, 'd'], [3, 3200, 3400, 'a']] | Passed |
| partial repair variant: negative start clamp | [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']] | [[1, 0, 2800, 'e'], [2, 300, 1100, 'c']] | Passed |
| boundary control | [[1, 0, 500, 'a'], [2, 100, 400, 'b']] | [[1, 0, 500, 'a'], [2, 100, 400, 'b']] | Passed |
| boundary control | [[1, 150, 250, 'x']] | [[1, 150, 250, 'x']] | Passed |
| normal control | [[1, 150, 151, 'd'], [2, 200, 400, 'e']] | [[1, 150, 151, 'd'], [2, 200, 400, 'e']] | Passed |
| normal control | [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']] | [[1, 300, 3300, 'c'], [2, 1500, 2300, 'e'], [3, 2500, 2501, 'c'], [4, 3750, 5250, 'a']] | Passed |
| normal control | [[1, 6500, 9500, 'e']] | [[1, 6500, 9500, 'e']] | Passed |
SHA-256 / 920d1fa2e9a8a908f35c314b6c95c475be7986be5167cb089a8c207764543705
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:30.091256+00:00.
Case digest / 7a56e97a9f4fcf9d4c701a3522f47982066d3a7e573a591eec048732b28419db