FAILURE MAP
← Case archive

FA-11031 / Media playlist state / Open access

Insert before preserves playing entry · case 01

Inserting before playback shifts the current item but leaves its old numeric index.

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

ROOT CAUSE

Inserting before playback shifts the current item but leaves its old numeric index.

VERIFIED REPAIR

Preserve the media contract: Entries is nonempty; current is a valid index, insertion position in [0,length]. Insert added entries while keeping the original current entry selected.

Unsuccessful approach: Increasing the index for every insertion changes playback when insertion is after it.

Case contract

Entries is nonempty; current is a valid index, insertion position in [0,length]. Insert added entries while keeping the original current entry selected.

Why this case matters

A deterministic local media controller stage; metadata and downloaded data are supplied explicitly. No external player, service or codec is required.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(entries, current, position, added):
    return [entries[:position]+list(added)+entries[position:],current]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*(['a', 'b'], 1, 0, ['x'])),[['x', 'a', 'b'], 2])
check('fixture 2',solve(*(['a', 'b'], 0, 2, ['x'])),[['a', 'b', 'x'], 0])
check('fixture 3',solve(*(['a'], 0, 0, [])),[['a'], 0])
check('fixture 4',solve(*(['a', 'b'], 1, 1, ['x', 'y'])),[['a', 'x', 'y', 'b'], 3])
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
fixture 1[['x', 'a', 'b'], 1][['x', 'a', 'b'], 2]Failed
fixture 2[['a', 'b', 'x'], 0][['a', 'b', 'x'], 0]Passed
fixture 3[['a'], 0][['a'], 0]Passed
fixture 4[['a', 'x', 'y', 'b'], 1][['a', 'x', 'y', 'b'], 3]Failed

SHA-256 / 736c7ce0d0a41f558ac4d9a10c6da6c0d1f5820c2947d021af8d5b89d235cc9e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(entries, current, position, added):
    return [entries[:position]+list(added)+entries[position:],current+len(added)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*(['a', 'b'], 1, 0, ['x'])),[['x', 'a', 'b'], 2])
check('fixture 2',solve(*(['a', 'b'], 0, 2, ['x'])),[['a', 'b', 'x'], 0])
check('fixture 3',solve(*(['a'], 0, 0, [])),[['a'], 0])
check('fixture 4',solve(*(['a', 'b'], 1, 1, ['x', 'y'])),[['a', 'x', 'y', 'b'], 3])
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
fixture 1[['x', 'a', 'b'], 2][['x', 'a', 'b'], 2]Passed
fixture 2[['a', 'b', 'x'], 1][['a', 'b', 'x'], 0]Failed
fixture 3[['a'], 0][['a'], 0]Passed
fixture 4[['a', 'x', 'y', 'b'], 3][['a', 'x', 'y', 'b'], 3]Passed

SHA-256 / cf6c7a9e8a3148239d2d4870bd0c8370965d95500310793bb6cb3f9737261bfa

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(entries, current, position, added):
    return [entries[:position]+list(added)+entries[position:],current+len(added) if position<=current else current]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*(['a', 'b'], 1, 0, ['x'])),[['x', 'a', 'b'], 2])
check('fixture 2',solve(*(['a', 'b'], 0, 2, ['x'])),[['a', 'b', 'x'], 0])
check('fixture 3',solve(*(['a'], 0, 0, [])),[['a'], 0])
check('fixture 4',solve(*(['a', 'b'], 1, 1, ['x', 'y'])),[['a', 'x', 'y', 'b'], 3])
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
fixture 1[['x', 'a', 'b'], 2][['x', 'a', 'b'], 2]Passed
fixture 2[['a', 'b', 'x'], 0][['a', 'b', 'x'], 0]Passed
fixture 3[['a'], 0][['a'], 0]Passed
fixture 4[['a', 'x', 'y', 'b'], 3][['a', 'x', 'y', 'b'], 3]Passed

SHA-256 / 4a4c1197c2d695c373e7ddd4c40dfc469cdeccf3e46b3cdd6fd9d3f46f242b7f

Verification & scope

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

Case digest / 11bd07c691adbc3e5756ed8b7d2af4e5727e39318de069e44095dcdf5e29abe8