FAILURE MAP
← Case archive

FA-100331 / Dataset deduplication grouping / Open access

Dataset deduplication: duplicate rows consume the result cap · case 01

duplicate rows consume the result cap.

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

ROOT CAUSE

The output limit is applied before exact duplicate removal.

THE FAILURE

The output limit is applied before exact duplicate removal.

Unsuccessful approach: Deduplicating with a last-write map changes which representatives survive.

Case contract

Rows [key,id]. Return first representatives for distinct keys, truncated to nonnegative limit.

Why this case matters

This deterministic toy operation makes one dataset equivalence or representative rule explicit.

1 / The failure

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

N = 1
observations = []
def solve(rows, limit):
    return [i for k,i in rows[:limit]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates before cap',solve([['a','a1'],['a','a2'],['b','b1']],2),['a1','b1'])
check('zero limit',solve([['a','a1']],0),[])
check('empty rows',solve([],N),[])
check('limit beyond unique',solve([['a','a1']],N+2),['a1'])
check('cap one',solve([['x','x1'],['x','x2'],['y','y1']],1),['x1'])
check('preserve order',solve([['b','b1'],['a','a1']],2),['b1','a1'])
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
duplicates before cap['a1', 'a2']['a1', 'b1']Failed
zero limit[][]Passed
empty rows[][]Passed
limit beyond unique['a1']['a1']Passed
cap one['x1']['x1']Passed
preserve order['b1', 'a1']['b1', 'a1']Passed

SHA-256 / b9c22df08d0d20d4acea0d8d5e22dfefcf2a7a9dfefb6a1a3dcb198d9d1e4f45

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows, limit):
    out={};
    for k,i in rows: out[k]=i
    return list(out.values())[:limit]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates before cap',solve([['a','a1'],['a','a2'],['b','b1']],2),['a1','b1'])
check('zero limit',solve([['a','a1']],0),[])
check('empty rows',solve([],N),[])
check('limit beyond unique',solve([['a','a1']],N+2),['a1'])
check('cap one',solve([['x','x1'],['x','x2'],['y','y1']],1),['x1'])
check('preserve order',solve([['b','b1'],['a','a1']],2),['b1','a1'])
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
duplicates before cap['a2', 'b1']['a1', 'b1']Failed
zero limit[][]Passed
empty rows[][]Passed
limit beyond unique['a1']['a1']Passed
cap one['x2']['x1']Failed
preserve order['b1', 'a1']['b1', 'a1']Passed

SHA-256 / 336e5ac78da35f128bbaaffef446d41f6dfb32f4d4fbd42f60e8ef9cf1ac1d47

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 6 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

Inputs are small in-memory fixtures with the stated contract; results do not claim production deduplication quality. 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-30T16:48:34.472025+00:00.

Case digest / 92eeeba928053adaf0bf38f93d7220d194ebdee307356cef2e74b3f6e4073293