FA-78306 / Subtitle cue timing / Open access
Active cue lookup with prefix maximum ends: prefix maximum · case 01
Earlier long cues are skipped once a short cue follows them.
ROOT CAUSE
The running value records each cue end instead of the maximum so far.
VERIFIED REPAIR
Track the maximum end over the prefix.
Unsuccessful approach: Tracking the maximum start never covers long earlier cues.
Case contract
cues [start,end] are sorted by start. Return the ascending indices of cues active at t (start <= t < end). The search bisects the starts and walks backwards while the running maximum end of the prefix exceeds t.
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
import bisect
N = 1
observations = []
def solve(cues, t):
starts=[c[0] for c in cues]
hi=bisect.bisect_right(starts,t)
maxend=[]
run=0
for c in cues:
run=c[1]
maxend.append(run)
res=[]
i=hi-1
while i>=0 and maxend[i]>t:
if cues[i][1]>t:
res.append(i)
i-=1
return sorted(res)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: prefix maximum', [[[0, 1000], [100, 200], [300, 400]], 350], [0, 2]), ('regression variant: prefix maximum', [[[300, 600], [300, 350], [400, 700], [400, 500]], 600], [2]), ('partial repair probe: prefix maximum', [[[0, 50], [0, 500], [200, 250]], 300], [1]), ('partial repair variant: prefix maximum', [[[0, 50], [100, 400], [200, 500], [400, 450], [500, 1500]], 1200], [4]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[100, 400], [300, 400], [400, 450], [400, 700], [400, 1400]], 0], []), ('normal control', [[[0, 50], [0, 50], [300, 400]], 1200], []), ('normal control', [[[400, 1400]], 300], [])], [('regression: prefix maximum', [[[0, 50], [0, 500], [200, 250]], 300], [1]), ('regression variant: prefix maximum', [[[100, 1100], [100, 1100], [400, 500], [400, 700], [400, 450], [500, 550]], 500], [0, 1, 3, 5]), ('partial repair probe: prefix maximum', [[[0, 100], [100, 1100], [200, 300], [200, 500]], 50], [0]), ('partial repair variant: prefix maximum', [[[100, 400], [300, 350], [500, 550]], 300], [0, 1]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[0, 100], [0, 100], [100, 150]], 200], []), ('normal control', [[[200, 500]], 500], []), ('normal control', [[[500, 550]], 50], [])], [('regression: prefix maximum', [[[0, 100], [0, 1000], [400, 500], [500, 600], [500, 1500], [500, 550]], 600], [1, 4]), ('regression variant: prefix maximum', [[[0, 300], [0, 100], [200, 1200], [200, 300], [300, 600], [300, 1300]], 400], [2, 4, 5]), ('partial repair probe: prefix maximum', [[[100, 400], [300, 400], [300, 400], [300, 350], [400, 500], [500, 800]], 300], [0, 1, 2, 3]), ('partial repair variant: prefix maximum', [[[0, 1000], [100, 1100], [200, 500], [200, 500]], 200], [0, 1, 2, 3]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[100, 1100], [100, 400], [100, 1100], [400, 700], [500, 550]], 1499], []), ('normal control', [[[200, 300]], 150], []), ('normal control', [[[300, 600]], 600], [])], [('regression: prefix maximum', [[[0, 100], [200, 1200], [300, 400], [500, 800]], 600], [1, 3]), ('regression variant: prefix maximum', [[[0, 300], [0, 50], [100, 200], [200, 500], [400, 500]], 100], [0, 2]), ('partial repair probe: prefix maximum', [[[100, 400], [400, 500], [500, 550], [500, 600]], 100], [0]), ('partial repair variant: prefix maximum', [[[0, 100], [0, 1000], [400, 500], [500, 600], [500, 1500], [500, 550]], 600], [1, 4]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[200, 250], [200, 300], [300, 350], [400, 1400], [500, 550]], 1499], []), ('normal control', [[[200, 300], [200, 250], [300, 1300], [300, 1300], [300, 1300]], 0], []), ('normal control', [[[200, 300]], 1200], [])], [('regression: prefix maximum', [[[0, 1000], [100, 150], [100, 400], [200, 1200]], 300], [0, 2, 3]), ('regression variant: prefix maximum', [[[200, 250], [200, 1200], [300, 350], [300, 350], [400, 700]], 600], [1, 4]), ('partial repair probe: prefix maximum', [[[0, 1000], [200, 300], [400, 450]], 200], [0, 1]), ('partial repair variant: prefix maximum', [[[0, 300], [500, 550]], 50], [0]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[200, 300], [500, 1500], [500, 1500]], 150], []), ('normal control', [[[0, 50]], 500], []), ('normal control', [[[0, 50], [200, 250]], 500], [])]]
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: prefix maximum | [2] | [0, 2] | Failed |
| regression variant: prefix maximum | [] | [2] | Failed |
| partial repair probe: prefix maximum | [] | [1] | Failed |
| partial repair variant: prefix maximum | [4] | [4] | Passed |
| boundary control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
SHA-256 / 7ba286b85d7924388465c70eb588c2fb7740f91dcd4cc1a6ce6f34b39f1ff4aa
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import bisect
N = 1
observations = []
def solve(cues, t):
starts=[c[0] for c in cues]
hi=bisect.bisect_right(starts,t)
maxend=[]
run=0
for c in cues:
run=max(run,c[0])
maxend.append(run)
res=[]
i=hi-1
while i>=0 and maxend[i]>t:
if cues[i][1]>t:
res.append(i)
i-=1
return sorted(res)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: prefix maximum', [[[0, 1000], [100, 200], [300, 400]], 350], [0, 2]), ('regression variant: prefix maximum', [[[300, 600], [300, 350], [400, 700], [400, 500]], 600], [2]), ('partial repair probe: prefix maximum', [[[0, 50], [0, 500], [200, 250]], 300], [1]), ('partial repair variant: prefix maximum', [[[0, 50], [100, 400], [200, 500], [400, 450], [500, 1500]], 1200], [4]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[100, 400], [300, 400], [400, 450], [400, 700], [400, 1400]], 0], []), ('normal control', [[[0, 50], [0, 50], [300, 400]], 1200], []), ('normal control', [[[400, 1400]], 300], [])], [('regression: prefix maximum', [[[0, 50], [0, 500], [200, 250]], 300], [1]), ('regression variant: prefix maximum', [[[100, 1100], [100, 1100], [400, 500], [400, 700], [400, 450], [500, 550]], 500], [0, 1, 3, 5]), ('partial repair probe: prefix maximum', [[[0, 100], [100, 1100], [200, 300], [200, 500]], 50], [0]), ('partial repair variant: prefix maximum', [[[100, 400], [300, 350], [500, 550]], 300], [0, 1]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[0, 100], [0, 100], [100, 150]], 200], []), ('normal control', [[[200, 500]], 500], []), ('normal control', [[[500, 550]], 50], [])], [('regression: prefix maximum', [[[0, 100], [0, 1000], [400, 500], [500, 600], [500, 1500], [500, 550]], 600], [1, 4]), ('regression variant: prefix maximum', [[[0, 300], [0, 100], [200, 1200], [200, 300], [300, 600], [300, 1300]], 400], [2, 4, 5]), ('partial repair probe: prefix maximum', [[[100, 400], [300, 400], [300, 400], [300, 350], [400, 500], [500, 800]], 300], [0, 1, 2, 3]), ('partial repair variant: prefix maximum', [[[0, 1000], [100, 1100], [200, 500], [200, 500]], 200], [0, 1, 2, 3]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[100, 1100], [100, 400], [100, 1100], [400, 700], [500, 550]], 1499], []), ('normal control', [[[200, 300]], 150], []), ('normal control', [[[300, 600]], 600], [])], [('regression: prefix maximum', [[[0, 100], [200, 1200], [300, 400], [500, 800]], 600], [1, 3]), ('regression variant: prefix maximum', [[[0, 300], [0, 50], [100, 200], [200, 500], [400, 500]], 100], [0, 2]), ('partial repair probe: prefix maximum', [[[100, 400], [400, 500], [500, 550], [500, 600]], 100], [0]), ('partial repair variant: prefix maximum', [[[0, 100], [0, 1000], [400, 500], [500, 600], [500, 1500], [500, 550]], 600], [1, 4]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[200, 250], [200, 300], [300, 350], [400, 1400], [500, 550]], 1499], []), ('normal control', [[[200, 300], [200, 250], [300, 1300], [300, 1300], [300, 1300]], 0], []), ('normal control', [[[200, 300]], 1200], [])], [('regression: prefix maximum', [[[0, 1000], [100, 150], [100, 400], [200, 1200]], 300], [0, 2, 3]), ('regression variant: prefix maximum', [[[200, 250], [200, 1200], [300, 350], [300, 350], [400, 700]], 600], [1, 4]), ('partial repair probe: prefix maximum', [[[0, 1000], [200, 300], [400, 450]], 200], [0, 1]), ('partial repair variant: prefix maximum', [[[0, 300], [500, 550]], 50], [0]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[200, 300], [500, 1500], [500, 1500]], 150], []), ('normal control', [[[0, 50]], 500], []), ('normal control', [[[0, 50], [200, 250]], 500], [])]]
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: prefix maximum | [] | [0, 2] | Failed |
| regression variant: prefix maximum | [] | [2] | Failed |
| partial repair probe: prefix maximum | [] | [1] | Failed |
| partial repair variant: prefix maximum | [] | [4] | Failed |
| boundary control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
SHA-256 / b71c59f5772da1342af812d8d5ae9bf43507a347319c41c4978edfdc063fe9f4
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import bisect
N = 1
observations = []
def solve(cues, t):
starts=[c[0] for c in cues]
hi=bisect.bisect_right(starts,t)
maxend=[]
run=0
for c in cues:
run=max(run,c[1])
maxend.append(run)
res=[]
i=hi-1
while i>=0 and maxend[i]>t:
if cues[i][1]>t:
res.append(i)
i-=1
return sorted(res)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: prefix maximum', [[[0, 1000], [100, 200], [300, 400]], 350], [0, 2]), ('regression variant: prefix maximum', [[[300, 600], [300, 350], [400, 700], [400, 500]], 600], [2]), ('partial repair probe: prefix maximum', [[[0, 50], [0, 500], [200, 250]], 300], [1]), ('partial repair variant: prefix maximum', [[[0, 50], [100, 400], [200, 500], [400, 450], [500, 1500]], 1200], [4]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[100, 400], [300, 400], [400, 450], [400, 700], [400, 1400]], 0], []), ('normal control', [[[0, 50], [0, 50], [300, 400]], 1200], []), ('normal control', [[[400, 1400]], 300], [])], [('regression: prefix maximum', [[[0, 50], [0, 500], [200, 250]], 300], [1]), ('regression variant: prefix maximum', [[[100, 1100], [100, 1100], [400, 500], [400, 700], [400, 450], [500, 550]], 500], [0, 1, 3, 5]), ('partial repair probe: prefix maximum', [[[0, 100], [100, 1100], [200, 300], [200, 500]], 50], [0]), ('partial repair variant: prefix maximum', [[[100, 400], [300, 350], [500, 550]], 300], [0, 1]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[0, 100], [0, 100], [100, 150]], 200], []), ('normal control', [[[200, 500]], 500], []), ('normal control', [[[500, 550]], 50], [])], [('regression: prefix maximum', [[[0, 100], [0, 1000], [400, 500], [500, 600], [500, 1500], [500, 550]], 600], [1, 4]), ('regression variant: prefix maximum', [[[0, 300], [0, 100], [200, 1200], [200, 300], [300, 600], [300, 1300]], 400], [2, 4, 5]), ('partial repair probe: prefix maximum', [[[100, 400], [300, 400], [300, 400], [300, 350], [400, 500], [500, 800]], 300], [0, 1, 2, 3]), ('partial repair variant: prefix maximum', [[[0, 1000], [100, 1100], [200, 500], [200, 500]], 200], [0, 1, 2, 3]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[100, 1100], [100, 400], [100, 1100], [400, 700], [500, 550]], 1499], []), ('normal control', [[[200, 300]], 150], []), ('normal control', [[[300, 600]], 600], [])], [('regression: prefix maximum', [[[0, 100], [200, 1200], [300, 400], [500, 800]], 600], [1, 3]), ('regression variant: prefix maximum', [[[0, 300], [0, 50], [100, 200], [200, 500], [400, 500]], 100], [0, 2]), ('partial repair probe: prefix maximum', [[[100, 400], [400, 500], [500, 550], [500, 600]], 100], [0]), ('partial repair variant: prefix maximum', [[[0, 100], [0, 1000], [400, 500], [500, 600], [500, 1500], [500, 550]], 600], [1, 4]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[200, 250], [200, 300], [300, 350], [400, 1400], [500, 550]], 1499], []), ('normal control', [[[200, 300], [200, 250], [300, 1300], [300, 1300], [300, 1300]], 0], []), ('normal control', [[[200, 300]], 1200], [])], [('regression: prefix maximum', [[[0, 1000], [100, 150], [100, 400], [200, 1200]], 300], [0, 2, 3]), ('regression variant: prefix maximum', [[[200, 250], [200, 1200], [300, 350], [300, 350], [400, 700]], 600], [1, 4]), ('partial repair probe: prefix maximum', [[[0, 1000], [200, 300], [400, 450]], 200], [0, 1]), ('partial repair variant: prefix maximum', [[[0, 300], [500, 550]], 50], [0]), ('boundary control', [[[0, 100]], 100], []), ('normal control', [[[200, 300], [500, 1500], [500, 1500]], 150], []), ('normal control', [[[0, 50]], 500], []), ('normal control', [[[0, 50], [200, 250]], 500], [])]]
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: prefix maximum | [0, 2] | [0, 2] | Passed |
| regression variant: prefix maximum | [2] | [2] | Passed |
| partial repair probe: prefix maximum | [1] | [1] | Passed |
| partial repair variant: prefix maximum | [4] | [4] | Passed |
| boundary control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
| normal control | [] | [] | Passed |
SHA-256 / 1e861d8e6ce48499cf0dc354daf33fa6607dcd33ca593abb9d08243e9fd0fb9e
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:34.033044+00:00.
Case digest / adb8bffd70a73b6b366a799ded1a607afc3cf39e18b961b3d3fa83869a7e82d0