FAILURE MAP
← Case archive

FA-4081 / Sequence semantics / Open access

Reverse retains multiplicity · case 01

The operation returns a result or retained state that violates this contract: Reverse the complete list, retaining every occurrence.

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

ROOT CAUSE

The sequence is returned in forward order instead of being reversed.

VERIFIED REPAIR

Reverse the complete list, retaining every occurrence.

Unsuccessful approach: Descending sorting imposes lexical order instead of reversing positional order.

Case contract

Reverse the complete list, retaining every occurrence. 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 x
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']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', 'a', 'b'])
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['a']['a']Passed
two distinct elements['a', 'b']['b', 'a']Failed
nonadjacent duplicate and unsorted order['b', 'a', 'b', 'c']['c', 'b', 'a', 'b']Failed

SHA-256 / f83d5820f0c5792017f88db64260904268e7fed25d2f75db4ebb025f129cb482

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 sorted(x, reverse=True)
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']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', 'a', 'b'])
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['a']['a']Passed
two distinct elements['b', 'a']['b', 'a']Passed
nonadjacent duplicate and unsorted order['c', 'b', 'b', 'a']['c', 'b', 'a', 'b']Failed

SHA-256 / 3bdbfd95e531c6c48308fa1aa545b258557c21ea26b56d0d05a58f293fd9876b

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 x[::-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']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', 'a', 'b'])
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['a']['a']Passed
two distinct elements['b', 'a']['b', 'a']Passed
nonadjacent duplicate and unsorted order['c', 'b', 'a', 'b']['c', 'b', 'a', 'b']Passed

SHA-256 / 8c5ccf12b8f3d919e36001fddd5f97504dd2fe749b7176529c4458e9040885af

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

Case digest / c051c52cd3b2413e43d5ccef640c8c0e7e46aaefc81a89aa827622de0709a923