FAILURE MAP
← Case archive

FA-4576 / Iterator consumption / Open access

Tee branches have independent cursors · case 01

The operation returns a result or retained state that violates this contract: Advance the first tee branch n positions; the second still yields the entire original stream.

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

ROOT CAUSE

Both consumers share the same iterator object and advance one cursor.

THE FAILURE

Both consumers share the same iterator object and advance one cursor.

Unsuccessful approach: Skipping the consumed prefix on the second tee branch discards its buffered independent history.

Case contract

Advance the first tee branch n positions; the second still yields the entire original stream. 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):
    a=b=iter(x); p=list(it.islice(a,y)); return [p,list(b),list(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('branch lag', solve(['a', 'b', 'c'], 1), [['a'], ['a', 'b', 'c'], ['b', 'c']])
check('zero prefix', solve(['a'], 0), [[], ['a'], ['a']])
check('first exhausts', solve(['a'], 5), [['a'], ['a'], []])
check('empty', solve([], 2), [[], [], []])
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
branch lag[['a'], ['b', 'c'], []][['a'], ['a', 'b', 'c'], ['b', 'c']]Failed
zero prefix[[], ['a'], []][[], ['a'], ['a']]Failed
first exhausts[['a'], [], []][['a'], ['a'], []]Failed
empty[[], [], []][[], [], []]Passed

SHA-256 / fee37eebf544fa7d560f15489873d9948eb3289c601f6f5a5bfd3d58a5236012

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):
    a,b=it.tee(iter(x)); p=list(it.islice(a,y)); return [p,list(it.islice(b,y,None)),list(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('branch lag', solve(['a', 'b', 'c'], 1), [['a'], ['a', 'b', 'c'], ['b', 'c']])
check('zero prefix', solve(['a'], 0), [[], ['a'], ['a']])
check('first exhausts', solve(['a'], 5), [['a'], ['a'], []])
check('empty', solve([], 2), [[], [], []])
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
branch lag[['a'], ['b', 'c'], ['b', 'c']][['a'], ['a', 'b', 'c'], ['b', 'c']]Failed
zero prefix[[], ['a'], ['a']][[], ['a'], ['a']]Passed
first exhausts[['a'], [], []][['a'], ['a'], []]Failed
empty[[], [], []][[], [], []]Passed

SHA-256 / e0e9e455bd8638b0a7ec966b684bdf7556ffa5805d34282fbe247b1d1c37de7c

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 4 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:37:40.686160+00:00.

Case digest / 8a9b52a572b75c519e58ba994d3090e5c8b269fc3cb32d0414590d98e044f0df