FA-78136 / Subtitle cue timing / Open access
Proportional cue splitting: piece text trim · case 01
Split pieces show stray leading and trailing spaces.
ROOT CAUSE
The emitted text is the raw fragment.
VERIFIED REPAIR
Emit the trimmed fragment.
Unsuccessful approach: Trimming only the left side leaves trailing spaces in the piece text.
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])
prev=b
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: piece text trim', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: piece text trim', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: piece text trim', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: piece text trim', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']])], [('regression: piece text trim', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: piece text trim', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair probe: piece text trim', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: piece text trim', [[0, 7], [' ', 'ok ', ' ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[1000, 1999], ['a']], [[1000, 1999, 'a']]), ('normal control', [[12345, 15346], ['a', '']], [[12345, 13845, 'a'], [13845, 15346, '']]), ('normal control', [[12345, 13345], ['']], [[12345, 13345, '']])], [('regression: piece text trim', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('regression variant: piece text trim', [[12345, 12352], [' ']], [[12345, 12352, '']]), ('partial repair probe: piece text trim', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: piece text trim', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('normal control', [[12345, 12352], ['xyz', '']], [[12345, 12350, 'xyz'], [12350, 12352, '']]), ('normal control', [[12345, 13345], ['Hello', 'friend', 'Hello']], [[12345, 12657, 'Hello'], [12657, 13032, 'friend'], [13032, 13345, 'Hello']]), ('normal control', [[1000, 1007], ['Longer chunk of text', 'Hello']], [[1000, 1005, 'Longer chunk of text'], [1005, 1007, 'Hello']])], [('regression: piece text trim', [[0, 7], [' there ']], [[0, 7, 'there']]), ('regression variant: piece text trim', [[12345, 13344], ['ok ', 'ok ', ' ']], [[12345, 12744, 'ok'], [12744, 13144, 'ok'], [13144, 13344, '']]), ('partial repair probe: piece text trim', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: piece text trim', [[12345, 12352], [' there ', ' there ', 'xyz', ' ']], [[12345, 12347, 'there'], [12347, 12350, 'there'], [12350, 12351, 'xyz'], [12351, 12352, '']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[1000, 3500], ['xyz', 'a']], [[1000, 2875, 'xyz'], [2875, 3500, 'a']]), ('normal control', [[12345, 12352], ['']], [[12345, 12352, '']]), ('normal control', [[12345, 13345], ['', 'friend', 'a']], [[12345, 12470, ''], [12470, 13220, 'friend'], [13220, 13345, 'a']])], [('regression: piece text trim', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('regression variant: piece text trim', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('partial repair probe: piece text trim', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: piece text trim', [[1000, 1100], [' there ', 'friend']], [[1000, 1045, 'there'], [1045, 1100, 'friend']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[1000, 2000], ['Longer chunk of text', 'Longer chunk of text', 'Hello', '']], [[1000, 1434, 'Longer chunk of text'], [1434, 1869, 'Longer chunk of text'], [1869, 1978, 'Hello'], [1978, 2000, '']]), ('normal control', [[12345, 13344], ['Hello', 'friend', 'a']], [[12345, 12761, 'Hello'], [12761, 13260, 'friend'], [13260, 13344, 'a']])]]
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: piece text trim | [[100, 600, ' x '], [600, 1100, 'y']] | [[100, 600, 'x'], [600, 1100, 'y']] | Failed |
| regression variant: piece text trim | [[1000, 1285, 'ok '], [1285, 1999, 'Hello']] | [[1000, 1285, 'ok'], [1285, 1999, 'Hello']] | Failed |
| partial repair probe: piece text trim | [[0, 60, 'friend'], [60, 80, 'ok '], [80, 100, 'ok ']] | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | Failed |
| partial repair variant: piece text trim | [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, ' there '], [3770, 4001, 'a']] | [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']] | Failed |
| boundary control | [[0, 500, 'ab'], [500, 1000, 'cd']] | [[0, 500, 'ab'], [500, 1000, 'cd']] | Passed |
| boundary control | [[0, 500, 'a'], [500, 1000, '']] | [[0, 500, 'a'], [500, 1000, '']] | Passed |
| normal control | [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']] | [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']] | Passed |
| normal control | [[0, 2500, 'xyz']] | [[0, 2500, 'xyz']] | Passed |
| normal control | [[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 |
SHA-256 / f8831dc43e3e35ca59def64afd3a2ff1360fd11f330ca421e01029284da4b7c2
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+=x
b=start+dur*acc//total
out.append([prev,b,p.lstrip()])
prev=b
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: piece text trim', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: piece text trim', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: piece text trim', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: piece text trim', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']])], [('regression: piece text trim', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: piece text trim', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair probe: piece text trim', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: piece text trim', [[0, 7], [' ', 'ok ', ' ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[1000, 1999], ['a']], [[1000, 1999, 'a']]), ('normal control', [[12345, 15346], ['a', '']], [[12345, 13845, 'a'], [13845, 15346, '']]), ('normal control', [[12345, 13345], ['']], [[12345, 13345, '']])], [('regression: piece text trim', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('regression variant: piece text trim', [[12345, 12352], [' ']], [[12345, 12352, '']]), ('partial repair probe: piece text trim', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: piece text trim', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('normal control', [[12345, 12352], ['xyz', '']], [[12345, 12350, 'xyz'], [12350, 12352, '']]), ('normal control', [[12345, 13345], ['Hello', 'friend', 'Hello']], [[12345, 12657, 'Hello'], [12657, 13032, 'friend'], [13032, 13345, 'Hello']]), ('normal control', [[1000, 1007], ['Longer chunk of text', 'Hello']], [[1000, 1005, 'Longer chunk of text'], [1005, 1007, 'Hello']])], [('regression: piece text trim', [[0, 7], [' there ']], [[0, 7, 'there']]), ('regression variant: piece text trim', [[12345, 13344], ['ok ', 'ok ', ' ']], [[12345, 12744, 'ok'], [12744, 13144, 'ok'], [13144, 13344, '']]), ('partial repair probe: piece text trim', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: piece text trim', [[12345, 12352], [' there ', ' there ', 'xyz', ' ']], [[12345, 12347, 'there'], [12347, 12350, 'there'], [12350, 12351, 'xyz'], [12351, 12352, '']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[1000, 3500], ['xyz', 'a']], [[1000, 2875, 'xyz'], [2875, 3500, 'a']]), ('normal control', [[12345, 12352], ['']], [[12345, 12352, '']]), ('normal control', [[12345, 13345], ['', 'friend', 'a']], [[12345, 12470, ''], [12470, 13220, 'friend'], [13220, 13345, 'a']])], [('regression: piece text trim', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('regression variant: piece text trim', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('partial repair probe: piece text trim', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: piece text trim', [[1000, 1100], [' there ', 'friend']], [[1000, 1045, 'there'], [1045, 1100, 'friend']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[1000, 2000], ['Longer chunk of text', 'Longer chunk of text', 'Hello', '']], [[1000, 1434, 'Longer chunk of text'], [1434, 1869, 'Longer chunk of text'], [1869, 1978, 'Hello'], [1978, 2000, '']]), ('normal control', [[12345, 13344], ['Hello', 'friend', 'a']], [[12345, 12761, 'Hello'], [12761, 13260, 'friend'], [13260, 13344, 'a']])]]
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: piece text trim | [[100, 600, 'x '], [600, 1100, 'y']] | [[100, 600, 'x'], [600, 1100, 'y']] | Failed |
| regression variant: piece text trim | [[1000, 1285, 'ok '], [1285, 1999, 'Hello']] | [[1000, 1285, 'ok'], [1285, 1999, 'Hello']] | Failed |
| partial repair probe: piece text trim | [[0, 60, 'friend'], [60, 80, 'ok '], [80, 100, 'ok ']] | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | Failed |
| partial repair variant: piece text trim | [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there '], [3770, 4001, 'a']] | [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']] | Failed |
| boundary control | [[0, 500, 'ab'], [500, 1000, 'cd']] | [[0, 500, 'ab'], [500, 1000, 'cd']] | Passed |
| boundary control | [[0, 500, 'a'], [500, 1000, '']] | [[0, 500, 'a'], [500, 1000, '']] | Passed |
| normal control | [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']] | [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']] | Passed |
| normal control | [[0, 2500, 'xyz']] | [[0, 2500, 'xyz']] | Passed |
| normal control | [[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 |
SHA-256 / 4b48137bf385800043f35655980005aaa8d76468a850e1aa42a5e9ce0ebd4300
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: piece text trim', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: piece text trim', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: piece text trim', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: piece text trim', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']])], [('regression: piece text trim', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: piece text trim', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair probe: piece text trim', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: piece text trim', [[0, 7], [' ', 'ok ', ' ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[1000, 1999], ['a']], [[1000, 1999, 'a']]), ('normal control', [[12345, 15346], ['a', '']], [[12345, 13845, 'a'], [13845, 15346, '']]), ('normal control', [[12345, 13345], ['']], [[12345, 13345, '']])], [('regression: piece text trim', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('regression variant: piece text trim', [[12345, 12352], [' ']], [[12345, 12352, '']]), ('partial repair probe: piece text trim', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: piece text trim', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('normal control', [[12345, 12352], ['xyz', '']], [[12345, 12350, 'xyz'], [12350, 12352, '']]), ('normal control', [[12345, 13345], ['Hello', 'friend', 'Hello']], [[12345, 12657, 'Hello'], [12657, 13032, 'friend'], [13032, 13345, 'Hello']]), ('normal control', [[1000, 1007], ['Longer chunk of text', 'Hello']], [[1000, 1005, 'Longer chunk of text'], [1005, 1007, 'Hello']])], [('regression: piece text trim', [[0, 7], [' there ']], [[0, 7, 'there']]), ('regression variant: piece text trim', [[12345, 13344], ['ok ', 'ok ', ' ']], [[12345, 12744, 'ok'], [12744, 13144, 'ok'], [13144, 13344, '']]), ('partial repair probe: piece text trim', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: piece text trim', [[12345, 12352], [' there ', ' there ', 'xyz', ' ']], [[12345, 12347, 'there'], [12347, 12350, 'there'], [12350, 12351, 'xyz'], [12351, 12352, '']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[1000, 3500], ['xyz', 'a']], [[1000, 2875, 'xyz'], [2875, 3500, 'a']]), ('normal control', [[12345, 12352], ['']], [[12345, 12352, '']]), ('normal control', [[12345, 13345], ['', 'friend', 'a']], [[12345, 12470, ''], [12470, 13220, 'friend'], [13220, 13345, 'a']])], [('regression: piece text trim', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('regression variant: piece text trim', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('partial repair probe: piece text trim', [[1000, 1999], ['ok ', ' ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: piece text trim', [[1000, 1100], [' there ', 'friend']], [[1000, 1045, 'there'], [1045, 1100, 'friend']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[1000, 2000], ['Longer chunk of text', 'Longer chunk of text', 'Hello', '']], [[1000, 1434, 'Longer chunk of text'], [1434, 1869, 'Longer chunk of text'], [1869, 1978, 'Hello'], [1978, 2000, '']]), ('normal control', [[12345, 13344], ['Hello', 'friend', 'a']], [[12345, 12761, 'Hello'], [12761, 13260, 'friend'], [13260, 13344, 'a']])]]
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: piece text trim | [[100, 600, 'x'], [600, 1100, 'y']] | [[100, 600, 'x'], [600, 1100, 'y']] | Passed |
| regression variant: piece text trim | [[1000, 1285, 'ok'], [1285, 1999, 'Hello']] | [[1000, 1285, 'ok'], [1285, 1999, 'Hello']] | Passed |
| partial repair probe: piece text trim | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']] | Passed |
| partial repair variant: piece text trim | [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']] | [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']] | Passed |
| boundary control | [[0, 500, 'ab'], [500, 1000, 'cd']] | [[0, 500, 'ab'], [500, 1000, 'cd']] | Passed |
| boundary control | [[0, 500, 'a'], [500, 1000, '']] | [[0, 500, 'a'], [500, 1000, '']] | Passed |
| normal control | [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']] | [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']] | Passed |
| normal control | [[0, 2500, 'xyz']] | [[0, 2500, 'xyz']] | Passed |
| normal control | [[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 |
SHA-256 / f9a9ac5820863092b3d2743cef259f99ad8a6acd5df7cda235470356a371b9cb
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.620895+00:00.
Case digest / d072fc0aa6146b3a1a6c3ae490b3a430eaed3dcbbfc867c8b4fea7329cdcacec