FAILURE MAP
← Case archive

FA-78031 / Subtitle cue timing / Open access

Subtitle reading-speed check: speed threshold · case 01

Cues exactly at the permitted reading speed are flagged.

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

ROOT CAUSE

The speed comparison is inclusive at the limit.

THE FAILURE

The speed comparison is inclusive at the limit.

Unsuccessful approach: Dividing by whole seconds loses the sub-second part of the duration and misjudges short cues.

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: speed threshold', [[[0, 1000, 'abcdefghij']], 10], []), ('regression variant: speed threshold', [[[5543, 5743, '<font color="red">Red</font>'], [3551, 4551, 'Two\nlines'], [4354, 4454, '<i>A</i>']], 15], []), ('partial repair probe: speed threshold', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('partial repair variant: speed threshold', [[[9754, 12754, 'Long line of dialogue here'], [617, 617, 'A\r\nB\r\nC'], [5734, 7734, 'Two\r\nlines'], [3694, 4361, 'Two\r\nlines'], [253, 353, '  spaced  ']], 15], [2, 5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: speed threshold', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: speed threshold', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair probe: speed threshold', [[[6012, 6112, 'Hi there']], 15], [1]), ('partial repair variant: speed threshold', [[[5112, 5760, '<i>Italic</i> text'], [2636, 2931, 'Hello'], [1678, 1778, 'Two\r\nlines'], [6527, 6586, 'a'], [9403, 9403, 'x\n']], 17], [3, 5]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('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]), ('normal control', [[[5029, 5019, 'a<b>b</b>c<i>d</i>']], 20], [1])], [('regression: speed threshold', [[[9565, 11365, 'a<b>b</b>c<i>d</i>'], [7862, 10862, 'a<b>b</b>c<i>d</i>'], [9297, 9397, 'a']], 10], []), ('regression variant: speed threshold', [[[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 probe: speed threshold', [[[2466, 4200, 'Long line of dialogue here'], [3387, 5387, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: speed threshold', [[[7253, 10253, '<c.yellow>Cue</c> text'], [7954, 8954, 'x\ny\nz'], [4376, 4476, 'x\ny\nz'], [5892, 6892, 'Hi there']], 15], [3]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('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]), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('normal control', [[[959, 1459, 'Two\nlines'], [7727, 7727, 'x\ny\nz'], [3146, 3146, '<i>Italic</i> text'], [3843, 6843, 'Long line of dialogue here']], 20], [2, 3])], [('regression: speed threshold', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('regression variant: speed threshold', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('partial repair probe: speed threshold', [[[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]), ('partial repair variant: speed threshold', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[3192, 3393, 'a<b>b</b>c<i>d</i>']], 20], []), ('normal control', [[[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]), ('normal control', [[[6632, 6632, 'Two\nlines'], [8773, 8763, 'Two\nlines'], [815, 815, '<c.yellow>Cue</c> text']], 10], [1, 2, 3])], [('regression: speed threshold', [[[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]), ('regression variant: speed threshold', [[[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]), ('partial repair probe: speed threshold', [[[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]), ('partial repair variant: speed threshold', [[[2544, 2544, '  spaced  '], [4666, 4766, 'Hello'], [1260, 1250, ''], [1606, 1807, 'x\ny\nz']], 15], [1, 2]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[4014, 4081, 'a'], [3684, 6684, 'Hi there']], 15], []), ('normal control', [[[8878, 9378, 'a'], [1695, 1990, 'x\ny\nz'], [8649, 8649, '<c.yellow>Cue</c> text'], [4805, 5334, 'Two\nlines']], 17], [3]), ('normal control', [[[3769, 4036, 'a<b>b</b>c<i>d</i>']], 15], [])]]
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: speed threshold[1][]Failed
regression variant: speed threshold[1][]Failed
partial repair probe: speed threshold[1][1]Passed
partial repair variant: speed threshold[2, 5][2, 5]Passed
boundary control[1][1]Passed
boundary control[][]Passed
normal control[][]Passed
normal control[][]Passed
normal control[1][1]Passed

SHA-256 / 33312b654bcad7516c0a98a3e1efd32da03246bbb351dd6255f25a5137faf034

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'<[^>]*>','',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//(dur//1000 or 1)>max_cps:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: speed threshold', [[[0, 1000, 'abcdefghij']], 10], []), ('regression variant: speed threshold', [[[5543, 5743, '<font color="red">Red</font>'], [3551, 4551, 'Two\nlines'], [4354, 4454, '<i>A</i>']], 15], []), ('partial repair probe: speed threshold', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('partial repair variant: speed threshold', [[[9754, 12754, 'Long line of dialogue here'], [617, 617, 'A\r\nB\r\nC'], [5734, 7734, 'Two\r\nlines'], [3694, 4361, 'Two\r\nlines'], [253, 353, '  spaced  ']], 15], [2, 5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: speed threshold', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: speed threshold', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair probe: speed threshold', [[[6012, 6112, 'Hi there']], 15], [1]), ('partial repair variant: speed threshold', [[[5112, 5760, '<i>Italic</i> text'], [2636, 2931, 'Hello'], [1678, 1778, 'Two\r\nlines'], [6527, 6586, 'a'], [9403, 9403, 'x\n']], 17], [3, 5]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('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]), ('normal control', [[[5029, 5019, 'a<b>b</b>c<i>d</i>']], 20], [1])], [('regression: speed threshold', [[[9565, 11365, 'a<b>b</b>c<i>d</i>'], [7862, 10862, 'a<b>b</b>c<i>d</i>'], [9297, 9397, 'a']], 10], []), ('regression variant: speed threshold', [[[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 probe: speed threshold', [[[2466, 4200, 'Long line of dialogue here'], [3387, 5387, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: speed threshold', [[[7253, 10253, '<c.yellow>Cue</c> text'], [7954, 8954, 'x\ny\nz'], [4376, 4476, 'x\ny\nz'], [5892, 6892, 'Hi there']], 15], [3]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('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]), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('normal control', [[[959, 1459, 'Two\nlines'], [7727, 7727, 'x\ny\nz'], [3146, 3146, '<i>Italic</i> text'], [3843, 6843, 'Long line of dialogue here']], 20], [2, 3])], [('regression: speed threshold', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('regression variant: speed threshold', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('partial repair probe: speed threshold', [[[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]), ('partial repair variant: speed threshold', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[3192, 3393, 'a<b>b</b>c<i>d</i>']], 20], []), ('normal control', [[[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]), ('normal control', [[[6632, 6632, 'Two\nlines'], [8773, 8763, 'Two\nlines'], [815, 815, '<c.yellow>Cue</c> text']], 10], [1, 2, 3])], [('regression: speed threshold', [[[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]), ('regression variant: speed threshold', [[[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]), ('partial repair probe: speed threshold', [[[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]), ('partial repair variant: speed threshold', [[[2544, 2544, '  spaced  '], [4666, 4766, 'Hello'], [1260, 1250, ''], [1606, 1807, 'x\ny\nz']], 15], [1, 2]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[4014, 4081, 'a'], [3684, 6684, 'Hi there']], 15], []), ('normal control', [[[8878, 9378, 'a'], [1695, 1990, 'x\ny\nz'], [8649, 8649, '<c.yellow>Cue</c> text'], [4805, 5334, 'Two\nlines']], 17], [3]), ('normal control', [[[3769, 4036, 'a<b>b</b>c<i>d</i>']], 15], [])]]
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: speed threshold[][]Passed
regression variant: speed threshold[][]Passed
partial repair probe: speed threshold[][1]Failed
partial repair variant: speed threshold[2][2, 5]Failed
boundary control[1][1]Passed
boundary control[][]Passed
normal control[][]Passed
normal control[][]Passed
normal control[1][1]Passed

SHA-256 / 2405f8c757650424a41fe73795bd2c96a73885fa418c9f0984982ebcace7fe7b

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 870c3ddd740d1cfb692536ed09e05ef6c28c93ed79c11612bb3c942ae927586e