FA-60736 / Loyalty points ledgers / Open access
Monthly promotional bonus cap: exempt bonus award · case 01
Exempt promotional bonus never reaches the member.
ROOT CAUSE
The per-transaction award omits exempt bonus.
VERIFIED REPAIR
Award base + capped bonus + exempt bonus.
Unsuccessful approach: Adding exempt bonus only to the total leaves each transaction award short.
Case contract
Input {cap, txns:[[yyyy-mm, base, bonus, exempt_bonus]]}. Base points are never capped. Regular bonus points are capped per calendar month: each transaction receives min(bonus, cap - bonus already awarded that month). Exempt bonus is always awarded and never uses the cap. Return {awards (base + awarded bonus + exempt per txn), total}.
Why this case matters
Member point balances, statements and the program liability depend on this ledger rule.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
used = {}
out = []
for m, base, bonus, exempt in x['txns']:
k = m
rem = x['cap'] - used.get(k, 0)
b = min(bonus, rem)
used[k] = used.get(k, 0) + b
out.append(base + b)
return {'awards': out, 'total': sum(out)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2501, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1001, 0]]}, {'awards': [5000, 1001], 'total': 6001}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 901, 0]]}, {'awards': [905, 906], 'total': 1811}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 401, 0]]}, {'awards': [2400, 601], 'total': 3001}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 301, 0]]}, {'awards': [5600, 3301], 'total': 8901}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 251], ['2024-05', 1, 90, 0]]}, {'awards': [252, 91], 'total': 343}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 101, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2502, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1002, 0]]}, {'awards': [5000, 1002], 'total': 6002}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 902, 0]]}, {'awards': [905, 907], 'total': 1812}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 402, 0]]}, {'awards': [2400, 602], 'total': 3002}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 302, 0]]}, {'awards': [5600, 3302], 'total': 8902}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 252], ['2024-05', 1, 90, 0]]}, {'awards': [253, 91], 'total': 344}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 102, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2503, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1003, 0]]}, {'awards': [5000, 1003], 'total': 6003}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 903, 0]]}, {'awards': [905, 908], 'total': 1813}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 403, 0]]}, {'awards': [2400, 603], 'total': 3003}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 303, 0]]}, {'awards': [5600, 3303], 'total': 8903}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 253], ['2024-05', 1, 90, 0]]}, {'awards': [254, 91], 'total': 345}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 103, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2504, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1004, 0]]}, {'awards': [5000, 1004], 'total': 6004}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 904, 0]]}, {'awards': [905, 909], 'total': 1814}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 404, 0]]}, {'awards': [2400, 604], 'total': 3004}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 304, 0]]}, {'awards': [5600, 3304], 'total': 8904}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 254], ['2024-05', 1, 90, 0]]}, {'awards': [255, 91], 'total': 346}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 104, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2505, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1005, 0]]}, {'awards': [5000, 1005], 'total': 6005}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 905, 0]]}, {'awards': [905, 910], 'total': 1815}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 405, 0]]}, {'awards': [2400, 605], 'total': 3005}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 305, 0]]}, {'awards': [5600, 3305], 'total': 8905}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 255], ['2024-05', 1, 90, 0]]}, {'awards': [256, 91], 'total': 347}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 105, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cap within month | {'awards': [3100, 2050, 10], 'total': 5160} | {'awards': [3100, 2050, 10], 'total': 5160} | Passed |
| new month resets | {'awards': [5000, 1001], 'total': 6001} | {'awards': [5000, 1001], 'total': 6001} | Passed |
| same month next year | {'awards': [905, 906], 'total': 1811} | {'awards': [905, 906], 'total': 1811} | Passed |
| exempt promo | {'awards': [1700, 601], 'total': 2301} | {'awards': [2400, 601], 'total': 3001} | Failed |
| base never capped | {'awards': [5600, 3301], 'total': 8901} | {'awards': [5600, 3301], 'total': 8901} | Passed |
| exempt only | {'awards': [1, 91], 'total': 92} | {'awards': [252, 91], 'total': 343} | Failed |
| many small | {'awards': [101, 101, 101, 1], 'total': 304} | {'awards': [101, 102, 101, 1], 'total': 305} | Failed |
SHA-256 / 095c11aaaf47cddcfb5b35cd026c633cae00992a667a963b932cce26a7603602
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
used = {}
out = []
for m, base, bonus, exempt in x['txns']:
k = m
rem = x['cap'] - used.get(k, 0)
b = min(bonus, rem)
used[k] = used.get(k, 0) + b
out.append(base + b)
return {'awards': out, 'total': sum(out) + sum(t[3] for t in x['txns'])}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2501, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1001, 0]]}, {'awards': [5000, 1001], 'total': 6001}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 901, 0]]}, {'awards': [905, 906], 'total': 1811}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 401, 0]]}, {'awards': [2400, 601], 'total': 3001}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 301, 0]]}, {'awards': [5600, 3301], 'total': 8901}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 251], ['2024-05', 1, 90, 0]]}, {'awards': [252, 91], 'total': 343}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 101, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2502, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1002, 0]]}, {'awards': [5000, 1002], 'total': 6002}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 902, 0]]}, {'awards': [905, 907], 'total': 1812}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 402, 0]]}, {'awards': [2400, 602], 'total': 3002}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 302, 0]]}, {'awards': [5600, 3302], 'total': 8902}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 252], ['2024-05', 1, 90, 0]]}, {'awards': [253, 91], 'total': 344}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 102, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2503, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1003, 0]]}, {'awards': [5000, 1003], 'total': 6003}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 903, 0]]}, {'awards': [905, 908], 'total': 1813}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 403, 0]]}, {'awards': [2400, 603], 'total': 3003}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 303, 0]]}, {'awards': [5600, 3303], 'total': 8903}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 253], ['2024-05', 1, 90, 0]]}, {'awards': [254, 91], 'total': 345}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 103, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2504, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1004, 0]]}, {'awards': [5000, 1004], 'total': 6004}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 904, 0]]}, {'awards': [905, 909], 'total': 1814}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 404, 0]]}, {'awards': [2400, 604], 'total': 3004}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 304, 0]]}, {'awards': [5600, 3304], 'total': 8904}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 254], ['2024-05', 1, 90, 0]]}, {'awards': [255, 91], 'total': 346}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 104, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2505, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1005, 0]]}, {'awards': [5000, 1005], 'total': 6005}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 905, 0]]}, {'awards': [905, 910], 'total': 1815}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 405, 0]]}, {'awards': [2400, 605], 'total': 3005}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 305, 0]]}, {'awards': [5600, 3305], 'total': 8905}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 255], ['2024-05', 1, 90, 0]]}, {'awards': [256, 91], 'total': 347}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 105, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cap within month | {'awards': [3100, 2050, 10], 'total': 5160} | {'awards': [3100, 2050, 10], 'total': 5160} | Passed |
| new month resets | {'awards': [5000, 1001], 'total': 6001} | {'awards': [5000, 1001], 'total': 6001} | Passed |
| same month next year | {'awards': [905, 906], 'total': 1811} | {'awards': [905, 906], 'total': 1811} | Passed |
| exempt promo | {'awards': [1700, 601], 'total': 3001} | {'awards': [2400, 601], 'total': 3001} | Failed |
| base never capped | {'awards': [5600, 3301], 'total': 8901} | {'awards': [5600, 3301], 'total': 8901} | Passed |
| exempt only | {'awards': [1, 91], 'total': 343} | {'awards': [252, 91], 'total': 343} | Failed |
| many small | {'awards': [101, 101, 101, 1], 'total': 305} | {'awards': [101, 102, 101, 1], 'total': 305} | Failed |
SHA-256 / 97f8bd5f212abc6525e661cc626410a1327982777a967250f74e13be95a14453
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
used = {}
out = []
for m, base, bonus, exempt in x['txns']:
k = m
rem = x['cap'] - used.get(k, 0)
b = min(bonus, rem)
used[k] = used.get(k, 0) + b
out.append(base + b + exempt)
return {'awards': out, 'total': sum(out)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2501, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1001, 0]]}, {'awards': [5000, 1001], 'total': 6001}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 901, 0]]}, {'awards': [905, 906], 'total': 1811}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 401, 0]]}, {'awards': [2400, 601], 'total': 3001}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 301, 0]]}, {'awards': [5600, 3301], 'total': 8901}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 251], ['2024-05', 1, 90, 0]]}, {'awards': [252, 91], 'total': 343}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 101, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2502, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1002, 0]]}, {'awards': [5000, 1002], 'total': 6002}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 902, 0]]}, {'awards': [905, 907], 'total': 1812}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 402, 0]]}, {'awards': [2400, 602], 'total': 3002}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 302, 0]]}, {'awards': [5600, 3302], 'total': 8902}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 252], ['2024-05', 1, 90, 0]]}, {'awards': [253, 91], 'total': 344}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 102, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2503, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1003, 0]]}, {'awards': [5000, 1003], 'total': 6003}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 903, 0]]}, {'awards': [905, 908], 'total': 1813}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 403, 0]]}, {'awards': [2400, 603], 'total': 3003}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 303, 0]]}, {'awards': [5600, 3303], 'total': 8903}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 253], ['2024-05', 1, 90, 0]]}, {'awards': [254, 91], 'total': 345}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 103, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2504, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1004, 0]]}, {'awards': [5000, 1004], 'total': 6004}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 904, 0]]}, {'awards': [905, 909], 'total': 1814}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 404, 0]]}, {'awards': [2400, 604], 'total': 3004}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 304, 0]]}, {'awards': [5600, 3304], 'total': 8904}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 254], ['2024-05', 1, 90, 0]]}, {'awards': [255, 91], 'total': 346}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 104, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]], [['cap within month', {'cap': 5000, 'txns': [['2024-03', 100, 3000, 0], ['2024-03', 50, 2505, 0], ['2024-03', 10, 400, 0]]}, {'awards': [3100, 2050, 10], 'total': 5160}], ['new month resets', {'cap': 5000, 'txns': [['2024-03', 0, 5000, 0], ['2024-04', 0, 1005, 0]]}, {'awards': [5000, 1005], 'total': 6005}], ['same month next year', {'cap': 1000, 'txns': [['2023-07', 5, 900, 0], ['2024-07', 5, 905, 0]]}, {'awards': [905, 910], 'total': 1815}], ['exempt promo', {'cap': 2000, 'txns': [['2024-01', 200, 1500, 700], ['2024-01', 200, 405, 0]]}, {'awards': [2400, 605], 'total': 3005}], ['base never capped', {'cap': 1000, 'txns': [['2024-02', 5000, 600, 0], ['2024-02', 3000, 305, 0]]}, {'awards': [5600, 3305], 'total': 8905}], ['exempt only', {'cap': 100, 'txns': [['2024-05', 1, 0, 255], ['2024-05', 1, 90, 0]]}, {'awards': [256, 91], 'total': 347}], ['many small', {'cap': 300, 'txns': [['2024-06', 1, 100, 0], ['2024-06', 1, 100, 1], ['2024-06', 1, 105, 0], ['2024-06', 1, 100, 0]]}, {'awards': [101, 102, 101, 1], 'total': 305}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cap within month | {'awards': [3100, 2050, 10], 'total': 5160} | {'awards': [3100, 2050, 10], 'total': 5160} | Passed |
| new month resets | {'awards': [5000, 1001], 'total': 6001} | {'awards': [5000, 1001], 'total': 6001} | Passed |
| same month next year | {'awards': [905, 906], 'total': 1811} | {'awards': [905, 906], 'total': 1811} | Passed |
| exempt promo | {'awards': [2400, 601], 'total': 3001} | {'awards': [2400, 601], 'total': 3001} | Passed |
| base never capped | {'awards': [5600, 3301], 'total': 8901} | {'awards': [5600, 3301], 'total': 8901} | Passed |
| exempt only | {'awards': [252, 91], 'total': 343} | {'awards': [252, 91], 'total': 343} | Passed |
| many small | {'awards': [101, 102, 101, 1], 'total': 305} | {'awards': [101, 102, 101, 1], 'total': 305} | Passed |
SHA-256 / 04b65353a5c3f310ece00e881a23156cdde5dac6c46795cc80a2a196dcd61f7e
Verification & scope
Stipulated bounded loyalty-program model with explicit toy rules; not any real program terms. 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:46:48.430959+00:00.
Case digest / 50a270a99ee787a619a1a529c732fcba1f3a6a70498ac161e6003990174ce8fd