FA-78691 / Broadcast timecode arithmetic / Open access
Frame-rate descriptor parsing: case folding · case 01
Lower-case suffixes such as "df" are rejected.
ROOT CAUSE
The descriptor is not upper-cased before suffix matching.
VERIFIED REPAIR
Strip and upper-case the descriptor.
Unsuccessful approach: Upper-casing without stripping leaves surrounding whitespace that defeats suffix matching.
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()
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: case folding', ['59.94-df'], [60000, 1001, True]), ('regression variant: case folding', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: case folding', [' 29.97 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 29.970DF '], [30000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: case folding', [' 30 ndf '], [30, 1, False]), ('regression variant: case folding', [' 29.97df '], [30000, 1001, True]), ('partial repair probe: case folding', [' 60 '], [60, 1, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: case folding', ['50 ndf'], [50, 1, False]), ('regression variant: case folding', ['29.970df'], [30000, 1001, True]), ('partial repair probe: case folding', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 25DF '], None), ('normal control', ['25.00df'], None), ('normal control', [' 23.976 DF '], None)], [('regression: case folding', ['59.94 ndf'], [60000, 1001, False]), ('regression variant: case folding', ['24.0 ndf'], [24, 1, False]), ('partial repair probe: case folding', [' 29.97DF '], [30000, 1001, True]), ('partial repair variant: case folding', [' 29.970 DF '], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['23.976DF'], None), ('normal control', ['24df'], None), ('normal control', ['24.0DF'], None)], [('regression: case folding', ['30 ndf'], [30, 1, False]), ('regression variant: case folding', [' 29.97 ndf '], [30000, 1001, False]), ('partial repair probe: case folding', [' 29.970 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 60-NDF '], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', ['60NDF'], [60, 1, False]), ('normal control', ['29.97'], [30000, 1001, False]), ('normal control', ['29.97-NDF'], [30000, 1001, False])]]
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: case folding | None | [60000, 1001, True] | Failed |
| regression variant: case folding | None | [30, 1, False] | Failed |
| partial repair probe: case folding | [30000, 1001, False] | [30000, 1001, False] | Passed |
| partial repair variant: case folding | [30000, 1001, True] | [30000, 1001, True] | 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 | [30, 1, False] | [30, 1, False] | Passed |
| normal control | None | None | Passed |
SHA-256 / 4e76a2217d1f0e846aa3de7b8146f292ea2d2742eff55419901f8a910eb53359
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
t=s.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: case folding', ['59.94-df'], [60000, 1001, True]), ('regression variant: case folding', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: case folding', [' 29.97 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 29.970DF '], [30000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: case folding', [' 30 ndf '], [30, 1, False]), ('regression variant: case folding', [' 29.97df '], [30000, 1001, True]), ('partial repair probe: case folding', [' 60 '], [60, 1, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: case folding', ['50 ndf'], [50, 1, False]), ('regression variant: case folding', ['29.970df'], [30000, 1001, True]), ('partial repair probe: case folding', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 25DF '], None), ('normal control', ['25.00df'], None), ('normal control', [' 23.976 DF '], None)], [('regression: case folding', ['59.94 ndf'], [60000, 1001, False]), ('regression variant: case folding', ['24.0 ndf'], [24, 1, False]), ('partial repair probe: case folding', [' 29.97DF '], [30000, 1001, True]), ('partial repair variant: case folding', [' 29.970 DF '], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['23.976DF'], None), ('normal control', ['24df'], None), ('normal control', ['24.0DF'], None)], [('regression: case folding', ['30 ndf'], [30, 1, False]), ('regression variant: case folding', [' 29.97 ndf '], [30000, 1001, False]), ('partial repair probe: case folding', [' 29.970 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 60-NDF '], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', ['60NDF'], [60, 1, False]), ('normal control', ['29.97'], [30000, 1001, False]), ('normal control', ['29.97-NDF'], [30000, 1001, False])]]
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: case folding | [60000, 1001, True] | [60000, 1001, True] | Passed |
| regression variant: case folding | [30, 1, False] | [30, 1, False] | Passed |
| partial repair probe: case folding | None | [30000, 1001, False] | Failed |
| partial repair variant: case folding | None | [30000, 1001, True] | 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 | [30, 1, False] | [30, 1, False] | Passed |
| normal control | None | None | Passed |
SHA-256 / 168378ab03cea18bad17a88300ad606148facf96a2340286e0108aff10ca3db4
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: case folding', ['59.94-df'], [60000, 1001, True]), ('regression variant: case folding', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: case folding', [' 29.97 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 29.970DF '], [30000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: case folding', [' 30 ndf '], [30, 1, False]), ('regression variant: case folding', [' 29.97df '], [30000, 1001, True]), ('partial repair probe: case folding', [' 60 '], [60, 1, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: case folding', ['50 ndf'], [50, 1, False]), ('regression variant: case folding', ['29.970df'], [30000, 1001, True]), ('partial repair probe: case folding', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 25DF '], None), ('normal control', ['25.00df'], None), ('normal control', [' 23.976 DF '], None)], [('regression: case folding', ['59.94 ndf'], [60000, 1001, False]), ('regression variant: case folding', ['24.0 ndf'], [24, 1, False]), ('partial repair probe: case folding', [' 29.97DF '], [30000, 1001, True]), ('partial repair variant: case folding', [' 29.970 DF '], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['23.976DF'], None), ('normal control', ['24df'], None), ('normal control', ['24.0DF'], None)], [('regression: case folding', ['30 ndf'], [30, 1, False]), ('regression variant: case folding', [' 29.97 ndf '], [30000, 1001, False]), ('partial repair probe: case folding', [' 29.970 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 60-NDF '], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', ['60NDF'], [60, 1, False]), ('normal control', ['29.97'], [30000, 1001, False]), ('normal control', ['29.97-NDF'], [30000, 1001, False])]]
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: case folding | [60000, 1001, True] | [60000, 1001, True] | Passed |
| regression variant: case folding | [30, 1, False] | [30, 1, False] | Passed |
| partial repair probe: case folding | [30000, 1001, False] | [30000, 1001, False] | Passed |
| partial repair variant: case folding | [30000, 1001, True] | [30000, 1001, True] | 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 | [30, 1, False] | [30, 1, False] | Passed |
| normal control | None | None | Passed |
SHA-256 / 59736fd33cff50fcd16c0f6a068fc0ea1729216ba5a20ff74555d77df0571ffb
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.726053+00:00.
Case digest / b973248d1d2b29d0220513622823394ae18d12e992d93d329844e45c2dfc35f6