FA-4211 / Sequence semantics / Open access
First occurrence positions · case 01
The operation returns a result or retained state that violates this contract: Return positions at which each distinct value first appears.
ROOT CAUSE
Last occurrences are selected instead of first occurrences.
VERIFIED REPAIR
Return positions at which each distinct value first appears.
Unsuccessful approach: Every position is retained even when a value already appeared.
Case contract
Return positions at which each distinct value first appears. 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 [i for i,v in enumerate(x) if v not in x[i+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']), [0])
check('two distinct elements', solve(['a', 'b']), [0, 1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [0, 1, 3])
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 | [0] | [0] | Passed |
| two distinct elements | [0, 1] | [0, 1] | Passed |
| nonadjacent duplicate and unsorted order | [1, 2, 3] | [0, 1, 3] | Failed |
SHA-256 / e299f820571d7467695bf38d88cfa190eacf3ba55da7f0a4ed2d77d51d357e80
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(range(len(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']), [0])
check('two distinct elements', solve(['a', 'b']), [0, 1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [0, 1, 3])
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 | [0] | [0] | Passed |
| two distinct elements | [0, 1] | [0, 1] | Passed |
| nonadjacent duplicate and unsorted order | [0, 1, 2, 3] | [0, 1, 3] | Failed |
SHA-256 / 4fcd2d2c63647f6a1868a4cfc0426d8cdbaedd15479d44f9deeb4ae75edb3173
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 [i for i,v in enumerate(x) if v not 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']), [0])
check('two distinct elements', solve(['a', 'b']), [0, 1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [0, 1, 3])
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 | [0] | [0] | Passed |
| two distinct elements | [0, 1] | [0, 1] | Passed |
| nonadjacent duplicate and unsorted order | [0, 1, 3] | [0, 1, 3] | Passed |
SHA-256 / af401c2d3e6f49fa10a87bc5b61a2d074439321800d35b6f0beb7683d71b7ba1
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.944394+00:00.
Case digest / bdaa35be08ffd13fcb205c25a05d363e0db67e167986cdfe7dc757c43e0589cc