FA-60635 / Loyalty points ledgers / Member archive
Idempotent points event ledger: single reversal guard · case 05
The same earn can be reversed repeatedly, draining the balance.
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 fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| double reverse | {"applied": ["e1", "r1", "r2"], "balance": -65, "rejected": ["r3"]} | {"applied": ["e1", "r1"], "balance": 0, "rejected": ["r2", "r3"]} | 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 ↗