FAILURE MAP
← Case archive

FA-4206 / Sequence semantics / Open access

Adjacent change positions · case 01

The operation returns a result or retained state that violates this contract: Return indices whose element differs from its predecessor; position zero is not a change.

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

ROOT CAUSE

The first element is incorrectly counted as a change without a predecessor.

VERIFIED REPAIR

Return indices whose element differs from its predecessor; position zero is not a change.

Unsuccessful approach: Global novelty is substituted for inequality with the immediate predecessor.

Case contract

Return indices whose element differs from its predecessor; position zero is not a change. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

Why this case matters

A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    return [i for i in range(len(x)) if i==0 or x[i]!=x[i-1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [1, 2, 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
empty collection[][]Passed
singleton collection[0][]Failed
two distinct elements[0, 1][1]Failed
nonadjacent duplicate and unsorted order[0, 1, 2, 3][1, 2, 3]Failed

SHA-256 / c5f30fd5e4ab1f55aee92270c15ac5018cdc79770a9336d32fdcac09113f2a43

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    return [i for i in range(1,len(x)) if x[i] not in x[:i]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [1, 2, 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
empty collection[][]Passed
singleton collection[][]Passed
two distinct elements[1][1]Passed
nonadjacent duplicate and unsorted order[1, 3][1, 2, 3]Failed

SHA-256 / c8560607970381c79f76d5f1acdb772ef2ff8b900b7625b9811b0ea470791356

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    return [i for i in range(1,len(x)) if x[i]!=x[i-1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [1, 2, 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
empty collection[][]Passed
singleton collection[][]Passed
two distinct elements[1][1]Passed
nonadjacent duplicate and unsorted order[1, 2, 3][1, 2, 3]Passed

SHA-256 / 4309ca506fc0eac21a2ffe32b21037680d6e3cdb9551b870a66b2e961d4a462b

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:37:36.943332+00:00.

Case digest / b7bbb891a2936866ee84503009e00fe428ae3387abf01a85df124f85aef86cb3