FAILURE MAP
← Case archive

FA-011 / Data systems / Open access

A cursor skips records with equal sort keys · case 01

The next page omits records sharing the final sort key of the previous page.

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

ROOT CAUSE

The cursor stores the primary sort key but omits its stable tie breaker.

VERIFIED REPAIR

Compare the complete ordered key, including the unique record identifier.

Unsuccessful approach: Using an inclusive primary-key comparison repeats records already delivered.

Case contract

Compare the complete ordered key, including the unique record identifier.

Why this case matters

A compact reasoning and repair task with executable evidence.

1 / The failure

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

N = 1
observations = []
def solve(rows, cursor):
    return [r for r in rows if r[0] > cursor[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows = [[N, 1], [N, 2], [N+1, 3]]
check('tied next record', solve(rows, [N, 1]), rows[1:])
check('last record', solve(rows, [N+1, 3]), [])
check('before first', solve(rows, [N-1, 0]), rows)
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
tied next record[[2, 3]][[1, 2], [2, 3]]Failed
last record[][]Passed
before first[[1, 1], [1, 2], [2, 3]][[1, 1], [1, 2], [2, 3]]Passed

SHA-256 / d437cd350107b431811e96b6c1484c26825a540dce4b28985fe8a922ad2289d0

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows, cursor):
    return [r for r in rows if r[0] >= cursor[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows = [[N, 1], [N, 2], [N+1, 3]]
check('tied next record', solve(rows, [N, 1]), rows[1:])
check('last record', solve(rows, [N+1, 3]), [])
check('before first', solve(rows, [N-1, 0]), rows)
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
tied next record[[1, 1], [1, 2], [2, 3]][[1, 2], [2, 3]]Failed
last record[[2, 3]][]Failed
before first[[1, 1], [1, 2], [2, 3]][[1, 1], [1, 2], [2, 3]]Passed

SHA-256 / 7bd74a1728775f33fdc9535bbd3f99ab9cec85694979b43bf0c6257cf4a4232f

3 / The verified repair

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

N = 1
observations = []
def solve(rows, cursor):
    return [r for r in rows if tuple(r) > tuple(cursor)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
rows = [[N, 1], [N, 2], [N+1, 3]]
check('tied next record', solve(rows, [N, 1]), rows[1:])
check('last record', solve(rows, [N+1, 3]), [])
check('before first', solve(rows, [N-1, 0]), rows)
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
tied next record[[1, 2], [2, 3]][[1, 2], [2, 3]]Passed
last record[][]Passed
before first[[1, 1], [1, 2], [2, 3]][[1, 1], [1, 2], [2, 3]]Passed

SHA-256 / da0ab4e3db1f0c937e6b1773b544689edcd5ceb82852f2b3e982962de8b34b80

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

Case digest / 42ec68c8b0917bdcac3ec1bf7a1fb11874f2da91451a7a6ad37c758520fe2f41