FAILURE MAP
← Case archive

FA-78016 / Subtitle cue timing / Open access

Subtitle reading-speed check: tag stripping · case 01

Cues with two formatting tags pass the speed check because their middle text vanishes.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The greedy tag pattern <.*> deletes everything between the first < and the last >.

VERIFIED REPAIR

Remove each tag individually with a non-greedy character class.

Unsuccessful approach: Matching only single-letter tags still counts attribute and class tags such as <font color=...>.

Case contract

For cues [start,end,text] return the 1-based indices whose reading speed exceeds max_cps. Tags <...> are removed, CRLF is treated as one line break, line breaks are not counted, all other characters (including spaces) count. The test is chars*1000 > max_cps*duration; a cue with duration <= 0 is flagged iff it has any counted character.

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
import re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'<.*>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>0: flagged.append(idx)
            continue
        if chars*1000>max_cps*dur:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tag stripping', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, '<font color="red">Red</font>'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: tag stripping', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'a<b>b</b>c<i>d</i>']], 17], [3]), ('partial repair probe: tag stripping', [[[4743, 5143, '<i>A</i>'], [1982, 2982, 'Hi there'], [5318, 5468, '<font color="red">Red</font>'], [4990, 5140, '<font color="red">Red</font>'], [1465, 1965, '<i>A</i>']], 20], []), ('partial repair variant: tag stripping', [[[4912, 5382, 'Hi there'], [4236, 4295, 'I'], [7060, 7560, '<c.yellow>Cue</c> text'], [81, 81, 'Two\nlines']], 17], [1, 4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2])], [('regression: tag stripping', [[[2260, 3260, '  spaced  '], [770, 770, '<font color="red">Red</font>'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: tag stripping', [[[3511, 4712, '<i>Italic</i> text'], [839, 829, '<font color="red">Red</font>'], [8024, 8358, 'x\ny\nz'], [1857, 1857, '']], 15], [2]), ('partial repair probe: tag stripping', [[[8476, 8947, 'Hi there'], [6662, 7162, '<font color="red">Red</font>'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair variant: tag stripping', [[[8515, 9515, '<c.yellow>Cue</c> text'], [836, 1337, 'x\ny\nz']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, '<i>A</i>'], [6179, 6169, 'Hello']], 20], [1, 3]), ('normal control', [[[3439, 3939, 'a<b>b</b>c<i>d</i>'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4])], [('regression: tag stripping', [[[1726, 1992, 'a<b>b</b>c<i>d</i>'], [9258, 10258, '<i>A</i>']], 15], [1]), ('regression variant: tag stripping', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'a<b>b</b>c<i>d</i>'], [9335, 9325, '<font color="red">Red</font>']], 17], [3]), ('partial repair probe: tag stripping', [[[1536, 2070, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: tag stripping', [[[2586, 4586, 'a'], [6090, 8090, 'Two\r\nlines'], [5201, 5501, '<font color="red">Red</font>'], [3151, 3152, ''], [8829, 8929, 'I']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[5649, 5916, 'a<b>b</b>c<i>d</i>'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3])], [('regression: tag stripping', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'a<b>b</b>c<i>d</i>'], [4016, 4116, 'a<b>b</b>c<i>d</i>']], 15], [1, 5]), ('regression variant: tag stripping', [[[8642, 8642, '<font color="red">Red</font>'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: tag stripping', [[[8643, 9643, '<i>Italic</i> text'], [6224, 7224, '<font color="red">Red</font>']], 10], [1]), ('partial repair variant: tag stripping', [[[6644, 7644, 'a<b>b</b>c<i>d</i>'], [1488, 1988, '<i>Italic</i> text'], [6071, 6371, '<font color="red">Red</font>'], [800, 800, '<i>Italic</i> text']], 10], [2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, '<i>Italic</i> text']], 15], []), ('normal control', [[[4694, 5494, 'Two\nlines'], [3327, 3327, 'x\ny\nz'], [2373, 4573, '<c.yellow>Cue</c> text'], [1711, 1911, 'x\n'], [7573, 7573, '<c.yellow>Cue</c> text']], 10], [2, 5]), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1])], [('regression: tag stripping', [[[7027, 7527, 'Two\nlines'], [1204, 1851, '<i>Italic</i> text'], [7529, 9059, 'Long line of dialogue here'], [3040, 3216, '<font color="red">Red</font>'], [5263, 5253, 'Two\r\nlines']], 17], [2, 4, 5]), ('regression variant: tag stripping', [[[9540, 9540, '<i>A</i>']], 20], [1]), ('partial repair probe: tag stripping', [[[463, 863, '<c.yellow>Cue</c> text'], [8098, 9098, '<i>A</i>'], [8359, 8859, 'Long line of dialogue here'], [2340, 2741, 'Two\nlines'], [4451, 4451, 'A\r\nB\r\nC']], 20], [3, 5]), ('partial repair variant: tag stripping', [[[4798, 4898, 'a'], [6925, 9925, 'Two\r\nlines'], [8398, 9398, '<font color="red">Red</font>'], [5098, 5298, '<font color="red">Red</font>']], 15], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('normal control', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('normal control', [[[955, 1005, '<i>A</i>'], [9350, 11350, 'a<b>b</b>c<i>d</i>'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4])]]
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 fixtureActualExpectedOutcome
regression: tag stripping[4][3, 4]Failed
regression variant: tag stripping[][3]Failed
partial repair probe: tag stripping[][]Passed
partial repair variant: tag stripping[1, 4][1, 4]Passed
boundary control[][]Passed
boundary control[][]Passed
normal control[1][1]Passed
normal control[][]Passed
normal control[2][2]Passed

SHA-256 / 7eaa58059f67c25b881b52d85c984fbf2d20ba7b9e553b3480ee57fe603a449e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'</?[a-z]>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>0: flagged.append(idx)
            continue
        if chars*1000>max_cps*dur:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tag stripping', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, '<font color="red">Red</font>'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: tag stripping', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'a<b>b</b>c<i>d</i>']], 17], [3]), ('partial repair probe: tag stripping', [[[4743, 5143, '<i>A</i>'], [1982, 2982, 'Hi there'], [5318, 5468, '<font color="red">Red</font>'], [4990, 5140, '<font color="red">Red</font>'], [1465, 1965, '<i>A</i>']], 20], []), ('partial repair variant: tag stripping', [[[4912, 5382, 'Hi there'], [4236, 4295, 'I'], [7060, 7560, '<c.yellow>Cue</c> text'], [81, 81, 'Two\nlines']], 17], [1, 4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2])], [('regression: tag stripping', [[[2260, 3260, '  spaced  '], [770, 770, '<font color="red">Red</font>'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: tag stripping', [[[3511, 4712, '<i>Italic</i> text'], [839, 829, '<font color="red">Red</font>'], [8024, 8358, 'x\ny\nz'], [1857, 1857, '']], 15], [2]), ('partial repair probe: tag stripping', [[[8476, 8947, 'Hi there'], [6662, 7162, '<font color="red">Red</font>'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair variant: tag stripping', [[[8515, 9515, '<c.yellow>Cue</c> text'], [836, 1337, 'x\ny\nz']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, '<i>A</i>'], [6179, 6169, 'Hello']], 20], [1, 3]), ('normal control', [[[3439, 3939, 'a<b>b</b>c<i>d</i>'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4])], [('regression: tag stripping', [[[1726, 1992, 'a<b>b</b>c<i>d</i>'], [9258, 10258, '<i>A</i>']], 15], [1]), ('regression variant: tag stripping', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'a<b>b</b>c<i>d</i>'], [9335, 9325, '<font color="red">Red</font>']], 17], [3]), ('partial repair probe: tag stripping', [[[1536, 2070, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: tag stripping', [[[2586, 4586, 'a'], [6090, 8090, 'Two\r\nlines'], [5201, 5501, '<font color="red">Red</font>'], [3151, 3152, ''], [8829, 8929, 'I']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[5649, 5916, 'a<b>b</b>c<i>d</i>'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3])], [('regression: tag stripping', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'a<b>b</b>c<i>d</i>'], [4016, 4116, 'a<b>b</b>c<i>d</i>']], 15], [1, 5]), ('regression variant: tag stripping', [[[8642, 8642, '<font color="red">Red</font>'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: tag stripping', [[[8643, 9643, '<i>Italic</i> text'], [6224, 7224, '<font color="red">Red</font>']], 10], [1]), ('partial repair variant: tag stripping', [[[6644, 7644, 'a<b>b</b>c<i>d</i>'], [1488, 1988, '<i>Italic</i> text'], [6071, 6371, '<font color="red">Red</font>'], [800, 800, '<i>Italic</i> text']], 10], [2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, '<i>Italic</i> text']], 15], []), ('normal control', [[[4694, 5494, 'Two\nlines'], [3327, 3327, 'x\ny\nz'], [2373, 4573, '<c.yellow>Cue</c> text'], [1711, 1911, 'x\n'], [7573, 7573, '<c.yellow>Cue</c> text']], 10], [2, 5]), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1])], [('regression: tag stripping', [[[7027, 7527, 'Two\nlines'], [1204, 1851, '<i>Italic</i> text'], [7529, 9059, 'Long line of dialogue here'], [3040, 3216, '<font color="red">Red</font>'], [5263, 5253, 'Two\r\nlines']], 17], [2, 4, 5]), ('regression variant: tag stripping', [[[9540, 9540, '<i>A</i>']], 20], [1]), ('partial repair probe: tag stripping', [[[463, 863, '<c.yellow>Cue</c> text'], [8098, 9098, '<i>A</i>'], [8359, 8859, 'Long line of dialogue here'], [2340, 2741, 'Two\nlines'], [4451, 4451, 'A\r\nB\r\nC']], 20], [3, 5]), ('partial repair variant: tag stripping', [[[4798, 4898, 'a'], [6925, 9925, 'Two\r\nlines'], [8398, 9398, '<font color="red">Red</font>'], [5098, 5298, '<font color="red">Red</font>']], 15], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('normal control', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('normal control', [[[955, 1005, '<i>A</i>'], [9350, 11350, 'a<b>b</b>c<i>d</i>'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4])]]
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 fixtureActualExpectedOutcome
regression: tag stripping[3, 4][3, 4]Passed
regression variant: tag stripping[3][3]Passed
partial repair probe: tag stripping[3, 4][]Failed
partial repair variant: tag stripping[1, 3, 4][1, 4]Failed
boundary control[][]Passed
boundary control[][]Passed
normal control[1][1]Passed
normal control[][]Passed
normal control[2][2]Passed

SHA-256 / f72a3ee27e03290d44541db58d0c26e6ac54548ca1a66098264910e9e704b9df

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'<[^>]*>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>0: flagged.append(idx)
            continue
        if chars*1000>max_cps*dur:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tag stripping', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, '<font color="red">Red</font>'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: tag stripping', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'a<b>b</b>c<i>d</i>']], 17], [3]), ('partial repair probe: tag stripping', [[[4743, 5143, '<i>A</i>'], [1982, 2982, 'Hi there'], [5318, 5468, '<font color="red">Red</font>'], [4990, 5140, '<font color="red">Red</font>'], [1465, 1965, '<i>A</i>']], 20], []), ('partial repair variant: tag stripping', [[[4912, 5382, 'Hi there'], [4236, 4295, 'I'], [7060, 7560, '<c.yellow>Cue</c> text'], [81, 81, 'Two\nlines']], 17], [1, 4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2])], [('regression: tag stripping', [[[2260, 3260, '  spaced  '], [770, 770, '<font color="red">Red</font>'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: tag stripping', [[[3511, 4712, '<i>Italic</i> text'], [839, 829, '<font color="red">Red</font>'], [8024, 8358, 'x\ny\nz'], [1857, 1857, '']], 15], [2]), ('partial repair probe: tag stripping', [[[8476, 8947, 'Hi there'], [6662, 7162, '<font color="red">Red</font>'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair variant: tag stripping', [[[8515, 9515, '<c.yellow>Cue</c> text'], [836, 1337, 'x\ny\nz']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, '<i>A</i>'], [6179, 6169, 'Hello']], 20], [1, 3]), ('normal control', [[[3439, 3939, 'a<b>b</b>c<i>d</i>'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4])], [('regression: tag stripping', [[[1726, 1992, 'a<b>b</b>c<i>d</i>'], [9258, 10258, '<i>A</i>']], 15], [1]), ('regression variant: tag stripping', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'a<b>b</b>c<i>d</i>'], [9335, 9325, '<font color="red">Red</font>']], 17], [3]), ('partial repair probe: tag stripping', [[[1536, 2070, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: tag stripping', [[[2586, 4586, 'a'], [6090, 8090, 'Two\r\nlines'], [5201, 5501, '<font color="red">Red</font>'], [3151, 3152, ''], [8829, 8929, 'I']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[5649, 5916, 'a<b>b</b>c<i>d</i>'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3])], [('regression: tag stripping', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'a<b>b</b>c<i>d</i>'], [4016, 4116, 'a<b>b</b>c<i>d</i>']], 15], [1, 5]), ('regression variant: tag stripping', [[[8642, 8642, '<font color="red">Red</font>'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: tag stripping', [[[8643, 9643, '<i>Italic</i> text'], [6224, 7224, '<font color="red">Red</font>']], 10], [1]), ('partial repair variant: tag stripping', [[[6644, 7644, 'a<b>b</b>c<i>d</i>'], [1488, 1988, '<i>Italic</i> text'], [6071, 6371, '<font color="red">Red</font>'], [800, 800, '<i>Italic</i> text']], 10], [2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, '<i>Italic</i> text']], 15], []), ('normal control', [[[4694, 5494, 'Two\nlines'], [3327, 3327, 'x\ny\nz'], [2373, 4573, '<c.yellow>Cue</c> text'], [1711, 1911, 'x\n'], [7573, 7573, '<c.yellow>Cue</c> text']], 10], [2, 5]), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1])], [('regression: tag stripping', [[[7027, 7527, 'Two\nlines'], [1204, 1851, '<i>Italic</i> text'], [7529, 9059, 'Long line of dialogue here'], [3040, 3216, '<font color="red">Red</font>'], [5263, 5253, 'Two\r\nlines']], 17], [2, 4, 5]), ('regression variant: tag stripping', [[[9540, 9540, '<i>A</i>']], 20], [1]), ('partial repair probe: tag stripping', [[[463, 863, '<c.yellow>Cue</c> text'], [8098, 9098, '<i>A</i>'], [8359, 8859, 'Long line of dialogue here'], [2340, 2741, 'Two\nlines'], [4451, 4451, 'A\r\nB\r\nC']], 20], [3, 5]), ('partial repair variant: tag stripping', [[[4798, 4898, 'a'], [6925, 9925, 'Two\r\nlines'], [8398, 9398, '<font color="red">Red</font>'], [5098, 5298, '<font color="red">Red</font>']], 15], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('normal control', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('normal control', [[[955, 1005, '<i>A</i>'], [9350, 11350, 'a<b>b</b>c<i>d</i>'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4])]]
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 fixtureActualExpectedOutcome
regression: tag stripping[3, 4][3, 4]Passed
regression variant: tag stripping[3][3]Passed
partial repair probe: tag stripping[][]Passed
partial repair variant: tag stripping[1, 4][1, 4]Passed
boundary control[][]Passed
boundary control[][]Passed
normal control[1][1]Passed
normal control[][]Passed
normal control[2][2]Passed

SHA-256 / 87fbe8cb31357dd8814818cac38dab4f4ca5a3e1171593fb7e40cc9f489fb650

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:31.343692+00:00.

Case digest / e0fb2a2cbb2a6b65022fa80df100e09deb82cc6bc55ac8f5973a4f1e39a5b546