FAILURE MAP
← Case archive

FA-156 / Storage and queries / Open access

String-encoded composite keys merge unrelated groups · case 01

Distinct two-column groups collapse together because their concatenated or delimiter-separated key strings coincide.

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

ROOT CAUSE

A lossy serialization is used as group identity without escaping delimiters or preserving component boundaries.

VERIFIED REPAIR

Use the two original string components as a tuple key and retain their separate identities in the output.

Unsuccessful approach: Adding a delimiter only works when inputs cannot contain that delimiter; arbitrary strings still collide.

Case contract

Rows contain [first_string,second_string,integer_amount]. Group by exact ordered pairs and return sorted [first,second,total] rows. Components may be empty or contain delimiter characters; input occurrences are all counted.

Why this case matters

Models compound keys in aggregation caches and client-side query engines. The fixtures expose both simple concatenation collisions and delimiter collisions without relying on hash collisions or randomized behavior.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows):
    groups = {}
    for first, second, amount in rows:
        key = first + second
        if key not in groups:
            groups[key] = [first, second, 0]
        groups[key][2] += amount
    return sorted(groups.values())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unseparated component boundaries collide', solve([['ab', 'c', N], ['a', 'bc', N+1]]), [['a', 'bc', N+1], ['ab', 'c', N]])
check('delimiter occurs inside either component', solve([['a|b', 'c', N], ['a', 'b|c', N+1]]), [['a', 'b|c', N+1], ['a|b', 'c', N]])
check('empty components are ordered, not interchangeable', solve([['', 'x', N], ['x', '', N+1]]), [['', 'x', N], ['x', '', N+1]])
check('delimiter-only boundaries remain distinct', solve([['|', '', N], ['', '|', 2*N]]), [['', '|', 2*N], ['|', '', N]])
check('identical composite keys aggregate', solve([['team', str(N), N], ['team', str(N), N+2]]), [['team', str(N), 2*N+2]])
check('signed contributions stay within their group', solve([['a', 'b', N], ['a', 'b', -N], ['a', 'c', 2*N]]), [['a', 'b', 0], ['a', 'c', 2*N]])
check('empty relation', solve([]), [])
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
unseparated component boundaries collide[['ab', 'c', 3]][['a', 'bc', 2], ['ab', 'c', 1]]Failed
delimiter occurs inside either component[['a', 'b|c', 2], ['a|b', 'c', 1]][['a', 'b|c', 2], ['a|b', 'c', 1]]Passed
empty components are ordered, not interchangeable[['', 'x', 3]][['', 'x', 1], ['x', '', 2]]Failed
delimiter-only boundaries remain distinct[['|', '', 3]][['', '|', 2], ['|', '', 1]]Failed
identical composite keys aggregate[['team', '1', 4]][['team', '1', 4]]Passed
signed contributions stay within their group[['a', 'b', 0], ['a', 'c', 2]][['a', 'b', 0], ['a', 'c', 2]]Passed
empty relation[][]Passed

SHA-256 / 2db9f43033f2d61c0ca37f99172329b6b7ee4a841da186134cb257bc0092f7b5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows):
    groups = {}
    for first, second, amount in rows:
        key = first + '|' + second
        if key not in groups:
            groups[key] = [first, second, 0]
        groups[key][2] += amount
    return sorted(groups.values())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unseparated component boundaries collide', solve([['ab', 'c', N], ['a', 'bc', N+1]]), [['a', 'bc', N+1], ['ab', 'c', N]])
check('delimiter occurs inside either component', solve([['a|b', 'c', N], ['a', 'b|c', N+1]]), [['a', 'b|c', N+1], ['a|b', 'c', N]])
check('empty components are ordered, not interchangeable', solve([['', 'x', N], ['x', '', N+1]]), [['', 'x', N], ['x', '', N+1]])
check('delimiter-only boundaries remain distinct', solve([['|', '', N], ['', '|', 2*N]]), [['', '|', 2*N], ['|', '', N]])
check('identical composite keys aggregate', solve([['team', str(N), N], ['team', str(N), N+2]]), [['team', str(N), 2*N+2]])
check('signed contributions stay within their group', solve([['a', 'b', N], ['a', 'b', -N], ['a', 'c', 2*N]]), [['a', 'b', 0], ['a', 'c', 2*N]])
check('empty relation', solve([]), [])
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
unseparated component boundaries collide[['a', 'bc', 2], ['ab', 'c', 1]][['a', 'bc', 2], ['ab', 'c', 1]]Passed
delimiter occurs inside either component[['a|b', 'c', 3]][['a', 'b|c', 2], ['a|b', 'c', 1]]Failed
empty components are ordered, not interchangeable[['', 'x', 1], ['x', '', 2]][['', 'x', 1], ['x', '', 2]]Passed
delimiter-only boundaries remain distinct[['|', '', 3]][['', '|', 2], ['|', '', 1]]Failed
identical composite keys aggregate[['team', '1', 4]][['team', '1', 4]]Passed
signed contributions stay within their group[['a', 'b', 0], ['a', 'c', 2]][['a', 'b', 0], ['a', 'c', 2]]Passed
empty relation[][]Passed

SHA-256 / a8e216e9981c196b06ee04d592d3d7e0a3d9c0184de175d06ce3369fff3259e7

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows):
    groups = {}
    for first, second, amount in rows:
        key = (first, second)
        if key not in groups:
            groups[key] = [first, second, 0]
        groups[key][2] += amount
    return sorted(groups.values())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unseparated component boundaries collide', solve([['ab', 'c', N], ['a', 'bc', N+1]]), [['a', 'bc', N+1], ['ab', 'c', N]])
check('delimiter occurs inside either component', solve([['a|b', 'c', N], ['a', 'b|c', N+1]]), [['a', 'b|c', N+1], ['a|b', 'c', N]])
check('empty components are ordered, not interchangeable', solve([['', 'x', N], ['x', '', N+1]]), [['', 'x', N], ['x', '', N+1]])
check('delimiter-only boundaries remain distinct', solve([['|', '', N], ['', '|', 2*N]]), [['', '|', 2*N], ['|', '', N]])
check('identical composite keys aggregate', solve([['team', str(N), N], ['team', str(N), N+2]]), [['team', str(N), 2*N+2]])
check('signed contributions stay within their group', solve([['a', 'b', N], ['a', 'b', -N], ['a', 'c', 2*N]]), [['a', 'b', 0], ['a', 'c', 2*N]])
check('empty relation', solve([]), [])
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
unseparated component boundaries collide[['a', 'bc', 2], ['ab', 'c', 1]][['a', 'bc', 2], ['ab', 'c', 1]]Passed
delimiter occurs inside either component[['a', 'b|c', 2], ['a|b', 'c', 1]][['a', 'b|c', 2], ['a|b', 'c', 1]]Passed
empty components are ordered, not interchangeable[['', 'x', 1], ['x', '', 2]][['', 'x', 1], ['x', '', 2]]Passed
delimiter-only boundaries remain distinct[['', '|', 2], ['|', '', 1]][['', '|', 2], ['|', '', 1]]Passed
identical composite keys aggregate[['team', '1', 4]][['team', '1', 4]]Passed
signed contributions stay within their group[['a', 'b', 0], ['a', 'c', 2]][['a', 'b', 0], ['a', 'c', 2]]Passed
empty relation[][]Passed

SHA-256 / 9ed01820ab1d31e043f730b7b347f544d27141e475a33bac0701902e91a93b92

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

Case digest / 9fbdf33e253b53c132c3c407089e1c8103921611185c85fc5ab99b982779e2b7