FAILURE MAP
← Case archive

FA-4106 / Sequence semantics / Open access

All duplicated members · case 01

The operation returns a result or retained state that violates this contract: Return every occurrence of values that occur more than once.

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

ROOT CAUSE

A seen-set filter drops the first occurrence of each duplicated value.

VERIFIED REPAIR

Return every occurrence of values that occur more than once.

Unsuccessful approach: Deduplicating repeated values loses their required multiplicity.

Case contract

Return every occurrence of values that occur more than once. 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 i,v in enumerate(x) if v 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']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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[][]Passed
nonadjacent duplicate and unsorted order['b']['b', 'b']Failed

SHA-256 / 18d2624ae360778ee8a4a20ec194d0de9f2f3f6a9488c6f07492be20e8795f39

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(v for v in x if x.count(v)>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']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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[][]Passed
nonadjacent duplicate and unsorted order['b']['b', 'b']Failed

SHA-256 / d6aca02f9cd60ab08a459bb31e2c5b0e242f12ba2908964deb79e52e29a64491

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 [v for v in x if x.count(v)>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']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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[][]Passed
nonadjacent duplicate and unsorted order['b', 'b']['b', 'b']Passed

SHA-256 / 2a58ae5a1a5561517e5aa71d36a148ca478f59f35aafb8228231d02e370eaa99

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

Case digest / 2b2998a1a50a6fb384ac8702957234a1b3e6a018b3453c37a869e867bd4baa62