FA-4246 / Collection algebra / Open access
Left semijoin preserves left duplicates · case 01
The operation returns a result or retained state that violates this contract: Retain every left occurrence whose value occurs anywhere in right.
ROOT CAUSE
Distinct-value conversion discards repeated matching left occurrences.
VERIFIED REPAIR
Retain every left occurrence whose value occurs anywhere in right.
Unsuccessful approach: Returning matching right values changes the source multiplicity.
Case contract
Retain every left occurrence whose value occurs anywhere in 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 list(dict.fromkeys(v for v in x if 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'], []), [])
check('empty left operand', solve([], ['b']), [])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['b', 'b'])
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 | [] | [] | Passed |
| empty left operand | [] | [] | Passed |
| overlap and multiplicity | ['b'] | ['b', 'b'] | Failed |
SHA-256 / ca52e0391a3e98bbba2cc399cde21fc4bd06c5c0f09667f87d4786d5e4785e7a
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 y if v in 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'], []), [])
check('empty left operand', solve([], ['b']), [])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['b', 'b'])
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 | [] | [] | Passed |
| empty left operand | [] | [] | Passed |
| overlap and multiplicity | ['b'] | ['b', 'b'] | Failed |
SHA-256 / 193167f68055aaa6bba30548b9038599470a15fd59abe399f01a83c5ffa61352
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 x if 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'], []), [])
check('empty left operand', solve([], ['b']), [])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['b', 'b'])
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 | [] | [] | Passed |
| empty left operand | [] | [] | Passed |
| overlap and multiplicity | ['b', 'b'] | ['b', 'b'] | Passed |
SHA-256 / aca288e46645dbce2cff34a3188b7b19bb15038797a64d0890fd88d8c751d509
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.182249+00:00.
Case digest / aa20f7a7f5262fcc8a79930bcdc7ae6027ac462eb7739ddc79cd20b34cfc9ef7