FAILURE MAP
← Case archive

FA-4261 / Collection algebra / Open access

Stable symmetric set difference · case 01

The operation returns a result or retained state that violates this contract: Return left-only then right-only unique values in their respective first-appearance orders.

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

ROOT CAUSE

Union membership retains shared values that should be excluded.

VERIFIED REPAIR

Return left-only then right-only unique values in their respective first-appearance orders.

Unsuccessful approach: Computing only the left difference omits right-only members.

Case contract

Return left-only then right-only unique values in their respective first-appearance orders. 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 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']), ['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 fixtureActualExpectedOutcome
both empty[][]Passed
empty right operand['a']['a']Passed
empty left operand['b']['b']Passed
overlap and multiplicity['b', 'a', 'c']['a', 'c']Failed

SHA-256 / 02ace3d9906de362b4b4a5a00b9aef07ef871de665395ab9df3986d66c029a53

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 [v for v in dict.fromkeys(x) if v not in 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']), ['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 fixtureActualExpectedOutcome
both empty[][]Passed
empty right operand['a']['a']Passed
empty left operand[]['b']Failed
overlap and multiplicity['a']['a', 'c']Failed

SHA-256 / 994ae2cdaa4ca14a11d39e24bb7c640e2d4fb5837575b0a5e7b0e8ae3d89a83d

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 dict.fromkeys(x+y) if (v in x)!=(v in 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']), ['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 fixtureActualExpectedOutcome
both empty[][]Passed
empty right operand['a']['a']Passed
empty left operand['b']['b']Passed
overlap and multiplicity['a', 'c']['a', 'c']Passed

SHA-256 / cd54218bbf6245f857f2d9eb6b95e10e546417a290d185277acc5a0a2b90eef9

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

Case digest / ae7e82f90580ad4bbc0a5f25539ea8c761c1d56856bcf914f3914524b9e8bbcc