FA-78161 / Subtitle cue timing / Open access
Shot-change snapping of cue boundaries: collapse revert · case 01
Short cues between two nearby cuts collapse to zero length.
ROOT CAUSE
The revert condition does not catch zero-length results.
THE FAILURE
The revert condition does not catch zero-length results.
Unsuccessful approach: Comparing with the original start misses collapses caused by a start snapped later.
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 or d<abs(best-t)):
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: collapse revert', [[[1000, 1010]], [1000, 1100], 100, 0], [[1000, 1010]]), ('regression variant: collapse revert', [[[1101, 1111], [950, 960], [950, 1850]], [1000, 4000], 100, 0], [[1101, 1111], [950, 960], [1000, 1850]]), ('partial repair probe: collapse revert', [[[1100, 2100], [2990, 3000], [900, 1800]], [1100, 3040], 200, 0], [[1100, 2100], [2990, 3000], [1100, 1800]]), ('partial repair variant: collapse revert', [[[2750, 3250], [3751, 3761], [2950, 2980]], [3000, 4000], 250, 0], [[2750, 3250], [3751, 3761], [2950, 2980]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[850, 1890], [3000, 4000]], [1100, 3000], 250, 80], [[1100, 1890], [3000, 4000]]), ('normal control', [[[1251, 1261], [0, 851]], [0, 1000, 3040], 250, 80], [[1251, 1261], [0, 920]]), ('normal control', [[[1200, 1230], [801, 1301], [1050, 1550]], [1000, 2150], 200, 0], [[1000, 1230], [1000, 1301], [1000, 1550]])], [('regression: collapse revert', [[[50, 80], [4050, 5050]], [0, 1100, 2150, 3000, 4000], 250, 0], [[50, 80], [4000, 5050]]), ('regression variant: collapse revert', [[[1050, 2150], [0, 1]], [0, 1000, 3000], 200, 0], [[1000, 2150], [0, 1]]), ('partial repair probe: collapse revert', [[[2950, 2980]], [1200, 2150, 3000], 250, 0], [[2950, 2980]]), ('partial repair variant: collapse revert', [[[950, 1450], [1250, 2150], [1750, 2250]], [1000, 1200, 2000], 250, 0], [[1000, 1200], [1200, 2000], [1750, 2250]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[50, 1150]], [0, 1200, 2000, 2150], 250, 80], [[0, 1120]]), ('normal control', [[[1801, 2841], [1000, 1010]], [1000, 1200, 2000, 2150], 200, 42], [[2000, 2841], [1000, 1010]]), ('normal control', [[[4201, 5101], [4201, 5201], [4201, 4701]], [4000], 200, 0], [[4201, 5101], [4201, 5201], [4201, 4701]])], [('regression: collapse revert', [[[2950, 2980], [4050, 5150]], [2150, 3000, 4000], 250, 0], [[2950, 2980], [4000, 5150]]), ('regression variant: collapse revert', [[[1050, 1080], [1200, 2200], [2049, 2549]], [1100, 2150, 4000], 100, 0], [[1050, 1080], [1100, 2150], [2049, 2549]]), ('partial repair probe: collapse revert', [[[3000, 3900], [900, 930], [3000, 3030]], [0, 1100, 1200, 3000], 200, 80], [[3000, 3900], [900, 930], [3000, 3030]]), ('partial repair variant: collapse revert', [[[3200, 4200], [3801, 3811], [2950, 3950]], [1000, 3000, 4000], 200, 0], [[3000, 4000], [3801, 3811], [3000, 4000]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[1000, 2000], [3901, 4401]], [1100, 2000, 2150, 4000], 100, 42], [[1100, 1958], [4000, 4401]]), ('normal control', [[[3040, 3070], [2790, 3890], [849, 859]], [1100, 3040], 250, 80], [[3040, 3070], [3040, 3890], [849, 1020]]), ('normal control', [[[899, 1399], [3201, 3701], [1050, 2050]], [1100, 3000], 200, 80], [[899, 1399], [3201, 3701], [1100, 2050]])], [('regression: collapse revert', [[[1100, 2100], [2990, 3000], [900, 1800]], [1100, 3040], 200, 0], [[1100, 2100], [2990, 3000], [1100, 1800]]), ('regression variant: collapse revert', [[[851, 1951], [4050, 4060], [1350, 2250]], [1100, 4000], 250, 0], [[1100, 1951], [4050, 4060], [1100, 2250]]), ('partial repair probe: collapse revert', [[[1101, 1111], [950, 960], [950, 1850]], [1000, 4000], 100, 0], [[1101, 1111], [950, 960], [1000, 1850]]), ('partial repair variant: collapse revert', [[[851, 1891], [1100, 2100], [850, 880]], [1100], 250, 0], [[1100, 1891], [1100, 2100], [850, 880]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[50, 950]], [0, 1200], 250, 42], [[0, 1158]]), ('normal control', [[[4201, 5101], [1150, 1650], [2200, 3240]], [1100, 2000, 4000], 200, 0], [[4201, 5101], [1100, 1650], [2000, 3240]]), ('normal control', [[[2050, 3050]], [0, 2000, 2150], 100, 42], [[2000, 3050]])], [('regression: collapse revert', [[[2950, 2980]], [1200, 2150, 3000], 250, 0], [[2950, 2980]]), ('regression variant: collapse revert', [[[0, 249], [0, 500]], [0, 1000], 250, 0], [[0, 249], [0, 500]]), ('partial repair probe: collapse revert', [[[1050, 1080], [1200, 2200], [2049, 2549]], [1100, 2150, 4000], 100, 0], [[1050, 1080], [1100, 2150], [2049, 2549]]), ('partial repair variant: collapse revert', [[[850, 1350], [849, 1349], [4000, 4030]], [1100, 2000, 3000, 4000], 250, 0], [[850, 1350], [849, 1100], [4000, 4030]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[951, 1851], [1150, 2250], [1350, 2250]], [1100, 1200], 250, 42], [[1100, 1851], [1100, 2250], [1200, 2250]]), ('normal control', [[[1150, 2050], [849, 859], [1350, 2390]], [1100, 3000], 250, 80], [[1100, 2050], [849, 1020], [1100, 2390]]), ('normal control', [[[3000, 3010], [2800, 3700], [2799, 3799]], [1200, 3000], 200, 42], [[3000, 3010], [3000, 3700], [2799, 3799]])]]
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: collapse revert | [[1000, 1000]] | [[1000, 1010]] | Failed |
| regression variant: collapse revert | [[1101, 1111], [1000, 1000], [1000, 1850]] | [[1101, 1111], [950, 960], [1000, 1850]] | Failed |
| partial repair probe: collapse revert | [[1100, 2100], [3040, 3040], [1100, 1800]] | [[1100, 2100], [2990, 3000], [1100, 1800]] | Failed |
| partial repair variant: collapse revert | [[3000, 3000], [4000, 4000], [3000, 3000]] | [[2750, 3250], [3751, 3761], [2950, 2980]] | Failed |
| boundary control | [[1000, 1500]] | [[1000, 1500]] | Passed |
| boundary control | [[1200, 1800]] | [[1200, 1800]] | Passed |
| normal control | [[1100, 1890], [3000, 4000]] | [[1100, 1890], [3000, 4000]] | Passed |
| normal control | [[1251, 1261], [0, 920]] | [[1251, 1261], [0, 920]] | Passed |
| normal control | [[1000, 1230], [1000, 1301], [1000, 1550]] | [[1000, 1230], [1000, 1301], [1000, 1550]] | Passed |
SHA-256 / fc1d7b1f1d88ae82bd8757f619ca490dfd3a07ed5d265de177c20e2b41064c71
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<abs(best-t)):
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<=s0:
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: collapse revert', [[[1000, 1010]], [1000, 1100], 100, 0], [[1000, 1010]]), ('regression variant: collapse revert', [[[1101, 1111], [950, 960], [950, 1850]], [1000, 4000], 100, 0], [[1101, 1111], [950, 960], [1000, 1850]]), ('partial repair probe: collapse revert', [[[1100, 2100], [2990, 3000], [900, 1800]], [1100, 3040], 200, 0], [[1100, 2100], [2990, 3000], [1100, 1800]]), ('partial repair variant: collapse revert', [[[2750, 3250], [3751, 3761], [2950, 2980]], [3000, 4000], 250, 0], [[2750, 3250], [3751, 3761], [2950, 2980]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[850, 1890], [3000, 4000]], [1100, 3000], 250, 80], [[1100, 1890], [3000, 4000]]), ('normal control', [[[1251, 1261], [0, 851]], [0, 1000, 3040], 250, 80], [[1251, 1261], [0, 920]]), ('normal control', [[[1200, 1230], [801, 1301], [1050, 1550]], [1000, 2150], 200, 0], [[1000, 1230], [1000, 1301], [1000, 1550]])], [('regression: collapse revert', [[[50, 80], [4050, 5050]], [0, 1100, 2150, 3000, 4000], 250, 0], [[50, 80], [4000, 5050]]), ('regression variant: collapse revert', [[[1050, 2150], [0, 1]], [0, 1000, 3000], 200, 0], [[1000, 2150], [0, 1]]), ('partial repair probe: collapse revert', [[[2950, 2980]], [1200, 2150, 3000], 250, 0], [[2950, 2980]]), ('partial repair variant: collapse revert', [[[950, 1450], [1250, 2150], [1750, 2250]], [1000, 1200, 2000], 250, 0], [[1000, 1200], [1200, 2000], [1750, 2250]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[50, 1150]], [0, 1200, 2000, 2150], 250, 80], [[0, 1120]]), ('normal control', [[[1801, 2841], [1000, 1010]], [1000, 1200, 2000, 2150], 200, 42], [[2000, 2841], [1000, 1010]]), ('normal control', [[[4201, 5101], [4201, 5201], [4201, 4701]], [4000], 200, 0], [[4201, 5101], [4201, 5201], [4201, 4701]])], [('regression: collapse revert', [[[2950, 2980], [4050, 5150]], [2150, 3000, 4000], 250, 0], [[2950, 2980], [4000, 5150]]), ('regression variant: collapse revert', [[[1050, 1080], [1200, 2200], [2049, 2549]], [1100, 2150, 4000], 100, 0], [[1050, 1080], [1100, 2150], [2049, 2549]]), ('partial repair probe: collapse revert', [[[3000, 3900], [900, 930], [3000, 3030]], [0, 1100, 1200, 3000], 200, 80], [[3000, 3900], [900, 930], [3000, 3030]]), ('partial repair variant: collapse revert', [[[3200, 4200], [3801, 3811], [2950, 3950]], [1000, 3000, 4000], 200, 0], [[3000, 4000], [3801, 3811], [3000, 4000]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[1000, 2000], [3901, 4401]], [1100, 2000, 2150, 4000], 100, 42], [[1100, 1958], [4000, 4401]]), ('normal control', [[[3040, 3070], [2790, 3890], [849, 859]], [1100, 3040], 250, 80], [[3040, 3070], [3040, 3890], [849, 1020]]), ('normal control', [[[899, 1399], [3201, 3701], [1050, 2050]], [1100, 3000], 200, 80], [[899, 1399], [3201, 3701], [1100, 2050]])], [('regression: collapse revert', [[[1100, 2100], [2990, 3000], [900, 1800]], [1100, 3040], 200, 0], [[1100, 2100], [2990, 3000], [1100, 1800]]), ('regression variant: collapse revert', [[[851, 1951], [4050, 4060], [1350, 2250]], [1100, 4000], 250, 0], [[1100, 1951], [4050, 4060], [1100, 2250]]), ('partial repair probe: collapse revert', [[[1101, 1111], [950, 960], [950, 1850]], [1000, 4000], 100, 0], [[1101, 1111], [950, 960], [1000, 1850]]), ('partial repair variant: collapse revert', [[[851, 1891], [1100, 2100], [850, 880]], [1100], 250, 0], [[1100, 1891], [1100, 2100], [850, 880]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('normal control', [[[50, 950]], [0, 1200], 250, 42], [[0, 1158]]), ('normal control', [[[4201, 5101], [1150, 1650], [2200, 3240]], [1100, 2000, 4000], 200, 0], [[4201, 5101], [1100, 1650], [2000, 3240]]), ('normal control', [[[2050, 3050]], [0, 2000, 2150], 100, 42], [[2000, 3050]])], [('regression: collapse revert', [[[2950, 2980]], [1200, 2150, 3000], 250, 0], [[2950, 2980]]), ('regression variant: collapse revert', [[[0, 249], [0, 500]], [0, 1000], 250, 0], [[0, 249], [0, 500]]), ('partial repair probe: collapse revert', [[[1050, 1080], [1200, 2200], [2049, 2549]], [1100, 2150, 4000], 100, 0], [[1050, 1080], [1100, 2150], [2049, 2549]]), ('partial repair variant: collapse revert', [[[850, 1350], [849, 1349], [4000, 4030]], [1100, 2000, 3000, 4000], 250, 0], [[850, 1350], [849, 1100], [4000, 4030]]), ('boundary control', [[[900, 1500]], [1000], 100, 0], [[1000, 1500]]), ('boundary control', [[[1150, 1800]], [1000, 1200, 2000], 100, 80], [[1200, 1800]]), ('normal control', [[[951, 1851], [1150, 2250], [1350, 2250]], [1100, 1200], 250, 42], [[1100, 1851], [1100, 2250], [1200, 2250]]), ('normal control', [[[1150, 2050], [849, 859], [1350, 2390]], [1100, 3000], 250, 80], [[1100, 2050], [849, 1020], [1100, 2390]]), ('normal control', [[[3000, 3010], [2800, 3700], [2799, 3799]], [1200, 3000], 200, 42], [[3000, 3010], [3000, 3700], [2799, 3799]])]]
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: collapse revert | [[1000, 1010]] | [[1000, 1010]] | Passed |
| regression variant: collapse revert | [[1101, 1111], [1000, 1000], [1000, 1850]] | [[1101, 1111], [950, 960], [1000, 1850]] | Failed |
| partial repair probe: collapse revert | [[1100, 2100], [3040, 3040], [1100, 1800]] | [[1100, 2100], [2990, 3000], [1100, 1800]] | Failed |
| partial repair variant: collapse revert | [[3000, 3000], [4000, 4000], [3000, 3000]] | [[2750, 3250], [3751, 3761], [2950, 2980]] | Failed |
| boundary control | [[1000, 1500]] | [[1000, 1500]] | Passed |
| boundary control | [[1200, 1800]] | [[1200, 1800]] | Passed |
| normal control | [[1100, 1890], [3000, 4000]] | [[1100, 1890], [3000, 4000]] | Passed |
| normal control | [[1251, 1261], [0, 920]] | [[1251, 1261], [0, 920]] | Passed |
| normal control | [[1000, 1230], [1000, 1301], [1000, 1550]] | [[1000, 1230], [1000, 1301], [1000, 1550]] | Passed |
SHA-256 / 98d9855b8147b6dd34fd9d1d181d4bf63504161c69993f76d0339800943cf43b
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.723286+00:00.
Case digest / 534633151758f793177c54a8977a1f9ba435819e2b9c92fcab529d3216c77e56