FA-78206 / Subtitle cue timing / Open access
Timed-text time expression evaluation: clock frame bound · case 01
A frame field equal to the frame rate is accepted and rolls into the next second.
ROOT CAUSE
The frame field bound allows the frame rate itself.
VERIFIED REPAIR
Reject frame fields at or above the frame rate.
Unsuccessful approach: A fixed limit of 60 ignores the declared frame rate.
Case contract
Evaluate a timed-text time expression to integer ms, rounded half up. Offset form <number><metric> with metric h, m, s, ms, f (frames at frame_rate) or t (ticks at tick_rate). Clock form HH:MM:SS with optional .fraction (any digits) or :FF frames (FF < frame_rate). Minutes/seconds above 59 or malformed text give 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
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
if m:
v=Fraction(m.group(1))
unit=m.group(2)
scale={'h':3600000,'m':60000,'s':1000,'ms':1}
if unit in scale:
x=v*scale[unit]
elif unit=='f':
x=v*1000/frame_rate
else:
x=v*1000/tick_rate
return math.floor(x+Fraction(1,2))
m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
if not m:
return None
h,mi,se,frac,fr=m.groups()
if int(mi)>59 or int(se)>59:
return None
x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
if frac:
x+=Fraction('0.'+frac)*1000
if fr:
if int(fr)>frame_rate:
return None
x+=Fraction(int(fr)*1000,frame_rate)
return (x*2+1)//2
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock frame bound', ['00:00:00:25', 25, 1000], None), ('regression variant: clock frame bound', ['100:59:05:30', 30, 1000], None), ('partial repair probe: clock frame bound', ['10:30:00:25', 16, 10000000], None), ('partial repair variant: clock frame bound', ['100:30:00:29', 25, 90000], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock frame bound', ['100:59:05:30', 30, 1000], None), ('regression variant: clock frame bound', ['10:00:00:25', 25, 3], None), ('partial repair probe: clock frame bound', ['100:30:05:30', 16, 10000000], None), ('partial repair variant: clock frame bound', ['10:30:05:25', 24, 3], None), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: clock frame bound', ['10:00:00:25', 25, 3], None), ('regression variant: clock frame bound', ['00:30:59:30', 30, 3], None), ('partial repair probe: clock frame bound', ['01:30:05:25', 16, 90000], None), ('partial repair variant: clock frame bound', ['01:59:59:24', 16, 3], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock frame bound', ['00:30:59:30', 30, 3], None), ('regression variant: clock frame bound', ['01:59:05:24', 24, 3], None), ('partial repair probe: clock frame bound', ['10:00:00:30', 25, 1000], None), ('partial repair variant: clock frame bound', ['01:00:59:29', 25, 10000000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0t', 24, 3], 0), ('normal control', ['17s', 25, 1000], 17000), ('normal control', ['100:59:59:03', 50, 3], 363599060)], [('regression: clock frame bound', ['01:59:05:24', 24, 3], None), ('regression variant: clock frame bound', ['00:00:00:25', 25, 1000], None), ('partial repair probe: clock frame bound', ['00:59:59:30', 24, 3], None), ('partial repair variant: clock frame bound', ['00:59:05:30', 24, 3], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['00:59:00:03', 24, 1000], 3540125)]]
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: clock frame bound | 1000 | None | Failed |
| regression variant: clock frame bound | 363546000 | None | Failed |
| partial repair probe: clock frame bound | None | None | Passed |
| partial repair variant: clock frame bound | None | None | Passed |
| boundary control | 10 | 10 | Passed |
| boundary control | 1001 | 1001 | Passed |
| normal control | 188 | 188 | Passed |
| normal control | 39599375 | 39599375 | Passed |
| normal control | None | None | Passed |
SHA-256 / 530861df00828f628d4751d317d37d9f4516b872ed65efe7670e2f097703d1a8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
if m:
v=Fraction(m.group(1))
unit=m.group(2)
scale={'h':3600000,'m':60000,'s':1000,'ms':1}
if unit in scale:
x=v*scale[unit]
elif unit=='f':
x=v*1000/frame_rate
else:
x=v*1000/tick_rate
return math.floor(x+Fraction(1,2))
m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
if not m:
return None
h,mi,se,frac,fr=m.groups()
if int(mi)>59 or int(se)>59:
return None
x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
if frac:
x+=Fraction('0.'+frac)*1000
if fr:
if int(fr)>=60:
return None
x+=Fraction(int(fr)*1000,frame_rate)
return (x*2+1)//2
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock frame bound', ['00:00:00:25', 25, 1000], None), ('regression variant: clock frame bound', ['100:59:05:30', 30, 1000], None), ('partial repair probe: clock frame bound', ['10:30:00:25', 16, 10000000], None), ('partial repair variant: clock frame bound', ['100:30:00:29', 25, 90000], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock frame bound', ['100:59:05:30', 30, 1000], None), ('regression variant: clock frame bound', ['10:00:00:25', 25, 3], None), ('partial repair probe: clock frame bound', ['100:30:05:30', 16, 10000000], None), ('partial repair variant: clock frame bound', ['10:30:05:25', 24, 3], None), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: clock frame bound', ['10:00:00:25', 25, 3], None), ('regression variant: clock frame bound', ['00:30:59:30', 30, 3], None), ('partial repair probe: clock frame bound', ['01:30:05:25', 16, 90000], None), ('partial repair variant: clock frame bound', ['01:59:59:24', 16, 3], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock frame bound', ['00:30:59:30', 30, 3], None), ('regression variant: clock frame bound', ['01:59:05:24', 24, 3], None), ('partial repair probe: clock frame bound', ['10:00:00:30', 25, 1000], None), ('partial repair variant: clock frame bound', ['01:00:59:29', 25, 10000000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0t', 24, 3], 0), ('normal control', ['17s', 25, 1000], 17000), ('normal control', ['100:59:59:03', 50, 3], 363599060)], [('regression: clock frame bound', ['01:59:05:24', 24, 3], None), ('regression variant: clock frame bound', ['00:00:00:25', 25, 1000], None), ('partial repair probe: clock frame bound', ['00:59:59:30', 24, 3], None), ('partial repair variant: clock frame bound', ['00:59:05:30', 24, 3], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['00:59:00:03', 24, 1000], 3540125)]]
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: clock frame bound | 1000 | None | Failed |
| regression variant: clock frame bound | 363546000 | None | Failed |
| partial repair probe: clock frame bound | 37801563 | None | Failed |
| partial repair variant: clock frame bound | 361801160 | None | Failed |
| boundary control | 10 | 10 | Passed |
| boundary control | 1001 | 1001 | Passed |
| normal control | 188 | 188 | Passed |
| normal control | 39599375 | 39599375 | Passed |
| normal control | None | None | Passed |
SHA-256 / ac3c738bf6977c94fed71671d16dc38fe8b9e8b72266e0dc55e8cb12cdaf7b00
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
if m:
v=Fraction(m.group(1))
unit=m.group(2)
scale={'h':3600000,'m':60000,'s':1000,'ms':1}
if unit in scale:
x=v*scale[unit]
elif unit=='f':
x=v*1000/frame_rate
else:
x=v*1000/tick_rate
return math.floor(x+Fraction(1,2))
m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
if not m:
return None
h,mi,se,frac,fr=m.groups()
if int(mi)>59 or int(se)>59:
return None
x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
if frac:
x+=Fraction('0.'+frac)*1000
if fr:
if int(fr)>=frame_rate:
return None
x+=Fraction(int(fr)*1000,frame_rate)
return (x*2+1)//2
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock frame bound', ['00:00:00:25', 25, 1000], None), ('regression variant: clock frame bound', ['100:59:05:30', 30, 1000], None), ('partial repair probe: clock frame bound', ['10:30:00:25', 16, 10000000], None), ('partial repair variant: clock frame bound', ['100:30:00:29', 25, 90000], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock frame bound', ['100:59:05:30', 30, 1000], None), ('regression variant: clock frame bound', ['10:00:00:25', 25, 3], None), ('partial repair probe: clock frame bound', ['100:30:05:30', 16, 10000000], None), ('partial repair variant: clock frame bound', ['10:30:05:25', 24, 3], None), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: clock frame bound', ['10:00:00:25', 25, 3], None), ('regression variant: clock frame bound', ['00:30:59:30', 30, 3], None), ('partial repair probe: clock frame bound', ['01:30:05:25', 16, 90000], None), ('partial repair variant: clock frame bound', ['01:59:59:24', 16, 3], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock frame bound', ['00:30:59:30', 30, 3], None), ('regression variant: clock frame bound', ['01:59:05:24', 24, 3], None), ('partial repair probe: clock frame bound', ['10:00:00:30', 25, 1000], None), ('partial repair variant: clock frame bound', ['01:00:59:29', 25, 10000000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0t', 24, 3], 0), ('normal control', ['17s', 25, 1000], 17000), ('normal control', ['100:59:59:03', 50, 3], 363599060)], [('regression: clock frame bound', ['01:59:05:24', 24, 3], None), ('regression variant: clock frame bound', ['00:00:00:25', 25, 1000], None), ('partial repair probe: clock frame bound', ['00:59:59:30', 24, 3], None), ('partial repair variant: clock frame bound', ['00:59:05:30', 24, 3], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['00:59:00:03', 24, 1000], 3540125)]]
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: clock frame bound | None | None | Passed |
| regression variant: clock frame bound | None | None | Passed |
| partial repair probe: clock frame bound | None | None | Passed |
| partial repair variant: clock frame bound | None | None | Passed |
| boundary control | 10 | 10 | Passed |
| boundary control | 1001 | 1001 | Passed |
| normal control | 188 | 188 | Passed |
| normal control | 39599375 | 39599375 | Passed |
| normal control | None | None | Passed |
SHA-256 / c5e8cee3d584c5d24d39708ed9c253573852113acd0af0603306400b5cf1b7b8
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:33.289709+00:00.
Case digest / e39bd84adf652647bf5e1b36f0c06654909f6476a6e94f4a96193e5de52f31a2