FA-4086 / Sequence semantics / Open access
Stable first occurrence uniqueness · case 01
The operation returns a result or retained state that violates this contract: Keep each value once in first-appearance order.
ROOT CAUSE
Repeated members are never removed.
VERIFIED REPAIR
Keep each value once in first-appearance order.
Unsuccessful approach: Sorting a set discards first-appearance order.
Case contract
Keep each value once in first-appearance order. 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']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'c'])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| empty collection | [] | [] | Passed |
| singleton collection | ['a'] | ['a'] | Passed |
| two distinct elements | ['a', 'b'] | ['a', 'b'] | Passed |
| nonadjacent duplicate and unsorted order | ['b', 'a', 'b', 'c'] | ['b', 'a', 'c'] | Failed |
SHA-256 / 4f519fdc7a1950855af47c98749bbd4d13082adec606ba518a3e0296ac694ae1
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(set(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']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'c'])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| empty collection | [] | [] | Passed |
| singleton collection | ['a'] | ['a'] | Passed |
| two distinct elements | ['a', 'b'] | ['a', 'b'] | Passed |
| nonadjacent duplicate and unsorted order | ['a', 'b', 'c'] | ['b', 'a', 'c'] | Failed |
SHA-256 / da6a3bfdeb21ab15eb141ae7476e72f97b4937970e56e3df94e3e79ff694de63
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 list(dict.fromkeys(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']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'c'])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| empty collection | [] | [] | Passed |
| singleton collection | ['a'] | ['a'] | Passed |
| two distinct elements | ['a', 'b'] | ['a', 'b'] | Passed |
| nonadjacent duplicate and unsorted order | ['b', 'a', 'c'] | ['b', 'a', 'c'] | Passed |
SHA-256 / d4e1586c938184256f9ef0ad5d7203f0d5f864b3e6b8239256594eb4225c36bc
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.422387+00:00.
Case digest / c380ff05b9360be320e25c5ef710cd509f7e99b0d40c287f88930c888b78a8eb