FAILURE MAP
← Case archive

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.

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

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 fixtureActualExpectedOutcome
regression: tick metric scale010Failed
regression variant: tick metric scale65667Failed
partial repair probe: tick metric scale55000Failed
partial repair variant: tick metric scale00Passed
boundary control188188Passed
boundary controlNoneNonePassed
normal control19381938Passed
normal control3959937539599375Passed
normal controlNoneNonePassed

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 fixtureActualExpectedOutcome
regression: tick metric scale40010Failed
regression variant: tick metric scale5675667Failed
partial repair probe: tick metric scale5005000Failed
partial repair variant: tick metric scale10630Failed
boundary control188188Passed
boundary controlNoneNonePassed
normal control19381938Passed
normal control3959937539599375Passed
normal controlNoneNonePassed

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 fixtureActualExpectedOutcome
regression: tick metric scale1010Passed
regression variant: tick metric scale56675667Passed
partial repair probe: tick metric scale50005000Passed
partial repair variant: tick metric scale00Passed
boundary control188188Passed
boundary controlNoneNonePassed
normal control19381938Passed
normal control3959937539599375Passed
normal controlNoneNonePassed

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