FAILURE MAP
← Case archive

FA-78026 / Subtitle cue timing / Open access

Subtitle reading-speed check: crlf normalization · case 01

Cues from Windows-authored files read one character faster per line break.

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

ROOT CAUSE

Carriage returns from CRLF line endings are left in the text and counted.

THE FAILURE

Carriage returns from CRLF line endings are left in the text and counted.

Unsuccessful approach: Normalizing the reversed LF CR sequence never matches Windows line endings.

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
        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: crlf normalization', [[[0, 500, 'a\r\nb']], 5], []), ('regression variant: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair probe: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair variant: crlf normalization', [[[4520, 4520, '<i>A</i>'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[0, 0, '']], 17], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: crlf normalization', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair probe: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('partial repair variant: crlf normalization', [[[5725, 5725, 'a'], [6804, 7470, '  spaced  '], [5609, 5609, 'a<b>b</b>c<i>d</i>'], [1969, 2035, 'a'], [2084, 2618, 'Two\r\nlines']], 15], [1, 2, 3, 4]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[9565, 11365, 'a<b>b</b>c<i>d</i>'], [7862, 10862, 'a<b>b</b>c<i>d</i>'], [9297, 9397, 'a']], 10], []), ('normal control', [[[7732, 8133, '<i>A</i>'], [2534, 2634, 'Two\r\nlines']], 20], [2])], [('regression: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('regression variant: crlf normalization', [[[7259, 10259, 'x\ny\nz'], [6920, 7220, 'A\r\nB\r\nC']], 10], []), ('partial repair probe: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('partial repair variant: crlf normalization', [[[605, 906, 'A\r\nB\r\nC'], [7108, 8108, 'a<b>b</b>c<i>d</i>']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[5260, 5250, ''], [1557, 1557, 'Long line of dialogue here'], [5807, 7807, 'Long line of dialogue here'], [6191, 7191, 'x\n']], 15], [2]), ('normal control', [[[5029, 5019, 'a<b>b</b>c<i>d</i>']], 20], [1]), ('normal control', [[[6012, 6112, 'Hi there']], 15], [1])], [('regression: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('regression variant: crlf normalization', [[[1676, 1827, 'A\r\nB\r\nC'], [5080, 5080, '  spaced  '], [8082, 11082, 'a'], [9203, 9193, 'a<b>b</b>c<i>d</i>']], 20], [2, 4]), ('partial repair probe: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair variant: crlf normalization', [[[1193, 1370, 'A\r\nB\r\nC']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], []), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('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])], [('regression: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('regression variant: crlf normalization', [[[4520, 4520, '<i>A</i>'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('partial repair probe: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair variant: crlf normalization', [[[2637, 3038, 'Two\r\nlines'], [1289, 1689, 'Hi there'], [8536, 8587, 'a'], [9456, 10456, 'x\n'], [1366, 1366, 'Long line of dialogue here']], 20], [5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1]), ('normal control', [[[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]), ('normal control', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'a<b>b</b>c<i>d</i>']], 17], [3])]]
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: crlf normalization[1][]Failed
regression variant: crlf normalization[1, 2][1]Failed
partial repair probe: crlf normalization[1][]Failed
partial repair variant: crlf normalization[1, 4][1]Failed
boundary control[][]Passed
boundary control[1][1]Passed
normal control[][]Passed
normal control[][]Passed
normal control[1][1]Passed

SHA-256 / 0f694dda737030dcc1f11fc3416d34bb25906d2058fcf4196c65fffcbae640a3

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('\n\r','\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: crlf normalization', [[[0, 500, 'a\r\nb']], 5], []), ('regression variant: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair probe: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair variant: crlf normalization', [[[4520, 4520, '<i>A</i>'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[0, 0, '']], 17], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: crlf normalization', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair probe: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('partial repair variant: crlf normalization', [[[5725, 5725, 'a'], [6804, 7470, '  spaced  '], [5609, 5609, 'a<b>b</b>c<i>d</i>'], [1969, 2035, 'a'], [2084, 2618, 'Two\r\nlines']], 15], [1, 2, 3, 4]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[9565, 11365, 'a<b>b</b>c<i>d</i>'], [7862, 10862, 'a<b>b</b>c<i>d</i>'], [9297, 9397, 'a']], 10], []), ('normal control', [[[7732, 8133, '<i>A</i>'], [2534, 2634, 'Two\r\nlines']], 20], [2])], [('regression: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('regression variant: crlf normalization', [[[7259, 10259, 'x\ny\nz'], [6920, 7220, 'A\r\nB\r\nC']], 10], []), ('partial repair probe: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('partial repair variant: crlf normalization', [[[605, 906, 'A\r\nB\r\nC'], [7108, 8108, 'a<b>b</b>c<i>d</i>']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[5260, 5250, ''], [1557, 1557, 'Long line of dialogue here'], [5807, 7807, 'Long line of dialogue here'], [6191, 7191, 'x\n']], 15], [2]), ('normal control', [[[5029, 5019, 'a<b>b</b>c<i>d</i>']], 20], [1]), ('normal control', [[[6012, 6112, 'Hi there']], 15], [1])], [('regression: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('regression variant: crlf normalization', [[[1676, 1827, 'A\r\nB\r\nC'], [5080, 5080, '  spaced  '], [8082, 11082, 'a'], [9203, 9193, 'a<b>b</b>c<i>d</i>']], 20], [2, 4]), ('partial repair probe: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair variant: crlf normalization', [[[1193, 1370, 'A\r\nB\r\nC']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], []), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('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])], [('regression: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('regression variant: crlf normalization', [[[4520, 4520, '<i>A</i>'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('partial repair probe: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair variant: crlf normalization', [[[2637, 3038, 'Two\r\nlines'], [1289, 1689, 'Hi there'], [8536, 8587, 'a'], [9456, 10456, 'x\n'], [1366, 1366, 'Long line of dialogue here']], 20], [5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1]), ('normal control', [[[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]), ('normal control', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'a<b>b</b>c<i>d</i>']], 17], [3])]]
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: crlf normalization[1][]Failed
regression variant: crlf normalization[1, 2][1]Failed
partial repair probe: crlf normalization[1][]Failed
partial repair variant: crlf normalization[1, 4][1]Failed
boundary control[][]Passed
boundary control[1][1]Passed
normal control[][]Passed
normal control[][]Passed
normal control[1][1]Passed

SHA-256 / 1ececdca20897ac0029bb4efceb5603b3a92739d98f4cdfb1c519d04b9750fe3

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

Case digest / 80dc5d54913a98b8a2ab93418d2ecde6f2bdf80b4d6dd038a72cb354c8cf16e1