FAILURE MAP
← Case archive

FA-4141 / Sequence semantics / Open access

Drop last not all matching · case 01

The operation returns a result or retained state that violates this contract: Remove exactly the last positional element.

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

ROOT CAUSE

Value-based filtering removes earlier elements equal to the last.

VERIFIED REPAIR

Remove exactly the last positional element.

Unsuccessful approach: Deduplicating the prefix removes legitimate repeated survivors.

Case contract

Remove exactly the last positional element. 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 [v for v in x if v != x[-1]] if x else []
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']), ['a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'b'])
check('last value also occurs earlier', solve(['a','b','a']), ['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[][]Passed
two distinct elements['a']['a']Passed
nonadjacent duplicate and unsorted order['b', 'a', 'b']['b', 'a', 'b']Passed
last value also occurs earlier['b']['a', 'b']Failed

SHA-256 / d47113fa84e0d29a3eb1acd2a323df23cf77ff03d7ae32caa3cb9f38a97f27dc

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 list(dict.fromkeys(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']), [])
check('two distinct elements', solve(['a', 'b']), ['a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'b'])
check('last value also occurs earlier', solve(['a','b','a']), ['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[][]Passed
two distinct elements['a']['a']Passed
nonadjacent duplicate and unsorted order['b', 'a']['b', 'a', 'b']Failed
last value also occurs earlier['a', 'b']['a', 'b']Passed

SHA-256 / d7484b7cfb471b36871133d15fe62cee975953b98747c2f3d3eebd6860247bde

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

SHA-256 / b6d5df983617ec535c6ce64ea8da78bee2441fe761f4548abb5e0eae621962de

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

Case digest / eba68540b0c6271420f85b5f1ae9f7fe68d061af4c9c6bea6e72e5ee90b75dcb