FA-131 / Storage and queries / Open access
A composite uniqueness check rejects SQL-valid nullable keys · case 01
Repeated tuples containing an unknown component are rejected as duplicate composite keys.
ROOT CAUSE
Python tuple equality is used for a SQL UNIQUE contract under which a NULL in any component prevents equality conflicts.
THE FAILURE
Python tuple equality is used for a SQL UNIQUE contract under which a NULL in any component prevents equality conflicts.
Unsuccessful approach: Exempting only a NULL in the first column still treats a NULL in the second column as an equal comparable value.
Case contract
Return whether a list of two-component keys satisfies ordinary NULL-distinct SQL UNIQUE semantics: two rows conflict only when both components in both rows are non-NULL and equal. None represents SQL NULL.
Why this case matters
Isolates a storage constraint's comparison contract. Some engines offer NULLS NOT DISTINCT constraints; that alternate contract is explicitly outside this experiment, so the model does not label it a database bug.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows):
return len(set(map(tuple, rows))) == len(rows)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown second component can repeat', solve([[N, None], [N, None]]), True)
check('unknown first component can repeat', solve([[None, N], [None, N]]), True)
check('both components unknown can repeat', solve([[None, None]] * (N+1)), True)
check('fully known repeated key conflicts', solve([[N, N+1], [N, N+1]]), False)
check('known zero is not unknown', solve([[N, 0], [N, 0], [None, 0]]), False)
check('different complete tuples coexist', solve([[N, N+1], [N, N+2], [N+1, N+1]]), True)
check('empty relation satisfies uniqueness', solve([]), True)
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 |
|---|---|---|---|
| unknown second component can repeat | False | True | Failed |
| unknown first component can repeat | False | True | Failed |
| both components unknown can repeat | False | True | Failed |
| fully known repeated key conflicts | False | False | Passed |
| known zero is not unknown | False | False | Passed |
| different complete tuples coexist | True | True | Passed |
| empty relation satisfies uniqueness | True | True | Passed |
SHA-256 / 6db7713cbba3e546dfc5ae29cb02eaed0d786da4e5e8a88aa619e37fca0c2125
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows):
comparable = [tuple(row) for row in rows if row[0] is not None]
return len(set(comparable)) == len(comparable)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown second component can repeat', solve([[N, None], [N, None]]), True)
check('unknown first component can repeat', solve([[None, N], [None, N]]), True)
check('both components unknown can repeat', solve([[None, None]] * (N+1)), True)
check('fully known repeated key conflicts', solve([[N, N+1], [N, N+1]]), False)
check('known zero is not unknown', solve([[N, 0], [N, 0], [None, 0]]), False)
check('different complete tuples coexist', solve([[N, N+1], [N, N+2], [N+1, N+1]]), True)
check('empty relation satisfies uniqueness', solve([]), True)
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 |
|---|---|---|---|
| unknown second component can repeat | False | True | Failed |
| unknown first component can repeat | True | True | Passed |
| both components unknown can repeat | True | True | Passed |
| fully known repeated key conflicts | False | False | Passed |
| known zero is not unknown | False | False | Passed |
| different complete tuples coexist | True | True | Passed |
| empty relation satisfies uniqueness | True | True | Passed |
SHA-256 / 84c1b6d242630d1df6c56e5f70497b1128e7d3328dcc66f07878480fb816a966
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:36:50.519359+00:00.
Case digest / b09f31b7291d2af5137f560d1f5211cfdc9c6c07890b25e7aa48718cce73e973