FA-78121 / Subtitle cue timing / Open access
Proportional cue splitting: cumulative weight · case 01
Split pieces overlap and the final piece does not end at the cue end.
ROOT CAUSE
Boundaries use only the current part weight instead of the running total.
VERIFIED REPAIR
Accumulate the weights before computing each boundary.
Unsuccessful approach: Accumulating raw lengths disagrees with the trimmed total and misplaces later boundaries.
Case contract
Split cue [start,end] into len(parts) consecutive cues. Each part weighs max(1, len(part.strip())). Boundary after part k is start + floor(dur * cumulative_weight_k / total_weight); pieces are contiguous and the last ends at end. Output [s,e,part.strip()].
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(cue, parts):
start,end=cue
w=[max(1,len(p.strip())) for p in parts]
total=sum(w)
dur=end-start
out=[]
acc=0
prev=start
for p,x in zip(parts,w):
acc=x
b=start+dur*acc//total
out.append([prev,b,p.strip()])
prev=b
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cumulative weight', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('regression variant: cumulative weight', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair probe: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1999], ['friend']], [[1000, 1999, 'friend']]), ('normal control', [[0, 3001], ['a']], [[0, 3001, 'a']])], [('regression: cumulative weight', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('regression variant: cumulative weight', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: cumulative weight', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: cumulative weight', [[1000, 1999], [' ']], [[1000, 1999, '']]), ('normal control', [[12345, 15346], ['Hello']], [[12345, 15346, 'Hello']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[12345, 13345], ['friend']], [[12345, 13345, 'friend']])], [('regression: cumulative weight', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair probe: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: cumulative weight', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('normal control', [[1000, 1007], ['friend']], [[1000, 1007, 'friend']]), ('normal control', [[0, 1000], ['Longer chunk of text']], [[0, 1000, 'Longer chunk of text']]), ('normal control', [[12345, 15346], ['xyz']], [[12345, 15346, 'xyz']])], [('regression: cumulative weight', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: cumulative weight', [[0, 7], [' ', 'ok ', ' ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('normal control', [[1000, 3500], ['a']], [[1000, 3500, 'a']]), ('normal control', [[12345, 12352], ['a']], [[12345, 12352, 'a']]), ('normal control', [[12345, 12352], ['Longer chunk of text']], [[12345, 12352, 'Longer chunk of text']])], [('regression: cumulative weight', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[12345, 13345], ['Hello']], [[12345, 13345, 'Hello']]), ('normal control', [[12345, 15346], ['friend']], [[12345, 15346, 'friend']]), ('normal control', [[0, 100], ['Hello']], [[0, 100, 'Hello']])]]
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: cumulative weight | [[0, 500, 'ab'], [500, 500, 'cd']] | [[0, 500, 'ab'], [500, 1000, 'cd']] | Failed |
| regression variant: cumulative weight | [[1000, 1000, 'a'], [1000, 1001, 'xyz'], [1001, 1003, 'friend'], [1003, 1000, 'a']] | [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']] | Failed |
| partial repair probe: cumulative weight | [[0, 60, 'friend'], [60, 20, 'ok'], [20, 20, 'ok']] | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | Failed |
| partial repair variant: cumulative weight | [[1000, 1018, 'there'], [1018, 1007, 'ok'], [1007, 1074, 'Longer chunk of text']] | [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']] | Failed |
| normal control | [[0, 2500, 'xyz']] | [[0, 2500, 'xyz']] | Passed |
| normal control | [[1000, 1999, 'friend']] | [[1000, 1999, 'friend']] | Passed |
| normal control | [[0, 3001, 'a']] | [[0, 3001, 'a']] | Passed |
SHA-256 / 713b296f0af1105c7c45fa6425bd2be6f08dead6bfe285427c083253e4afd642
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cue, parts):
start,end=cue
w=[max(1,len(p.strip())) for p in parts]
total=sum(w)
dur=end-start
out=[]
acc=0
prev=start
for p,x in zip(parts,w):
acc+=len(p)
b=start+dur*acc//total
out.append([prev,b,p.strip()])
prev=b
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cumulative weight', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('regression variant: cumulative weight', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair probe: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1999], ['friend']], [[1000, 1999, 'friend']]), ('normal control', [[0, 3001], ['a']], [[0, 3001, 'a']])], [('regression: cumulative weight', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('regression variant: cumulative weight', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: cumulative weight', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: cumulative weight', [[1000, 1999], [' ']], [[1000, 1999, '']]), ('normal control', [[12345, 15346], ['Hello']], [[12345, 15346, 'Hello']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[12345, 13345], ['friend']], [[12345, 13345, 'friend']])], [('regression: cumulative weight', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair probe: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: cumulative weight', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('normal control', [[1000, 1007], ['friend']], [[1000, 1007, 'friend']]), ('normal control', [[0, 1000], ['Longer chunk of text']], [[0, 1000, 'Longer chunk of text']]), ('normal control', [[12345, 15346], ['xyz']], [[12345, 15346, 'xyz']])], [('regression: cumulative weight', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: cumulative weight', [[0, 7], [' ', 'ok ', ' ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('normal control', [[1000, 3500], ['a']], [[1000, 3500, 'a']]), ('normal control', [[12345, 12352], ['a']], [[12345, 12352, 'a']]), ('normal control', [[12345, 12352], ['Longer chunk of text']], [[12345, 12352, 'Longer chunk of text']])], [('regression: cumulative weight', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[12345, 13345], ['Hello']], [[12345, 13345, 'Hello']]), ('normal control', [[12345, 15346], ['friend']], [[12345, 15346, 'friend']]), ('normal control', [[0, 100], ['Hello']], [[0, 100, 'Hello']])]]
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: cumulative weight | [[0, 500, 'ab'], [500, 1000, 'cd']] | [[0, 500, 'ab'], [500, 1000, 'cd']] | Passed |
| regression variant: cumulative weight | [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']] | [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']] | Passed |
| partial repair probe: cumulative weight | [[0, 60, 'friend'], [60, 90, 'ok'], [90, 120, 'ok']] | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | Failed |
| partial repair variant: cumulative weight | [[1000, 1025, 'there'], [1025, 1037, 'ok'], [1037, 1111, 'Longer chunk of text']] | [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']] | Failed |
| normal control | [[0, 2500, 'xyz']] | [[0, 2500, 'xyz']] | Passed |
| normal control | [[1000, 1999, 'friend']] | [[1000, 1999, 'friend']] | Passed |
| normal control | [[0, 3001, 'a']] | [[0, 3001, 'a']] | Passed |
SHA-256 / ab7649d1d10cf3806a45440fbf7a096aa3f4ae3c1746aabf805c3b3ea42ca2fd
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cue, parts):
start,end=cue
w=[max(1,len(p.strip())) for p in parts]
total=sum(w)
dur=end-start
out=[]
acc=0
prev=start
for p,x in zip(parts,w):
acc+=x
b=start+dur*acc//total
out.append([prev,b,p.strip()])
prev=b
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cumulative weight', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('regression variant: cumulative weight', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair probe: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1999], ['friend']], [[1000, 1999, 'friend']]), ('normal control', [[0, 3001], ['a']], [[0, 3001, 'a']])], [('regression: cumulative weight', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('regression variant: cumulative weight', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: cumulative weight', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: cumulative weight', [[1000, 1999], [' ']], [[1000, 1999, '']]), ('normal control', [[12345, 15346], ['Hello']], [[12345, 15346, 'Hello']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[12345, 13345], ['friend']], [[12345, 13345, 'friend']])], [('regression: cumulative weight', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair probe: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: cumulative weight', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('normal control', [[1000, 1007], ['friend']], [[1000, 1007, 'friend']]), ('normal control', [[0, 1000], ['Longer chunk of text']], [[0, 1000, 'Longer chunk of text']]), ('normal control', [[12345, 15346], ['xyz']], [[12345, 15346, 'xyz']])], [('regression: cumulative weight', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: cumulative weight', [[0, 7], [' ', 'ok ', ' ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('normal control', [[1000, 3500], ['a']], [[1000, 3500, 'a']]), ('normal control', [[12345, 12352], ['a']], [[12345, 12352, 'a']]), ('normal control', [[12345, 12352], ['Longer chunk of text']], [[12345, 12352, 'Longer chunk of text']])], [('regression: cumulative weight', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[12345, 13345], ['Hello']], [[12345, 13345, 'Hello']]), ('normal control', [[12345, 15346], ['friend']], [[12345, 15346, 'friend']]), ('normal control', [[0, 100], ['Hello']], [[0, 100, 'Hello']])]]
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: cumulative weight | [[0, 500, 'ab'], [500, 1000, 'cd']] | [[0, 500, 'ab'], [500, 1000, 'cd']] | Passed |
| regression variant: cumulative weight | [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']] | [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']] | Passed |
| partial repair probe: cumulative weight | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | Passed |
| partial repair variant: cumulative weight | [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']] | [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']] | Passed |
| normal control | [[0, 2500, 'xyz']] | [[0, 2500, 'xyz']] | Passed |
| normal control | [[1000, 1999, 'friend']] | [[1000, 1999, 'friend']] | Passed |
| normal control | [[0, 3001, 'a']] | [[0, 3001, 'a']] | Passed |
SHA-256 / 621d18f40e44e7d3345b72aacd373045b7c7490543d38a4c2a95798f39ed58ae
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:32.100364+00:00.
Case digest / e0f04d6e0f190ae025c5ac310b50a999ae4ae582923583503969ef555942ceb9