FAILURE MAP
← Case archive

FA-60731 / Loyalty points ledgers / Open access

Monthly promotional bonus cap: exempt bonus and cap · case 01

Exempt promotional bonus uses up the monthly cap.

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

ROOT CAUSE

Exempt bonus is added to the cap counter.

VERIFIED REPAIR

Keep exempt bonus out of the cap counter.

Unsuccessful approach: Capping exempt and regular bonus together still limits exempt bonus.

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 + exempt
        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 fixtureActualExpectedOutcome
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, 0], 'total': 2400}{'awards': [2400, 601], 'total': 3001}Failed
base never capped{'awards': [5600, 3301], 'total': 8901}{'awards': [5600, 3301], 'total': 8901}Passed
exempt only{'awards': [252, -150], 'total': 102}{'awards': [252, 91], 'total': 343}Failed
many small{'awards': [101, 102, 100, 1], 'total': 304}{'awards': [101, 102, 101, 1], 'total': 305}Failed

SHA-256 / 5855b4a92a8decda20deac61bc3cbd03ae621caeb96e45706a1e9b84a2991446

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 + exempt, 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 fixtureActualExpectedOutcome
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': [2200, 200], 'total': 2400}{'awards': [2400, 601], 'total': 3001}Failed
base never capped{'awards': [5600, 3301], 'total': 8901}{'awards': [5600, 3301], 'total': 8901}Passed
exempt only{'awards': [101, 1], 'total': 102}{'awards': [252, 91], 'total': 343}Failed
many small{'awards': [101, 102, 100, 1], 'total': 304}{'awards': [101, 102, 101, 1], 'total': 305}Failed

SHA-256 / ac7e974bca69034cb889f7197b1d3dd2a765e650be262011f8bfadc32347ab41

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

Case digest / 9f33f9f18d02f82da25c0aa150fa51fe5b6bd2f5c07dacf6a461d079c98cee1a