FA-78191 / Subtitle cue timing / Open access
Timed-text time expression evaluation: tick metric scale · case 01
Tick-based caption times collapse to near zero.
ROOT CAUSE
Tick counts are divided by the tick rate without converting seconds to milliseconds.
VERIFIED REPAIR
Convert ticks with v*1000/tick_rate.
Unsuccessful approach: Using the frame rate for ticks confuses the two independent clocks.
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/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: tick metric scale', ['10t', 25, 1000], 10), ('regression variant: tick metric scale', ['17t', 30, 3], 5667), ('partial repair probe: tick metric scale', ['15t', 30, 3], 5000), ('partial repair variant: tick metric scale', ['17t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: tick metric scale', ['2t', 30, 3], 667), ('regression variant: tick metric scale', ['90t', 24, 1000], 90), ('partial repair probe: tick metric scale', ['7t', 25, 10000000], 0), ('partial repair variant: tick metric scale', ['1.5t', 50, 1000], 2), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: tick metric scale', ['15t', 30, 3], 5000), ('regression variant: tick metric scale', ['1.5t', 50, 1000], 2), ('partial repair probe: tick metric scale', ['1.5t', 16, 3], 500), ('partial repair variant: tick metric scale', ['1t', 40, 1000], 1), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: tick metric scale', ['1.5t', 16, 3], 500), ('regression variant: tick metric scale', ['1t', 40, 1000], 1), ('partial repair probe: tick metric scale', ['90t', 40, 1000], 90), ('partial repair variant: tick metric scale', ['1.5t', 24, 90000], 0), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['0t', 24, 3], 0), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['10:30:59.5', 24, 1000], 37859500)], [('regression: tick metric scale', ['90t', 40, 1000], 90), ('regression variant: tick metric scale', ['2t', 24, 3], 667), ('partial repair probe: tick metric scale', ['17t', 30, 3], 5667), ('partial repair variant: tick metric scale', ['12.25t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['100:59:05:12', 24, 3], 363545500), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['12.25f', 25, 3], 490)]]
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: tick metric scale | 0 | 10 | Failed |
| regression variant: tick metric scale | 6 | 5667 | Failed |
| partial repair probe: tick metric scale | 5 | 5000 | Failed |
| partial repair variant: tick metric scale | 0 | 0 | Passed |
| boundary control | 188 | 188 | Passed |
| boundary control | None | None | Passed |
| normal control | 1938 | 1938 | Passed |
| normal control | 39599375 | 39599375 | Passed |
| normal control | None | None | Passed |
SHA-256 / c4eca0647d6bf72820385fe88c495be2e3e7e9bcf2918613a64272a74bd0dc31
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/frame_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: tick metric scale', ['10t', 25, 1000], 10), ('regression variant: tick metric scale', ['17t', 30, 3], 5667), ('partial repair probe: tick metric scale', ['15t', 30, 3], 5000), ('partial repair variant: tick metric scale', ['17t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: tick metric scale', ['2t', 30, 3], 667), ('regression variant: tick metric scale', ['90t', 24, 1000], 90), ('partial repair probe: tick metric scale', ['7t', 25, 10000000], 0), ('partial repair variant: tick metric scale', ['1.5t', 50, 1000], 2), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: tick metric scale', ['15t', 30, 3], 5000), ('regression variant: tick metric scale', ['1.5t', 50, 1000], 2), ('partial repair probe: tick metric scale', ['1.5t', 16, 3], 500), ('partial repair variant: tick metric scale', ['1t', 40, 1000], 1), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: tick metric scale', ['1.5t', 16, 3], 500), ('regression variant: tick metric scale', ['1t', 40, 1000], 1), ('partial repair probe: tick metric scale', ['90t', 40, 1000], 90), ('partial repair variant: tick metric scale', ['1.5t', 24, 90000], 0), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['0t', 24, 3], 0), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['10:30:59.5', 24, 1000], 37859500)], [('regression: tick metric scale', ['90t', 40, 1000], 90), ('regression variant: tick metric scale', ['2t', 24, 3], 667), ('partial repair probe: tick metric scale', ['17t', 30, 3], 5667), ('partial repair variant: tick metric scale', ['12.25t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['100:59:05:12', 24, 3], 363545500), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['12.25f', 25, 3], 490)]]
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: tick metric scale | 400 | 10 | Failed |
| regression variant: tick metric scale | 567 | 5667 | Failed |
| partial repair probe: tick metric scale | 500 | 5000 | Failed |
| partial repair variant: tick metric scale | 1063 | 0 | Failed |
| boundary control | 188 | 188 | Passed |
| boundary control | None | None | Passed |
| normal control | 1938 | 1938 | Passed |
| normal control | 39599375 | 39599375 | Passed |
| normal control | None | None | Passed |
SHA-256 / f5f8b717d3555e239116a7e16192d20c4cd7b43bed19643c7150a91d93538dd7
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: tick metric scale', ['10t', 25, 1000], 10), ('regression variant: tick metric scale', ['17t', 30, 3], 5667), ('partial repair probe: tick metric scale', ['15t', 30, 3], 5000), ('partial repair variant: tick metric scale', ['17t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: tick metric scale', ['2t', 30, 3], 667), ('regression variant: tick metric scale', ['90t', 24, 1000], 90), ('partial repair probe: tick metric scale', ['7t', 25, 10000000], 0), ('partial repair variant: tick metric scale', ['1.5t', 50, 1000], 2), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: tick metric scale', ['15t', 30, 3], 5000), ('regression variant: tick metric scale', ['1.5t', 50, 1000], 2), ('partial repair probe: tick metric scale', ['1.5t', 16, 3], 500), ('partial repair variant: tick metric scale', ['1t', 40, 1000], 1), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: tick metric scale', ['1.5t', 16, 3], 500), ('regression variant: tick metric scale', ['1t', 40, 1000], 1), ('partial repair probe: tick metric scale', ['90t', 40, 1000], 90), ('partial repair variant: tick metric scale', ['1.5t', 24, 90000], 0), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['0t', 24, 3], 0), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['10:30:59.5', 24, 1000], 37859500)], [('regression: tick metric scale', ['90t', 40, 1000], 90), ('regression variant: tick metric scale', ['2t', 24, 3], 667), ('partial repair probe: tick metric scale', ['17t', 30, 3], 5667), ('partial repair variant: tick metric scale', ['12.25t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['100:59:05:12', 24, 3], 363545500), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['12.25f', 25, 3], 490)]]
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: tick metric scale | 10 | 10 | Passed |
| regression variant: tick metric scale | 5667 | 5667 | Passed |
| partial repair probe: tick metric scale | 5000 | 5000 | Passed |
| partial repair variant: tick metric scale | 0 | 0 | Passed |
| boundary control | 188 | 188 | Passed |
| boundary control | None | None | Passed |
| normal control | 1938 | 1938 | Passed |
| normal control | 39599375 | 39599375 | Passed |
| normal control | None | None | Passed |
SHA-256 / 58efdd2a6d03b9dbefbdc3114ceb291f92d3ccec728d110ae1d7fcd6e987d5c2
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:32.770059+00:00.
Case digest / 481016d0625068222c65dcda786ed9a2461c99e8f6db199ce8f1a105c7c502cd