FA-60807 / Loyalty points ledgers / Member archive
Purchased points with volume bonus: limit breach handling · case 02
A request that would exceed the annual limit is silently trimmed to the remaining allowance.
Case contract
Input {requests:[pts], price_per_1000, tiers:[[min_base, bonus_bp]] ascending, annual_limit, bought_ytd}. Each request is floored to whole thousands ("too small" when that is 0). A request whose base would push purchased base points above annual_limit is rejected whole ("limit"); bonus points never count toward the limit. Bonus = floor(base*bp/10000) with bp from the highest tier whose min_base <= this request base. Price = base/1000*price_per_1000. Return {results:[[base,bonus,price]|reason], bought_ytd}.
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 |
|---|---|---|---|
| limit hit | {"bought_ytd": 70000, "results": [[30000, 7500, 30000], [30000, 7500, 30000], [5000, 500, 5000]]} | {"bought_ytd": 65000, "results": [[30000, 7500, 30000], [30000, 7500, 30000], "limit"]} | 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 ↗