FA-4601 / Iterator consumption / Open access
Combinations respect positional order · case 01
The operation returns a result or retained state that violates this contract: Return length-r combinations of input positions, preserving input order within tuples and retaining duplicate-valued tuples.
ROOT CAUSE
Permutations emit orderings that violate source-position order.
VERIFIED REPAIR
Return length-r combinations of input positions, preserving input order within tuples and retaining duplicate-valued tuples.
Unsuccessful approach: Deduplicating the source loses equal-valued combinations from distinct positions.
Case contract
Return length-r combinations of input positions, preserving input order within tuples and retaining duplicate-valued tuples. 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
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
return [list(v) for v in it.permutations(x,y)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('position duplicates', solve(['a', 'a', 'b'], 2), [['a', 'a'], ['a', 'b'], ['a', 'b']])
check('input order', solve(['b', 'a'], 2), [['b', 'a']])
check('zero choice', solve([], 0), [[]])
check('too many', solve(['a'], 2), [])
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 |
|---|---|---|---|
| position duplicates | [['a', 'a'], ['a', 'b'], ['a', 'a'], ['a', 'b'], ['b', 'a'], ['b', 'a']] | [['a', 'a'], ['a', 'b'], ['a', 'b']] | Failed |
| input order | [['b', 'a'], ['a', 'b']] | [['b', 'a']] | Failed |
| zero choice | [[]] | [[]] | Passed |
| too many | [] | [] | Passed |
SHA-256 / f171700d4b74b1382b8ff0215330532077c1b906bf17fbfcb5073cca01b2e1e3
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
return [list(v) for v in it.combinations(dict.fromkeys(x),y)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('position duplicates', solve(['a', 'a', 'b'], 2), [['a', 'a'], ['a', 'b'], ['a', 'b']])
check('input order', solve(['b', 'a'], 2), [['b', 'a']])
check('zero choice', solve([], 0), [[]])
check('too many', solve(['a'], 2), [])
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 |
|---|---|---|---|
| position duplicates | [['a', 'b']] | [['a', 'a'], ['a', 'b'], ['a', 'b']] | Failed |
| input order | [['b', 'a']] | [['b', 'a']] | Passed |
| zero choice | [[]] | [[]] | Passed |
| too many | [] | [] | Passed |
SHA-256 / 1c35c7986de1e41e0dec736d06e76a82b28bbc74b55eb848f10d6ccdefebd186
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
return [list(v) for v in it.combinations(x,y)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('position duplicates', solve(['a', 'a', 'b'], 2), [['a', 'a'], ['a', 'b'], ['a', 'b']])
check('input order', solve(['b', 'a'], 2), [['b', 'a']])
check('zero choice', solve([], 0), [[]])
check('too many', solve(['a'], 2), [])
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 |
|---|---|---|---|
| position duplicates | [['a', 'a'], ['a', 'b'], ['a', 'b']] | [['a', 'a'], ['a', 'b'], ['a', 'b']] | Passed |
| input order | [['b', 'a']] | [['b', 'a']] | Passed |
| zero choice | [[]] | [[]] | Passed |
| too many | [] | [] | Passed |
SHA-256 / dcc4cd538beb9ef8d93eaef0cb6f8dca714a41cb9acb9c54b870d33a961f741f
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:40.847211+00:00.
Case digest / 4e923ac9126b216273786f2486336df55ca33d522e3c70bd34288783095c3af7