FAILURE MAP
← Case archive

FA-100266 / Dataset deduplication grouping / Open access

Dataset deduplication: later duplicate replaces the first source record · case 01

later duplicate replaces the first source record.

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

ROOT CAUSE

A last-write mapping is used where source order defines the representative.

THE FAILURE

A last-write mapping is used where source order defines the representative.

Unsuccessful approach: Sorting by key before retention changes the source-order representative.

Case contract

Rows are [key,id] in source order. Return representative IDs in first-key encounter order.

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):
    return list(dict((k,i) for k,i in rows).values())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('later duplicate',solve([['k','first'],['k','later']]),['first'])
check('encounter order',solve([['b','B'],['a','A']]),['B','A'])
check('empty',solve([]),[])
check('single row',solve([['x','X']]),['X'])
check('separated duplicate',solve([['a','A'],['b','B'],['a','A2']]),['A','B'])
check('N repeats',solve([['k',str(i)] for i in range(N)]),['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 fixtureActualExpectedOutcome
later duplicate['later']['first']Failed
encounter order['B', 'A']['B', 'A']Passed
empty[][]Passed
single row['X']['X']Passed
separated duplicate['A2', 'B']['A', 'B']Failed
N repeats['0']['0']Passed

SHA-256 / 309a54805a421b8133c734a31590d9f9f372763daffedc0cc9b80ad894ce1466

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows):
    out={};
    for k,i in sorted(rows): out.setdefault(k,i)
    return list(out.values())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('later duplicate',solve([['k','first'],['k','later']]),['first'])
check('encounter order',solve([['b','B'],['a','A']]),['B','A'])
check('empty',solve([]),[])
check('single row',solve([['x','X']]),['X'])
check('separated duplicate',solve([['a','A'],['b','B'],['a','A2']]),['A','B'])
check('N repeats',solve([['k',str(i)] for i in range(N)]),['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 fixtureActualExpectedOutcome
later duplicate['first']['first']Passed
encounter order['A', 'B']['B', 'A']Failed
empty[][]Passed
single row['X']['X']Passed
separated duplicate['A', 'B']['A', 'B']Passed
N repeats['0']['0']Passed

SHA-256 / f794a667a8724b157dea1bc880cd39e58debaf986b3130be8c5c2be881252e2a

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

Case digest / 9ca354d41aaacbe1f910ad0f7c15fcda43a4660b96e6f4e2b56a232f8f1ffd8f