FAILURE MAP
← Case archive

FA-60617 / Loyalty points ledgers / Member archive

Idempotent points event ledger: dedupe before ordering · case 02

A redelivered earn with a later timestamp is applied at the wrong position.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

Case contract

Input {events:[{id,ts,type:"earn"|"redeem"|"reverse",pts,ref}]}. Duplicate ids are dropped keeping the first delivery in input order; survivors are applied sorted by (ts,id). Redeem requires balance >= pts or is rejected. Reverse undoes an applied earn or redeem once; unknown, rejected, already reversed, or reverse targets are rejected. Return {balance, rejected, applied}.

Why this case matters

Member point balances, statements and the program liability depend on this ledger rule.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
redelivered earlier ts{"applied": ["e1", "e2"], "balance": 12, "rejected": []}{"applied": ["e1"], "balance": 52, "rejected": ["e2"]}Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗