FA-78146 / Subtitle cue timing / Open access
Shot-change snapping of cue boundaries: nearest shot choice · case 01
Boundaries snap to the first cut in range even when a closer cut exists.
ROOT CAUSE
The first shot within the window is accepted without comparing distances.
THE FAILURE
The first shot within the window is accepted without comparing distances.
Unsuccessful approach: Replacing candidates whenever they are inside the window picks the last cut in range instead of the nearest.
Case contract
For each cue, the start snaps to the nearest shot change within window ms (|shot - start| <= window; ties go to the earlier shot). The end snaps so that it sits gap ms before the nearest shot change within window of end+gap. If snapping leaves end <= start, the original cue is kept unchanged.
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
N = 1
observations = []
def solve(cues, shots, window, gap):
def near(t):
best=None
for sc in shots:
d=abs(sc-t)
if d<=window and (best is None):
best=sc
return best
out=[]
for s0,e0 in cues:
s,e=s0,e0
a=near(s)
if a is not None:
s=a
b=near(e+gap)
if b is not None:
e=b-gap
if e<=s:
s,e=s0,e0
out.append([s,e])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: nearest shot choice', [[[951, 1851], [1150, 2250], [1350, 2250]], [1100, 1200], 250, 42], [[1100, 1851], [1100, 2250], [1200, 2250]]), ('regression variant: nearest shot choice', [[[999, 1499], [800, 1840], [1150, 2150]], [1000, 1200], 200, 80], [[1000, 1499], [1000, 1840], [1200, 2150]]), ('partial repair probe: nearest shot choice', [[[1751, 2651], [851, 1851]], [1100, 2000, 2150, 3040], 250, 80], [[2000, 2651], [1100, 1920]]), ('partial repair variant: nearest shot choice', [[[2150, 3190], [1050, 2150], [1801, 2301]], [1100, 1200, 2000, 2150, 4000], 200, 80], [[2150, 3190], [1100, 2070], [2000, 2301]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[50, 80], [4050, 5050]], [0, 1100, 2150, 3000, 4000], 250, 0], [[50, 80], [4000, 5050]]), ('normal control', [[[850, 1890], [3000, 4000]], [1100, 3000], 250, 80], [[1100, 1890], [3000, 4000]]), ('normal control', [[[2200, 2700]], [2150], 200, 80], [[2150, 2700]])], [('regression: nearest shot choice', [[[1351, 2451], [1000, 1030], [1050, 1550]], [0, 1000, 1100], 250, 80], [[1351, 2451], [1000, 1020], [1000, 1550]]), ('regression variant: nearest shot choice', [[[2150, 3190], [1050, 2150], [1801, 2301]], [1100, 1200, 2000, 2150, 4000], 200, 80], [[2150, 3190], [1100, 2070], [2000, 2301]]), ('partial repair probe: nearest shot choice', [[[3000, 3900], [900, 930], [3000, 3030]], [0, 1100, 1200, 3000], 200, 80], [[3000, 3900], [900, 930], [3000, 3030]]), ('partial repair variant: nearest shot choice', [[[2000, 2500], [1949, 2849]], [0, 2000, 2150], 200, 42], [[2000, 2500], [2000, 2849]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[750, 1650]], [1000, 1200, 2150, 3000], 250, 0], [[1000, 1650]]), ('normal control', [[[50, 1150]], [0, 1200, 2000, 2150], 250, 80], [[0, 1120]]), ('normal control', [[[1100, 2100], [2990, 3000], [900, 1800]], [1100, 3040], 200, 0], [[1100, 2100], [2990, 3000], [1100, 1800]])], [('regression: nearest shot choice', [[[2939, 3979], [1899, 2939], [3050, 4050]], [0, 2000, 3000, 3040], 100, 0], [[3000, 3979], [1899, 3000], [3040, 4050]]), ('regression variant: nearest shot choice', [[[1150, 2050], [251, 1291], [1901, 3001]], [0, 1100, 1200, 2150], 250, 0], [[1100, 2150], [251, 1200], [2150, 3001]]), ('partial repair probe: nearest shot choice', [[[750, 1850], [951, 1851], [950, 1850]], [1000, 1200], 250, 80], [[1000, 1850], [1000, 1851], [1000, 1850]]), ('partial repair variant: nearest shot choice', [[[1950, 1980], [1050, 1080], [2200, 2210]], [1000, 1100, 2150, 3040], 200, 42], [[1950, 1980], [1000, 1058], [2200, 2210]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[1050, 2150]], [1000, 4000], 200, 80], [[1000, 2150]]), ('normal control', [[[1000, 2000], [3901, 4401]], [1100, 2000, 2150, 4000], 100, 42], [[1100, 1958], [4000, 4401]]), ('normal control', [[[899, 1999]], [1000], 100, 80], [[899, 1999]])], [('regression: nearest shot choice', [[[950, 1450], [1250, 2150], [1750, 2250]], [1000, 1200, 2000], 250, 0], [[1000, 1200], [1200, 2000], [1750, 2250]]), ('regression variant: nearest shot choice', [[[2250, 3290], [3950, 4990], [1899, 2939]], [1200, 2000, 2150, 4000], 250, 0], [[2150, 3290], [4000, 4990], [2000, 2939]]), ('partial repair probe: nearest shot choice', [[[951, 1851], [1150, 2250], [1350, 2250]], [1100, 1200], 250, 42], [[1100, 1851], [1100, 2250], [1200, 2250]]), ('partial repair variant: nearest shot choice', [[[1950, 1980], [1050, 1080], [2200, 2210]], [1000, 1100, 2150, 3040], 200, 42], [[1950, 1980], [1000, 1058], [2200, 2210]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[1401, 2401]], [1000, 1200], 200, 42], [[1401, 2401]]), ('normal control', [[[50, 950]], [0, 1200], 250, 42], [[0, 1158]]), ('normal control', [[[1050, 2150], [0, 1]], [0, 1000, 3000], 200, 0], [[1000, 2150], [0, 1]])], [('regression: nearest shot choice', [[[3250, 4250]], [1100, 2000, 3000, 3040, 4000], 250, 42], [[3040, 4250]]), ('regression variant: nearest shot choice', [[[1950, 1980], [1050, 1080], [2200, 2210]], [1000, 1100, 2150, 3040], 200, 42], [[1950, 1980], [1000, 1058], [2200, 2210]]), ('partial repair probe: nearest shot choice', [[[1351, 2451], [1000, 1030], [1050, 1550]], [0, 1000, 1100], 250, 80], [[1351, 2451], [1000, 1020], [1000, 1550]]), ('partial repair variant: nearest shot choice', [[[2250, 2260], [1901, 2941], [2401, 3401]], [2000, 2150], 250, 42], [[2250, 2260], [2000, 2941], [2401, 3401]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[4201, 5101], [1150, 1650], [2200, 3240]], [1100, 2000, 4000], 200, 0], [[4201, 5101], [1100, 1650], [2000, 3240]]), ('normal control', [[[2990, 3020], [3040, 4140], [3040, 4040]], [0, 2000, 3040], 100, 42], [[2990, 3020], [3040, 4140], [3040, 4040]]), ('normal control', [[[2050, 3050]], [0, 2000, 2150], 100, 42], [[2000, 3050]])]]
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: nearest shot choice | [[1100, 1851], [1100, 2250], [1100, 2250]] | [[1100, 1851], [1100, 2250], [1200, 2250]] | Failed |
| regression variant: nearest shot choice | [[1000, 1499], [1000, 1840], [1000, 2150]] | [[1000, 1499], [1000, 1840], [1200, 2150]] | Failed |
| partial repair probe: nearest shot choice | [[2000, 2651], [1100, 1920]] | [[2000, 2651], [1100, 1920]] | Passed |
| partial repair variant: nearest shot choice | [[2000, 3190], [1100, 2070], [2000, 2301]] | [[2150, 3190], [1100, 2070], [2000, 2301]] | Failed |
| boundary control | [[1000, 1500]] | [[1000, 1500]] | Passed |
| boundary control | [[1200, 1800]] | [[1200, 1800]] | Passed |
| normal control | [[50, 80], [4000, 5050]] | [[50, 80], [4000, 5050]] | Passed |
| normal control | [[1100, 1890], [3000, 4000]] | [[1100, 1890], [3000, 4000]] | Passed |
| normal control | [[2150, 2700]] | [[2150, 2700]] | Passed |
SHA-256 / 638b3583986ec5387ca2d153dd6b4378b86203e6f4fae397997c98d65b444b53
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cues, shots, window, gap):
def near(t):
best=None
for sc in shots:
d=abs(sc-t)
if d<=window and (best is None or d<window):
best=sc
return best
out=[]
for s0,e0 in cues:
s,e=s0,e0
a=near(s)
if a is not None:
s=a
b=near(e+gap)
if b is not None:
e=b-gap
if e<=s:
s,e=s0,e0
out.append([s,e])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: nearest shot choice', [[[951, 1851], [1150, 2250], [1350, 2250]], [1100, 1200], 250, 42], [[1100, 1851], [1100, 2250], [1200, 2250]]), ('regression variant: nearest shot choice', [[[999, 1499], [800, 1840], [1150, 2150]], [1000, 1200], 200, 80], [[1000, 1499], [1000, 1840], [1200, 2150]]), ('partial repair probe: nearest shot choice', [[[1751, 2651], [851, 1851]], [1100, 2000, 2150, 3040], 250, 80], [[2000, 2651], [1100, 1920]]), ('partial repair variant: nearest shot choice', [[[2150, 3190], [1050, 2150], [1801, 2301]], [1100, 1200, 2000, 2150, 4000], 200, 80], [[2150, 3190], [1100, 2070], [2000, 2301]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[50, 80], [4050, 5050]], [0, 1100, 2150, 3000, 4000], 250, 0], [[50, 80], [4000, 5050]]), ('normal control', [[[850, 1890], [3000, 4000]], [1100, 3000], 250, 80], [[1100, 1890], [3000, 4000]]), ('normal control', [[[2200, 2700]], [2150], 200, 80], [[2150, 2700]])], [('regression: nearest shot choice', [[[1351, 2451], [1000, 1030], [1050, 1550]], [0, 1000, 1100], 250, 80], [[1351, 2451], [1000, 1020], [1000, 1550]]), ('regression variant: nearest shot choice', [[[2150, 3190], [1050, 2150], [1801, 2301]], [1100, 1200, 2000, 2150, 4000], 200, 80], [[2150, 3190], [1100, 2070], [2000, 2301]]), ('partial repair probe: nearest shot choice', [[[3000, 3900], [900, 930], [3000, 3030]], [0, 1100, 1200, 3000], 200, 80], [[3000, 3900], [900, 930], [3000, 3030]]), ('partial repair variant: nearest shot choice', [[[2000, 2500], [1949, 2849]], [0, 2000, 2150], 200, 42], [[2000, 2500], [2000, 2849]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[750, 1650]], [1000, 1200, 2150, 3000], 250, 0], [[1000, 1650]]), ('normal control', [[[50, 1150]], [0, 1200, 2000, 2150], 250, 80], [[0, 1120]]), ('normal control', [[[1100, 2100], [2990, 3000], [900, 1800]], [1100, 3040], 200, 0], [[1100, 2100], [2990, 3000], [1100, 1800]])], [('regression: nearest shot choice', [[[2939, 3979], [1899, 2939], [3050, 4050]], [0, 2000, 3000, 3040], 100, 0], [[3000, 3979], [1899, 3000], [3040, 4050]]), ('regression variant: nearest shot choice', [[[1150, 2050], [251, 1291], [1901, 3001]], [0, 1100, 1200, 2150], 250, 0], [[1100, 2150], [251, 1200], [2150, 3001]]), ('partial repair probe: nearest shot choice', [[[750, 1850], [951, 1851], [950, 1850]], [1000, 1200], 250, 80], [[1000, 1850], [1000, 1851], [1000, 1850]]), ('partial repair variant: nearest shot choice', [[[1950, 1980], [1050, 1080], [2200, 2210]], [1000, 1100, 2150, 3040], 200, 42], [[1950, 1980], [1000, 1058], [2200, 2210]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[1050, 2150]], [1000, 4000], 200, 80], [[1000, 2150]]), ('normal control', [[[1000, 2000], [3901, 4401]], [1100, 2000, 2150, 4000], 100, 42], [[1100, 1958], [4000, 4401]]), ('normal control', [[[899, 1999]], [1000], 100, 80], [[899, 1999]])], [('regression: nearest shot choice', [[[950, 1450], [1250, 2150], [1750, 2250]], [1000, 1200, 2000], 250, 0], [[1000, 1200], [1200, 2000], [1750, 2250]]), ('regression variant: nearest shot choice', [[[2250, 3290], [3950, 4990], [1899, 2939]], [1200, 2000, 2150, 4000], 250, 0], [[2150, 3290], [4000, 4990], [2000, 2939]]), ('partial repair probe: nearest shot choice', [[[951, 1851], [1150, 2250], [1350, 2250]], [1100, 1200], 250, 42], [[1100, 1851], [1100, 2250], [1200, 2250]]), ('partial repair variant: nearest shot choice', [[[1950, 1980], [1050, 1080], [2200, 2210]], [1000, 1100, 2150, 3040], 200, 42], [[1950, 1980], [1000, 1058], [2200, 2210]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[1401, 2401]], [1000, 1200], 200, 42], [[1401, 2401]]), ('normal control', [[[50, 950]], [0, 1200], 250, 42], [[0, 1158]]), ('normal control', [[[1050, 2150], [0, 1]], [0, 1000, 3000], 200, 0], [[1000, 2150], [0, 1]])], [('regression: nearest shot choice', [[[3250, 4250]], [1100, 2000, 3000, 3040, 4000], 250, 42], [[3040, 4250]]), ('regression variant: nearest shot choice', [[[1950, 1980], [1050, 1080], [2200, 2210]], [1000, 1100, 2150, 3040], 200, 42], [[1950, 1980], [1000, 1058], [2200, 2210]]), ('partial repair probe: nearest shot choice', [[[1351, 2451], [1000, 1030], [1050, 1550]], [0, 1000, 1100], 250, 80], [[1351, 2451], [1000, 1020], [1000, 1550]]), ('partial repair variant: nearest shot choice', [[[2250, 2260], [1901, 2941], [2401, 3401]], [2000, 2150], 250, 42], [[2250, 2260], [2000, 2941], [2401, 3401]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[4201, 5101], [1150, 1650], [2200, 3240]], [1100, 2000, 4000], 200, 0], [[4201, 5101], [1100, 1650], [2000, 3240]]), ('normal control', [[[2990, 3020], [3040, 4140], [3040, 4040]], [0, 2000, 3040], 100, 42], [[2990, 3020], [3040, 4140], [3040, 4040]]), ('normal control', [[[2050, 3050]], [0, 2000, 2150], 100, 42], [[2000, 3050]])]]
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: nearest shot choice | [[1200, 1851], [1200, 2250], [1200, 2250]] | [[1100, 1851], [1100, 2250], [1200, 2250]] | Failed |
| regression variant: nearest shot choice | [[1000, 1499], [1000, 1840], [1200, 2150]] | [[1000, 1499], [1000, 1840], [1200, 2150]] | Passed |
| partial repair probe: nearest shot choice | [[2000, 2651], [1100, 2070]] | [[2000, 2651], [1100, 1920]] | Failed |
| partial repair variant: nearest shot choice | [[2150, 3190], [1200, 2070], [2000, 2301]] | [[2150, 3190], [1100, 2070], [2000, 2301]] | Failed |
| boundary control | [[1000, 1500]] | [[1000, 1500]] | Passed |
| boundary control | [[1200, 1800]] | [[1200, 1800]] | Passed |
| normal control | [[50, 80], [4000, 5050]] | [[50, 80], [4000, 5050]] | Passed |
| normal control | [[1100, 1890], [3000, 4000]] | [[1100, 1890], [3000, 4000]] | Passed |
| normal control | [[2150, 2700]] | [[2150, 2700]] | Passed |
SHA-256 / aa365adb1b042711ec68de15f18eb2227e5927653d4b413dc6b8f485831f333e
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.669430+00:00.
Case digest / a35f508e68206a9ac27a9030b59cf8b9e8d99285798e7374bff7fd240a42a674