FAILURE MAP
← Case archive

FA-78356 / Broadcast timecode arithmetic / Open access

Non-drop timecode label parsing: field width · case 01

Loosely typed labels such as 1:00:00:00 are accepted into the edit list.

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

ROOT CAUSE

Field widths are not validated.

VERIFIED REPAIR

Require exactly two digits per field.

Unsuccessful approach: Allowing up to two digits still accepts single-digit fields.

Case contract

Parse a non-drop label HH:MM:SS:FF (exactly two digits per field, colons only) at integer fps to a frame count from midnight. Hours 0-23, minutes and seconds 0-59, frames below fps; anything else, including drop-frame separators, returns None.

Why this case matters

Timecode arithmetic errors misplace edits, commercial breaks and captions against the broadcast clock.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(tc, fps):
    f=tc.split(':')
    if len(f)!=4 or not all(x.isdigit() for x in f):
        return None
    h,m,s,fr=map(int,f)
    if h>23:
        return None
    if m>59 or s>59:
        return None
    if fr>=fps:
        return None
    return ((h*60+m)*60+s)*fps+fr
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field width', ['1:59:59:24', 30], None), ('regression variant: field width', ['1:00:00:00', 30], None), ('partial repair probe: field width', ['00:59:5:00', 25], None), ('partial repair variant: field width', ['00:59:5:24', 30], None), ('boundary control', ['00:00:00:00', 25], 0), ('boundary control', ['00:00:00:25', 25], None), ('normal control', ['23:59:59:24', 25], 2159999), ('normal control', ['01:00:00;00', 30], None), ('normal control', ['00:07:00.24', 25], None)], [('regression: field width', ['1:59:59:00', 24], None), ('regression variant: field width', ['1:00:00:24', 25], None), ('partial repair probe: field width', ['00:00:5:00', 25], None), ('partial repair variant: field width', ['1:07:00:24', 30], None), ('boundary control', ['23:59:59:24', 25], 2159999), ('boundary control', ['01:00:00;00', 30], None), ('normal control', ['01:00:00.00', 24], None), ('normal control', ['00:59:00.25', 25], None), ('normal control', ['00:60:5:30', 24], None)], [('regression: field width', ['00:59:5:00', 25], None), ('regression variant: field width', ['01:07:5:24', 25], None), ('partial repair probe: field width', ['1:59:5:23', 24], None), ('partial repair variant: field width', ['1:07:00:29', 30], None), ('boundary control', ['24:00:00:00', 25], None), ('boundary control', ['00:00:00:00', 25], 0), ('normal control', ['99:59:59:29', 30], None), ('normal control', ['00:59:59:24', 25], 89999), ('normal control', ['01:07:00:25', 24], None)], [('regression: field width', ['00:00:5:00', 25], None), ('regression variant: field width', ['1:59:00:00', 30], None), ('partial repair probe: field width', ['1:00:00:00', 30], None), ('partial repair variant: field width', ['1:00:5:24', 30], None), ('boundary control', ['00:00:00:25', 25], None), ('boundary control', ['23:59:59:24', 25], 2159999), ('normal control', ['01:00:60:29', 24], None), ('normal control', ['23:59:5:29', 25], None), ('normal control', ['1:59:00;25', 25], None)], [('regression: field width', ['1:59:5:23', 24], None), ('regression variant: field width', ['00:59:5:24', 30], None), ('partial repair probe: field width', ['1:00:00:24', 25], None), ('partial repair variant: field width', ['01:59:5:29', 30], None), ('boundary control', ['01:00:00;00', 30], None), ('boundary control', ['24:00:00:00', 25], None), ('normal control', ['99:60:59:25', 25], None), ('normal control', ['24:00:60:25', 30], None), ('normal control', ['24:60:5.00', 30], 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 fixtureActualExpectedOutcome
regression: field width215994NoneFailed
regression variant: field width108000NoneFailed
partial repair probe: field width88625NoneFailed
partial repair variant: field width106374NoneFailed
boundary control00Passed
boundary controlNoneNonePassed
normal control21599992159999Passed
normal controlNoneNonePassed
normal controlNoneNonePassed

SHA-256 / 46d73fefc8c511d4920c2c96ef5b421d7e86d4d754c8800c515f842e173d8162

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(tc, fps):
    f=tc.split(':')
    if len(f)!=4 or not all(len(x)<=2 and x.isdigit() for x in f):
        return None
    h,m,s,fr=map(int,f)
    if h>23:
        return None
    if m>59 or s>59:
        return None
    if fr>=fps:
        return None
    return ((h*60+m)*60+s)*fps+fr
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field width', ['1:59:59:24', 30], None), ('regression variant: field width', ['1:00:00:00', 30], None), ('partial repair probe: field width', ['00:59:5:00', 25], None), ('partial repair variant: field width', ['00:59:5:24', 30], None), ('boundary control', ['00:00:00:00', 25], 0), ('boundary control', ['00:00:00:25', 25], None), ('normal control', ['23:59:59:24', 25], 2159999), ('normal control', ['01:00:00;00', 30], None), ('normal control', ['00:07:00.24', 25], None)], [('regression: field width', ['1:59:59:00', 24], None), ('regression variant: field width', ['1:00:00:24', 25], None), ('partial repair probe: field width', ['00:00:5:00', 25], None), ('partial repair variant: field width', ['1:07:00:24', 30], None), ('boundary control', ['23:59:59:24', 25], 2159999), ('boundary control', ['01:00:00;00', 30], None), ('normal control', ['01:00:00.00', 24], None), ('normal control', ['00:59:00.25', 25], None), ('normal control', ['00:60:5:30', 24], None)], [('regression: field width', ['00:59:5:00', 25], None), ('regression variant: field width', ['01:07:5:24', 25], None), ('partial repair probe: field width', ['1:59:5:23', 24], None), ('partial repair variant: field width', ['1:07:00:29', 30], None), ('boundary control', ['24:00:00:00', 25], None), ('boundary control', ['00:00:00:00', 25], 0), ('normal control', ['99:59:59:29', 30], None), ('normal control', ['00:59:59:24', 25], 89999), ('normal control', ['01:07:00:25', 24], None)], [('regression: field width', ['00:00:5:00', 25], None), ('regression variant: field width', ['1:59:00:00', 30], None), ('partial repair probe: field width', ['1:00:00:00', 30], None), ('partial repair variant: field width', ['1:00:5:24', 30], None), ('boundary control', ['00:00:00:25', 25], None), ('boundary control', ['23:59:59:24', 25], 2159999), ('normal control', ['01:00:60:29', 24], None), ('normal control', ['23:59:5:29', 25], None), ('normal control', ['1:59:00;25', 25], None)], [('regression: field width', ['1:59:5:23', 24], None), ('regression variant: field width', ['00:59:5:24', 30], None), ('partial repair probe: field width', ['1:00:00:24', 25], None), ('partial repair variant: field width', ['01:59:5:29', 30], None), ('boundary control', ['01:00:00;00', 30], None), ('boundary control', ['24:00:00:00', 25], None), ('normal control', ['99:60:59:25', 25], None), ('normal control', ['24:00:60:25', 30], None), ('normal control', ['24:60:5.00', 30], 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 fixtureActualExpectedOutcome
regression: field width215994NoneFailed
regression variant: field width108000NoneFailed
partial repair probe: field width88625NoneFailed
partial repair variant: field width106374NoneFailed
boundary control00Passed
boundary controlNoneNonePassed
normal control21599992159999Passed
normal controlNoneNonePassed
normal controlNoneNonePassed

SHA-256 / ccb7ed44a628a07f18b089c22237f4ed1b36c8964a9c49f10be795283b5a7799

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(tc, fps):
    f=tc.split(':')
    if len(f)!=4 or not all(len(x)==2 and x.isdigit() for x in f):
        return None
    h,m,s,fr=map(int,f)
    if h>23:
        return None
    if m>59 or s>59:
        return None
    if fr>=fps:
        return None
    return ((h*60+m)*60+s)*fps+fr
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field width', ['1:59:59:24', 30], None), ('regression variant: field width', ['1:00:00:00', 30], None), ('partial repair probe: field width', ['00:59:5:00', 25], None), ('partial repair variant: field width', ['00:59:5:24', 30], None), ('boundary control', ['00:00:00:00', 25], 0), ('boundary control', ['00:00:00:25', 25], None), ('normal control', ['23:59:59:24', 25], 2159999), ('normal control', ['01:00:00;00', 30], None), ('normal control', ['00:07:00.24', 25], None)], [('regression: field width', ['1:59:59:00', 24], None), ('regression variant: field width', ['1:00:00:24', 25], None), ('partial repair probe: field width', ['00:00:5:00', 25], None), ('partial repair variant: field width', ['1:07:00:24', 30], None), ('boundary control', ['23:59:59:24', 25], 2159999), ('boundary control', ['01:00:00;00', 30], None), ('normal control', ['01:00:00.00', 24], None), ('normal control', ['00:59:00.25', 25], None), ('normal control', ['00:60:5:30', 24], None)], [('regression: field width', ['00:59:5:00', 25], None), ('regression variant: field width', ['01:07:5:24', 25], None), ('partial repair probe: field width', ['1:59:5:23', 24], None), ('partial repair variant: field width', ['1:07:00:29', 30], None), ('boundary control', ['24:00:00:00', 25], None), ('boundary control', ['00:00:00:00', 25], 0), ('normal control', ['99:59:59:29', 30], None), ('normal control', ['00:59:59:24', 25], 89999), ('normal control', ['01:07:00:25', 24], None)], [('regression: field width', ['00:00:5:00', 25], None), ('regression variant: field width', ['1:59:00:00', 30], None), ('partial repair probe: field width', ['1:00:00:00', 30], None), ('partial repair variant: field width', ['1:00:5:24', 30], None), ('boundary control', ['00:00:00:25', 25], None), ('boundary control', ['23:59:59:24', 25], 2159999), ('normal control', ['01:00:60:29', 24], None), ('normal control', ['23:59:5:29', 25], None), ('normal control', ['1:59:00;25', 25], None)], [('regression: field width', ['1:59:5:23', 24], None), ('regression variant: field width', ['00:59:5:24', 30], None), ('partial repair probe: field width', ['1:00:00:24', 25], None), ('partial repair variant: field width', ['01:59:5:29', 30], None), ('boundary control', ['01:00:00;00', 30], None), ('boundary control', ['24:00:00:00', 25], None), ('normal control', ['99:60:59:25', 25], None), ('normal control', ['24:00:60:25', 30], None), ('normal control', ['24:60:5.00', 30], 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 fixtureActualExpectedOutcome
regression: field widthNoneNonePassed
regression variant: field widthNoneNonePassed
partial repair probe: field widthNoneNonePassed
partial repair variant: field widthNoneNonePassed
boundary control00Passed
boundary controlNoneNonePassed
normal control21599992159999Passed
normal controlNoneNonePassed
normal controlNoneNonePassed

SHA-256 / 99e01d59427f54e54717718733a5816a1a01b23bb4940ce6fc0e28d52d2c31b0

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; it does not claim conformance to SMPTE or any broadcast 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:34.639123+00:00.

Case digest / 1ab3cbd7a27a8e5adf4679afedbc6edabcf426fcfb7df1e83283146ba8aefe3a