FAILURE MAP
← Case archive

FA-78711 / Broadcast timecode arithmetic / Open access

Frame-rate descriptor parsing: decimal zero trimming · case 01

A descriptor of 30.0 is read as 3 and rejected.

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

ROOT CAUSE

Zeros and periods are stripped as one character set, eating integer zeros.

VERIFIED REPAIR

Strip trailing zeros, then a trailing period.

Unsuccessful approach: Stripping zeros alone leaves "25." which is not a known rate.

Case contract

Parse a rate descriptor: a known rate (23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60; redundant trailing decimal zeros allowed) with an optional case-insensitive DF/NDF suffix, optionally separated by a space or hyphen; surrounding whitespace ignored. Drop frame is only valid for 29.97 and 59.94. Return [num,den,drop] or 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(s):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: decimal zero trimming', ['30.0'], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 25.00 ndf '], [25, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['59.94-df'], [60000, 1001, True]), ('normal control', [' 23.98df '], None)], [('regression: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 ndf '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0 ndf'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['25.00 ndf'], [25, 1, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00NDF'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: decimal zero trimming', [' 24.0NDF '], [24, 1, False]), ('partial repair variant: decimal zero trimming', [' 24.0 '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 23.98-NDF '], [24000, 1001, False]), ('normal control', ['23.976df'], None), ('normal control', ['25.00df'], None)], [('regression: decimal zero trimming', ['30.0NDF'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0NDF'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.970DF '], [30000, 1001, True])]]
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: decimal zero trimmingNone[30, 1, False]Failed
regression variant: decimal zero trimmingNone[30, 1, False]Failed
partial repair probe: decimal zero trimming[25, 1, False][25, 1, False]Passed
partial repair variant: decimal zero trimming[25, 1, False][25, 1, False]Passed
boundary control[30000, 1001, True][30000, 1001, True]Passed
boundary control[24000, 1001, False][24000, 1001, False]Passed
normal control[30000, 1001, False][30000, 1001, False]Passed
normal control[60000, 1001, True][60000, 1001, True]Passed
normal controlNoneNonePassed

SHA-256 / 90351ad0fdcb6405c22f560f33141fa8fcecd0bd3e9d241b9389a9740fed42f5

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(s):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: decimal zero trimming', ['30.0'], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 25.00 ndf '], [25, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['59.94-df'], [60000, 1001, True]), ('normal control', [' 23.98df '], None)], [('regression: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 ndf '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0 ndf'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['25.00 ndf'], [25, 1, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00NDF'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: decimal zero trimming', [' 24.0NDF '], [24, 1, False]), ('partial repair variant: decimal zero trimming', [' 24.0 '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 23.98-NDF '], [24000, 1001, False]), ('normal control', ['23.976df'], None), ('normal control', ['25.00df'], None)], [('regression: decimal zero trimming', ['30.0NDF'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0NDF'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.970DF '], [30000, 1001, True])]]
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: decimal zero trimmingNone[30, 1, False]Failed
regression variant: decimal zero trimmingNone[30, 1, False]Failed
partial repair probe: decimal zero trimmingNone[25, 1, False]Failed
partial repair variant: decimal zero trimmingNone[25, 1, False]Failed
boundary control[30000, 1001, True][30000, 1001, True]Passed
boundary control[24000, 1001, False][24000, 1001, False]Passed
normal control[30000, 1001, False][30000, 1001, False]Passed
normal control[60000, 1001, True][60000, 1001, True]Passed
normal controlNoneNonePassed

SHA-256 / 41852958197cb75350f424f70d8395f9259c77bcb323fde6809c84dbc8a11ae8

3 / The verified repair

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

N = 1
observations = []
def solve(s):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: decimal zero trimming', ['30.0'], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 25.00 ndf '], [25, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['59.94-df'], [60000, 1001, True]), ('normal control', [' 23.98df '], None)], [('regression: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 ndf '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0 ndf'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['25.00 ndf'], [25, 1, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00NDF'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: decimal zero trimming', [' 24.0NDF '], [24, 1, False]), ('partial repair variant: decimal zero trimming', [' 24.0 '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 23.98-NDF '], [24000, 1001, False]), ('normal control', ['23.976df'], None), ('normal control', ['25.00df'], None)], [('regression: decimal zero trimming', ['30.0NDF'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0NDF'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.970DF '], [30000, 1001, True])]]
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: decimal zero trimming[30, 1, False][30, 1, False]Passed
regression variant: decimal zero trimming[30, 1, False][30, 1, False]Passed
partial repair probe: decimal zero trimming[25, 1, False][25, 1, False]Passed
partial repair variant: decimal zero trimming[25, 1, False][25, 1, False]Passed
boundary control[30000, 1001, True][30000, 1001, True]Passed
boundary control[24000, 1001, False][24000, 1001, False]Passed
normal control[30000, 1001, False][30000, 1001, False]Passed
normal control[60000, 1001, True][60000, 1001, True]Passed
normal controlNoneNonePassed

SHA-256 / ce40587210d2f5ffdd91a082ec6bd2a0bbbb2156efa8d88c2684e8d389d49e3f

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:37.964770+00:00.

Case digest / 84510b9c4d2ac2ae7f8c86baeed7e0d11b98f55135794f2bbc045d16c86e5994