FAILURE MAP
← Case archive

FA-4566 / Iterator consumption / Open access

Groupby adjacency not global key · case 01

The operation returns a result or retained state that violates this contract: Group consecutive equal values into [key,group] pairs; separated equal runs remain separate.

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

ROOT CAUSE

Global key grouping merges separate adjacent runs with the same key.

VERIFIED REPAIR

Group consecutive equal values into [key,group] pairs; separated equal runs remain separate.

Unsuccessful approach: Sorting first changes run order and merges separated runs.

Case contract

Group consecutive equal values into [key,group] pairs; separated equal runs remain separate. 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
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
    return [[k,[v for v in x if v==k]] for k in dict.fromkeys(x)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separate equal runs', solve(['a', 'b', 'a']), [['a', ['a']], ['b', ['b']], ['a', ['a']]])
check('same run', solve(['a', 'a']), [['a', ['a', 'a']]])
check('empty', solve([]), [])
check('nonlexical runs', solve(['b', 'b', 'a']), [['b', ['b', 'b']], ['a', ['a']]])
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
separate equal runs[['a', ['a', 'a']], ['b', ['b']]][['a', ['a']], ['b', ['b']], ['a', ['a']]]Failed
same run[['a', ['a', 'a']]][['a', ['a', 'a']]]Passed
empty[][]Passed
nonlexical runs[['b', ['b', 'b']], ['a', ['a']]][['b', ['b', 'b']], ['a', ['a']]]Passed

SHA-256 / e3f594f64e5e2768af81025c2deb675c3ff96ac1243249e3cb3ef7814e478a35

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
    return [[k,list(g)] for k,g in it.groupby(sorted(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separate equal runs', solve(['a', 'b', 'a']), [['a', ['a']], ['b', ['b']], ['a', ['a']]])
check('same run', solve(['a', 'a']), [['a', ['a', 'a']]])
check('empty', solve([]), [])
check('nonlexical runs', solve(['b', 'b', 'a']), [['b', ['b', 'b']], ['a', ['a']]])
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
separate equal runs[['a', ['a', 'a']], ['b', ['b']]][['a', ['a']], ['b', ['b']], ['a', ['a']]]Failed
same run[['a', ['a', 'a']]][['a', ['a', 'a']]]Passed
empty[][]Passed
nonlexical runs[['a', ['a']], ['b', ['b', 'b']]][['b', ['b', 'b']], ['a', ['a']]]Failed

SHA-256 / 2600f5018aeb9d7ee35e466d9eb69c2fe013789ead8a71e8de0d4c3d06939a77

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import itertools as it
from collections import deque
N = 1
observations = []
def solve(x, y=None):
    return [[k,list(g)] for k,g in it.groupby(x)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separate equal runs', solve(['a', 'b', 'a']), [['a', ['a']], ['b', ['b']], ['a', ['a']]])
check('same run', solve(['a', 'a']), [['a', ['a', 'a']]])
check('empty', solve([]), [])
check('nonlexical runs', solve(['b', 'b', 'a']), [['b', ['b', 'b']], ['a', ['a']]])
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
separate equal runs[['a', ['a']], ['b', ['b']], ['a', ['a']]][['a', ['a']], ['b', ['b']], ['a', ['a']]]Passed
same run[['a', ['a', 'a']]][['a', ['a', 'a']]]Passed
empty[][]Passed
nonlexical runs[['b', ['b', 'b']], ['a', ['a']]][['b', ['b', 'b']], ['a', ['a']]]Passed

SHA-256 / f87a0df2d0bc25cb955717e1b9ee9120a0fb15cf62bbc8417dc387ca9ba60464

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

Case digest / 23ab10db08177b660acb1ce37cb85ffc3eeac297ad83e4c37149dfce18f3603a