FAILURE MAP
← Case archive

FA-4116 / Sequence semantics / Open access

First element default · case 01

The operation returns a result or retained state that violates this contract: Return the first element, or None only when the list is empty.

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

ROOT CAUSE

The last positional element is selected instead of the first.

VERIFIED REPAIR

Return the first element, or None only when the list is empty.

Unsuccessful approach: The lexical minimum need not be the first inserted element.

Case contract

Return the first element, or None only when the list is empty. 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[-1] if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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 collectionNoneNonePassed
singleton collectionaaPassed
two distinct elementsbaFailed
nonadjacent duplicate and unsorted ordercbFailed

SHA-256 / ae8228b45334b7d3bae4838c1dfeeecdff650b9a72a5194a40e65d46bbec5350

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 min(x) if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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 collectionNoneNonePassed
singleton collectionaaPassed
two distinct elementsaaPassed
nonadjacent duplicate and unsorted orderabFailed

SHA-256 / 8150796b866d7d5eb8a3eb3422b3be4290ce46b1de7d587b1676591036c6d96a

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[0] if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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 collectionNoneNonePassed
singleton collectionaaPassed
two distinct elementsaaPassed
nonadjacent duplicate and unsorted orderbbPassed

SHA-256 / e3e44fdb75b92078008d04e9f5f914f9763cadc25408bc9f88c9417becf7574e

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

Case digest / 03391c665ebd3e36a96e0d99e1d807ab424952c190630961054531473ffab31b