FA-77856 / Subtitle cue timing / Open access
SRT timestamp parsing: fraction digit limit · case 01
Valid short fractions such as ,5 are rejected while the file loads with missing cues.
ROOT CAUSE
The fraction length rule requires exactly three digits, contradicting the 1 to 3 digit contract.
VERIFIED REPAIR
Only reject fractions longer than three digits.
Unsuccessful approach: Rejecting fractions of three or more digits now refuses the canonical ,mmm form.
Case contract
Parse an SRT timestamp HH:MM:SS,mmm to integer milliseconds. Hours have 2 or more digits, minutes and seconds are below 60, the fraction has 1 to 3 digits and is right-padded (",5" means 500 ms), "." is accepted as the separator, surrounding whitespace (including a CR from CRLF files) is ignored; invalid text returns None.
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(s):
s=s.strip()
parts=s.replace('.',',').split(',')
if len(parts)!=2: return None
hms,frac=parts
fields=hms.split(':')
if len(fields)!=3: return None
if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
if len(frac)!=3: return None
h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
if mi>=60 or se>=60: return None
ms=int(frac.ljust(3,'0'))
return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction digit limit', ['00:00:01,5'], 1500), ('regression variant: fraction digit limit', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction digit limit', ['00:59:59,999\r'], 3599999), ('partial repair variant: fraction digit limit', ['01:05:00,500\r'], 3900500), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:61:00;5 \r'], None), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:30:42.1234\r'], None)], [('regression: fraction digit limit', [' 00:05:00.5 '], 300500), ('regression variant: fraction digit limit', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction digit limit', ['100:00:00,000'], 360000000), ('partial repair variant: fraction digit limit', ['100:30:42,500\r'], 361842500), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 00:61:01;999\r'], None), ('normal control', ['123:60:42,999'], None), ('normal control', [' 10:00:61.001\r'], None)], [('regression: fraction digit limit', ['02:30:42,5\t'], 9042500), ('regression variant: fraction digit limit', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction digit limit', ['99:00:00.500\r'], 356400500), ('partial repair variant: fraction digit limit', ['123:05:01,001\t'], 443101001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['10:60:60,07 '], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction digit limit', ['00:30:59,12 '], 1859120), ('regression variant: fraction digit limit', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction digit limit', ['99:00:59,001 \r'], 356459001), ('partial repair variant: fraction digit limit', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['100:60:60,999 '], None), ('normal control', ['123:00:61,001 \r'], None), ('normal control', [' 99:60:60, '], None)], [('regression: fraction digit limit', [' 123:59:42,50 '], 446382500), ('regression variant: fraction digit limit', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction digit limit', ['00:59:00.000'], 3540000), ('partial repair variant: fraction digit limit', ['10:05:42,000 '], 36342000), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 100:59:61,50'], None), ('normal control', ['00:61:01;12 \r'], None), ('normal control', [' 00:60:59, '], None)]]
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: fraction digit limit | None | 1500 | Failed |
| regression variant: fraction digit limit | None | 360000070 | Failed |
| partial repair probe: fraction digit limit | 3599999 | 3599999 | Passed |
| partial repair variant: fraction digit limit | 3900500 | 3900500 | Passed |
| boundary control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / 619164e92215569fd21ccb02726ac296e9795c6df0d8700e25c779e684136d68
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
s=s.strip()
parts=s.replace('.',',').split(',')
if len(parts)!=2: return None
hms,frac=parts
fields=hms.split(':')
if len(fields)!=3: return None
if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
if len(frac)>=3: return None
h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
if mi>=60 or se>=60: return None
ms=int(frac.ljust(3,'0'))
return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction digit limit', ['00:00:01,5'], 1500), ('regression variant: fraction digit limit', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction digit limit', ['00:59:59,999\r'], 3599999), ('partial repair variant: fraction digit limit', ['01:05:00,500\r'], 3900500), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:61:00;5 \r'], None), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:30:42.1234\r'], None)], [('regression: fraction digit limit', [' 00:05:00.5 '], 300500), ('regression variant: fraction digit limit', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction digit limit', ['100:00:00,000'], 360000000), ('partial repair variant: fraction digit limit', ['100:30:42,500\r'], 361842500), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 00:61:01;999\r'], None), ('normal control', ['123:60:42,999'], None), ('normal control', [' 10:00:61.001\r'], None)], [('regression: fraction digit limit', ['02:30:42,5\t'], 9042500), ('regression variant: fraction digit limit', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction digit limit', ['99:00:00.500\r'], 356400500), ('partial repair variant: fraction digit limit', ['123:05:01,001\t'], 443101001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['10:60:60,07 '], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction digit limit', ['00:30:59,12 '], 1859120), ('regression variant: fraction digit limit', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction digit limit', ['99:00:59,001 \r'], 356459001), ('partial repair variant: fraction digit limit', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['100:60:60,999 '], None), ('normal control', ['123:00:61,001 \r'], None), ('normal control', [' 99:60:60, '], None)], [('regression: fraction digit limit', [' 123:59:42,50 '], 446382500), ('regression variant: fraction digit limit', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction digit limit', ['00:59:00.000'], 3540000), ('partial repair variant: fraction digit limit', ['10:05:42,000 '], 36342000), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 100:59:61,50'], None), ('normal control', ['00:61:01;12 \r'], None), ('normal control', [' 00:60:59, '], None)]]
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: fraction digit limit | 1500 | 1500 | Passed |
| regression variant: fraction digit limit | 360000070 | 360000070 | Passed |
| partial repair probe: fraction digit limit | None | 3599999 | Failed |
| partial repair variant: fraction digit limit | None | 3900500 | Failed |
| boundary control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / 9b5138cef2f0d977b9599a725a8c71378876a899ff50ab53e9c681622d8d8190
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
s=s.strip()
parts=s.replace('.',',').split(',')
if len(parts)!=2: return None
hms,frac=parts
fields=hms.split(':')
if len(fields)!=3: return None
if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
if len(frac)>3: return None
h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
if mi>=60 or se>=60: return None
ms=int(frac.ljust(3,'0'))
return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction digit limit', ['00:00:01,5'], 1500), ('regression variant: fraction digit limit', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction digit limit', ['00:59:59,999\r'], 3599999), ('partial repair variant: fraction digit limit', ['01:05:00,500\r'], 3900500), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:61:00;5 \r'], None), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:30:42.1234\r'], None)], [('regression: fraction digit limit', [' 00:05:00.5 '], 300500), ('regression variant: fraction digit limit', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction digit limit', ['100:00:00,000'], 360000000), ('partial repair variant: fraction digit limit', ['100:30:42,500\r'], 361842500), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 00:61:01;999\r'], None), ('normal control', ['123:60:42,999'], None), ('normal control', [' 10:00:61.001\r'], None)], [('regression: fraction digit limit', ['02:30:42,5\t'], 9042500), ('regression variant: fraction digit limit', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction digit limit', ['99:00:00.500\r'], 356400500), ('partial repair variant: fraction digit limit', ['123:05:01,001\t'], 443101001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['10:60:60,07 '], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction digit limit', ['00:30:59,12 '], 1859120), ('regression variant: fraction digit limit', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction digit limit', ['99:00:59,001 \r'], 356459001), ('partial repair variant: fraction digit limit', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['100:60:60,999 '], None), ('normal control', ['123:00:61,001 \r'], None), ('normal control', [' 99:60:60, '], None)], [('regression: fraction digit limit', [' 123:59:42,50 '], 446382500), ('regression variant: fraction digit limit', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction digit limit', ['00:59:00.000'], 3540000), ('partial repair variant: fraction digit limit', ['10:05:42,000 '], 36342000), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 100:59:61,50'], None), ('normal control', ['00:61:01;12 \r'], None), ('normal control', [' 00:60:59, '], None)]]
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: fraction digit limit | 1500 | 1500 | Passed |
| regression variant: fraction digit limit | 360000070 | 360000070 | Passed |
| partial repair probe: fraction digit limit | 3599999 | 3599999 | Passed |
| partial repair variant: fraction digit limit | 3900500 | 3900500 | Passed |
| boundary control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
| normal control | None | None | Passed |
SHA-256 / a0822e79f820820c7d419acea9899464727c687e85a7cb913767a9b1f3cab3b8
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:29.926822+00:00.
Case digest / a88159607a128dc088e67f7b03a48322589f30f3b93d2c2b4208e4bfaa1a8a29