FA-4236 / Collection algebra / Open access
Stable set union · case 01
The operation returns a result or retained state that violates this contract: Return unique union values in first appearance order across left then right.
ROOT CAUSE
Sorting the union erases operand encounter order.
VERIFIED REPAIR
Return unique union values in first appearance order across left then right.
Unsuccessful approach: Reversing the operands gives right-side encounters priority.
Case contract
Return unique union values in first appearance order across left then right. 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 sorted(set(x+y))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), [])
check('empty right operand', solve(['a'], []), ['a'])
check('empty left operand', solve([], ['b']), ['b'])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', '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 |
|---|---|---|---|
| both empty | [] | [] | Passed |
| empty right operand | ['a'] | ['a'] | Passed |
| empty left operand | ['b'] | ['b'] | Passed |
| overlap and multiplicity | ['a', 'b', 'c'] | ['b', 'a', 'c'] | Failed |
SHA-256 / 072bec4d6cedb1fbf4af642ca69181657b6a67e8d249763bbaa5f40ea5e9e6e4
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(y+x))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), [])
check('empty right operand', solve(['a'], []), ['a'])
check('empty left operand', solve([], ['b']), ['b'])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', '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 |
|---|---|---|---|
| both empty | [] | [] | Passed |
| empty right operand | ['a'] | ['a'] | Passed |
| empty left operand | ['b'] | ['b'] | Passed |
| overlap and multiplicity | ['b', 'c', 'a'] | ['b', 'a', 'c'] | Failed |
SHA-256 / c6f0de56aa810c4a1dfc6139a59a66afa5c1c24e5fcff936f34498eb4d6b3f17
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+y))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), [])
check('empty right operand', solve(['a'], []), ['a'])
check('empty left operand', solve([], ['b']), ['b'])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', '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 |
|---|---|---|---|
| both empty | [] | [] | Passed |
| empty right operand | ['a'] | ['a'] | Passed |
| empty left operand | ['b'] | ['b'] | Passed |
| overlap and multiplicity | ['b', 'a', 'c'] | ['b', 'a', 'c'] | Passed |
SHA-256 / b264d3c25dc93cfc69a1c3fb1ba73a58a952148f94ac42e7b0dda23e070e39cb
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:37.144465+00:00.
Case digest / 139315f6b7c4c10d15a3e550bfc623de2f7cc5cd36e04538b9afbcfb5af96713