FA-44866 / Data systems / Open access
Grouping expansion leaks source keys into rolled-up slots · case 01
Grouping expansion leaks source keys into rolled-up slots.
ROOT CAUSE
grouping-set-expansion: Grouping expansion leaks source keys into rolled-up slots.
VERIFIED REPAIR
Preserve the stated physical representation and operation order: Expand every fact [a,b,payload] once per supplied grouping-set list of column positions. Emit [projected-a,projected-b,grouping-mask,payload], using None for omitted keys and bit 1 for omitted a, bit 2 for omitted b. Preserve duplicate grouping sets and null source keys.
Unsuccessful approach: Zero is not the null placeholder for an omitted dimension.
Case contract
Expand every fact [a,b,payload] once per supplied grouping-set list of column positions. Emit [projected-a,projected-b,grouping-mask,payload], using None for omitted keys and bit 1 for omitted a, bit 2 for omitted b. Preserve duplicate grouping sets and null source keys.
Why this case matters
A bounded deterministic data engine model makes representation and changelog faults reproducible.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
rows,sets=d
out=[]
for group in sets:
for a,b,value in rows:
keys=[a,b]
projected=keys
mask=sum(1<<i for i in range(2) if i not in group)
out.append(projected+[mask,value])
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('one dimension', solve([[['a', 'b', 1]], [[0]]]), [['a', None, 2, 1]])
check('other dimension', solve([[['a', 'b', 1]], [[1]]]), [[None, 'b', 1, 1]])
check('real null key', solve([[[None, 'b', 1]], [[0, 1]]]), [[None, 'b', 0, 1]])
check('grand total row', solve([[['a', 'b', 1]], [[]]]), [[None, None, 3, 1]])
check('duplicate sets', solve([[['a', 'b', 1]], [[0], [0]]]), [['a', None, 2, 1], ['a', None, 2, 1]])
check('duplicate facts', solve([[['a', 'b', 1], ['a', 'b', 1]], [[0, 1]]]), [['a', 'b', 0, 1], ['a', 'b', 0, 1]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 2:
check('one dimension', solve([[['a', 'b', 2]], [[0]]]), [['a', None, 2, 2]])
check('other dimension', solve([[['a', 'b', 2]], [[1]]]), [[None, 'b', 1, 2]])
check('real null key', solve([[[None, 'b', 2]], [[0, 1]]]), [[None, 'b', 0, 2]])
check('grand total row', solve([[['a', 'b', 2]], [[]]]), [[None, None, 3, 2]])
check('duplicate sets', solve([[['a', 'b', 2]], [[0], [0]]]), [['a', None, 2, 2], ['a', None, 2, 2]])
check('duplicate facts', solve([[['a', 'b', 2], ['a', 'b', 2]], [[0, 1]]]), [['a', 'b', 0, 2], ['a', 'b', 0, 2]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 3:
check('one dimension', solve([[['a', 'b', 3]], [[0]]]), [['a', None, 2, 3]])
check('other dimension', solve([[['a', 'b', 3]], [[1]]]), [[None, 'b', 1, 3]])
check('real null key', solve([[[None, 'b', 3]], [[0, 1]]]), [[None, 'b', 0, 3]])
check('grand total row', solve([[['a', 'b', 3]], [[]]]), [[None, None, 3, 3]])
check('duplicate sets', solve([[['a', 'b', 3]], [[0], [0]]]), [['a', None, 2, 3], ['a', None, 2, 3]])
check('duplicate facts', solve([[['a', 'b', 3], ['a', 'b', 3]], [[0, 1]]]), [['a', 'b', 0, 3], ['a', 'b', 0, 3]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 4:
check('one dimension', solve([[['a', 'b', 4]], [[0]]]), [['a', None, 2, 4]])
check('other dimension', solve([[['a', 'b', 4]], [[1]]]), [[None, 'b', 1, 4]])
check('real null key', solve([[[None, 'b', 4]], [[0, 1]]]), [[None, 'b', 0, 4]])
check('grand total row', solve([[['a', 'b', 4]], [[]]]), [[None, None, 3, 4]])
check('duplicate sets', solve([[['a', 'b', 4]], [[0], [0]]]), [['a', None, 2, 4], ['a', None, 2, 4]])
check('duplicate facts', solve([[['a', 'b', 4], ['a', 'b', 4]], [[0, 1]]]), [['a', 'b', 0, 4], ['a', 'b', 0, 4]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 5:
check('one dimension', solve([[['a', 'b', 5]], [[0]]]), [['a', None, 2, 5]])
check('other dimension', solve([[['a', 'b', 5]], [[1]]]), [[None, 'b', 1, 5]])
check('real null key', solve([[[None, 'b', 5]], [[0, 1]]]), [[None, 'b', 0, 5]])
check('grand total row', solve([[['a', 'b', 5]], [[]]]), [[None, None, 3, 5]])
check('duplicate sets', solve([[['a', 'b', 5]], [[0], [0]]]), [['a', None, 2, 5], ['a', None, 2, 5]])
check('duplicate facts', solve([[['a', 'b', 5], ['a', 'b', 5]], [[0, 1]]]), [['a', 'b', 0, 5], ['a', 'b', 0, 5]])
check('empty facts', solve([[], [[0], []]]), [])
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 |
|---|---|---|---|
| one dimension | [['a', 'b', 2, 1]] | [['a', None, 2, 1]] | Failed |
| other dimension | [['a', 'b', 1, 1]] | [[None, 'b', 1, 1]] | Failed |
| real null key | [[None, 'b', 0, 1]] | [[None, 'b', 0, 1]] | Passed |
| grand total row | [['a', 'b', 3, 1]] | [[None, None, 3, 1]] | Failed |
| duplicate sets | [['a', 'b', 2, 1], ['a', 'b', 2, 1]] | [['a', None, 2, 1], ['a', None, 2, 1]] | Failed |
| duplicate facts | [['a', 'b', 0, 1], ['a', 'b', 0, 1]] | [['a', 'b', 0, 1], ['a', 'b', 0, 1]] | Passed |
| empty facts | [] | [] | Passed |
SHA-256 / af179ce896ce5fcff4ae3c1a825593d669b264b63ec6f572f57873634f36865f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
rows,sets=d
out=[]
for group in sets:
for a,b,value in rows:
keys=[a,b]
projected=[keys[i] if i in group else 0 for i in range(2)]
mask=sum(1<<i for i in range(2) if i not in group)
out.append(projected+[mask,value])
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('one dimension', solve([[['a', 'b', 1]], [[0]]]), [['a', None, 2, 1]])
check('other dimension', solve([[['a', 'b', 1]], [[1]]]), [[None, 'b', 1, 1]])
check('real null key', solve([[[None, 'b', 1]], [[0, 1]]]), [[None, 'b', 0, 1]])
check('grand total row', solve([[['a', 'b', 1]], [[]]]), [[None, None, 3, 1]])
check('duplicate sets', solve([[['a', 'b', 1]], [[0], [0]]]), [['a', None, 2, 1], ['a', None, 2, 1]])
check('duplicate facts', solve([[['a', 'b', 1], ['a', 'b', 1]], [[0, 1]]]), [['a', 'b', 0, 1], ['a', 'b', 0, 1]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 2:
check('one dimension', solve([[['a', 'b', 2]], [[0]]]), [['a', None, 2, 2]])
check('other dimension', solve([[['a', 'b', 2]], [[1]]]), [[None, 'b', 1, 2]])
check('real null key', solve([[[None, 'b', 2]], [[0, 1]]]), [[None, 'b', 0, 2]])
check('grand total row', solve([[['a', 'b', 2]], [[]]]), [[None, None, 3, 2]])
check('duplicate sets', solve([[['a', 'b', 2]], [[0], [0]]]), [['a', None, 2, 2], ['a', None, 2, 2]])
check('duplicate facts', solve([[['a', 'b', 2], ['a', 'b', 2]], [[0, 1]]]), [['a', 'b', 0, 2], ['a', 'b', 0, 2]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 3:
check('one dimension', solve([[['a', 'b', 3]], [[0]]]), [['a', None, 2, 3]])
check('other dimension', solve([[['a', 'b', 3]], [[1]]]), [[None, 'b', 1, 3]])
check('real null key', solve([[[None, 'b', 3]], [[0, 1]]]), [[None, 'b', 0, 3]])
check('grand total row', solve([[['a', 'b', 3]], [[]]]), [[None, None, 3, 3]])
check('duplicate sets', solve([[['a', 'b', 3]], [[0], [0]]]), [['a', None, 2, 3], ['a', None, 2, 3]])
check('duplicate facts', solve([[['a', 'b', 3], ['a', 'b', 3]], [[0, 1]]]), [['a', 'b', 0, 3], ['a', 'b', 0, 3]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 4:
check('one dimension', solve([[['a', 'b', 4]], [[0]]]), [['a', None, 2, 4]])
check('other dimension', solve([[['a', 'b', 4]], [[1]]]), [[None, 'b', 1, 4]])
check('real null key', solve([[[None, 'b', 4]], [[0, 1]]]), [[None, 'b', 0, 4]])
check('grand total row', solve([[['a', 'b', 4]], [[]]]), [[None, None, 3, 4]])
check('duplicate sets', solve([[['a', 'b', 4]], [[0], [0]]]), [['a', None, 2, 4], ['a', None, 2, 4]])
check('duplicate facts', solve([[['a', 'b', 4], ['a', 'b', 4]], [[0, 1]]]), [['a', 'b', 0, 4], ['a', 'b', 0, 4]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 5:
check('one dimension', solve([[['a', 'b', 5]], [[0]]]), [['a', None, 2, 5]])
check('other dimension', solve([[['a', 'b', 5]], [[1]]]), [[None, 'b', 1, 5]])
check('real null key', solve([[[None, 'b', 5]], [[0, 1]]]), [[None, 'b', 0, 5]])
check('grand total row', solve([[['a', 'b', 5]], [[]]]), [[None, None, 3, 5]])
check('duplicate sets', solve([[['a', 'b', 5]], [[0], [0]]]), [['a', None, 2, 5], ['a', None, 2, 5]])
check('duplicate facts', solve([[['a', 'b', 5], ['a', 'b', 5]], [[0, 1]]]), [['a', 'b', 0, 5], ['a', 'b', 0, 5]])
check('empty facts', solve([[], [[0], []]]), [])
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 |
|---|---|---|---|
| one dimension | [['a', 0, 2, 1]] | [['a', None, 2, 1]] | Failed |
| other dimension | [[0, 'b', 1, 1]] | [[None, 'b', 1, 1]] | Failed |
| real null key | [[None, 'b', 0, 1]] | [[None, 'b', 0, 1]] | Passed |
| grand total row | [[0, 0, 3, 1]] | [[None, None, 3, 1]] | Failed |
| duplicate sets | [['a', 0, 2, 1], ['a', 0, 2, 1]] | [['a', None, 2, 1], ['a', None, 2, 1]] | Failed |
| duplicate facts | [['a', 'b', 0, 1], ['a', 'b', 0, 1]] | [['a', 'b', 0, 1], ['a', 'b', 0, 1]] | Passed |
| empty facts | [] | [] | Passed |
SHA-256 / 4473f48c802c7b3e51dbb57d8eca38473ef112b2a98879b7418d80a1f14ff797
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
rows,sets=d
out=[]
for group in sets:
for a,b,value in rows:
keys=[a,b]
projected=[keys[i] if i in group else None for i in range(2)]
mask=sum(1<<i for i in range(2) if i not in group)
out.append(projected+[mask,value])
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('one dimension', solve([[['a', 'b', 1]], [[0]]]), [['a', None, 2, 1]])
check('other dimension', solve([[['a', 'b', 1]], [[1]]]), [[None, 'b', 1, 1]])
check('real null key', solve([[[None, 'b', 1]], [[0, 1]]]), [[None, 'b', 0, 1]])
check('grand total row', solve([[['a', 'b', 1]], [[]]]), [[None, None, 3, 1]])
check('duplicate sets', solve([[['a', 'b', 1]], [[0], [0]]]), [['a', None, 2, 1], ['a', None, 2, 1]])
check('duplicate facts', solve([[['a', 'b', 1], ['a', 'b', 1]], [[0, 1]]]), [['a', 'b', 0, 1], ['a', 'b', 0, 1]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 2:
check('one dimension', solve([[['a', 'b', 2]], [[0]]]), [['a', None, 2, 2]])
check('other dimension', solve([[['a', 'b', 2]], [[1]]]), [[None, 'b', 1, 2]])
check('real null key', solve([[[None, 'b', 2]], [[0, 1]]]), [[None, 'b', 0, 2]])
check('grand total row', solve([[['a', 'b', 2]], [[]]]), [[None, None, 3, 2]])
check('duplicate sets', solve([[['a', 'b', 2]], [[0], [0]]]), [['a', None, 2, 2], ['a', None, 2, 2]])
check('duplicate facts', solve([[['a', 'b', 2], ['a', 'b', 2]], [[0, 1]]]), [['a', 'b', 0, 2], ['a', 'b', 0, 2]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 3:
check('one dimension', solve([[['a', 'b', 3]], [[0]]]), [['a', None, 2, 3]])
check('other dimension', solve([[['a', 'b', 3]], [[1]]]), [[None, 'b', 1, 3]])
check('real null key', solve([[[None, 'b', 3]], [[0, 1]]]), [[None, 'b', 0, 3]])
check('grand total row', solve([[['a', 'b', 3]], [[]]]), [[None, None, 3, 3]])
check('duplicate sets', solve([[['a', 'b', 3]], [[0], [0]]]), [['a', None, 2, 3], ['a', None, 2, 3]])
check('duplicate facts', solve([[['a', 'b', 3], ['a', 'b', 3]], [[0, 1]]]), [['a', 'b', 0, 3], ['a', 'b', 0, 3]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 4:
check('one dimension', solve([[['a', 'b', 4]], [[0]]]), [['a', None, 2, 4]])
check('other dimension', solve([[['a', 'b', 4]], [[1]]]), [[None, 'b', 1, 4]])
check('real null key', solve([[[None, 'b', 4]], [[0, 1]]]), [[None, 'b', 0, 4]])
check('grand total row', solve([[['a', 'b', 4]], [[]]]), [[None, None, 3, 4]])
check('duplicate sets', solve([[['a', 'b', 4]], [[0], [0]]]), [['a', None, 2, 4], ['a', None, 2, 4]])
check('duplicate facts', solve([[['a', 'b', 4], ['a', 'b', 4]], [[0, 1]]]), [['a', 'b', 0, 4], ['a', 'b', 0, 4]])
check('empty facts', solve([[], [[0], []]]), [])
elif N == 5:
check('one dimension', solve([[['a', 'b', 5]], [[0]]]), [['a', None, 2, 5]])
check('other dimension', solve([[['a', 'b', 5]], [[1]]]), [[None, 'b', 1, 5]])
check('real null key', solve([[[None, 'b', 5]], [[0, 1]]]), [[None, 'b', 0, 5]])
check('grand total row', solve([[['a', 'b', 5]], [[]]]), [[None, None, 3, 5]])
check('duplicate sets', solve([[['a', 'b', 5]], [[0], [0]]]), [['a', None, 2, 5], ['a', None, 2, 5]])
check('duplicate facts', solve([[['a', 'b', 5], ['a', 'b', 5]], [[0, 1]]]), [['a', 'b', 0, 5], ['a', 'b', 0, 5]])
check('empty facts', solve([[], [[0], []]]), [])
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 |
|---|---|---|---|
| one dimension | [['a', None, 2, 1]] | [['a', None, 2, 1]] | Passed |
| other dimension | [[None, 'b', 1, 1]] | [[None, 'b', 1, 1]] | Passed |
| real null key | [[None, 'b', 0, 1]] | [[None, 'b', 0, 1]] | Passed |
| grand total row | [[None, None, 3, 1]] | [[None, None, 3, 1]] | Passed |
| duplicate sets | [['a', None, 2, 1], ['a', None, 2, 1]] | [['a', None, 2, 1], ['a', None, 2, 1]] | Passed |
| duplicate facts | [['a', 'b', 0, 1], ['a', 'b', 0, 1]] | [['a', 'b', 0, 1], ['a', 'b', 0, 1]] | Passed |
| empty facts | [] | [] | Passed |
SHA-256 / bc39a0d1d21e843a73137e68f902c3168737ea2219ee433664e6490bf836de28
Verification & scope
Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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:44:16.521913+00:00.
Case digest / 653c0c2458a1af16502a3fc1e701839833ca312d9ac636134a705e2a8826751f