FA-59766 / Subscription proration billing / Open access
Expiring credit grants applied to invoices: partial grant remainder · case 01
Partially used credits reappear at full value.
ROOT CAUSE
The remaining list reports the original grant amount.
VERIFIED REPAIR
Restore the contract rule at the partial grant remainder step: use `if amt - take > 0: rest.append([amt - take, exp])`.
Unsuccessful approach: The attempt lists only untouched grants, losing partially used ones.
Case contract
Input {grants: [[amount, expires_day, granted_day]], day, amount}. A grant is usable when granted_day <= day < expires_day. Usable grants are consumed soonest-expiring first (ties by earlier grant day, then input order). Return [applied, remaining_due, [[left, expires] for partially used or untouched usable grants]].
Why this case matters
Promotional credits must be burned in expiry order and never after they expire.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]
usable.sort(key=lambda g: (g[1], g[2]))
need = x['amount']
applied = 0
rest = []
for amt, exp, gd in usable:
take = min(amt, need)
need -= take
applied += take
if amt - take > 0:
rest.append([amt, exp])
return [applied, need, rest]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'grants': [[3819, 68, 16], [1930, 58, 26], [323, 59, 3], [2345, 29, 23], [2715, 44, 13]], 'day': 44, 'amount': 5792}, [5792, 0, [[280, 68]]]), ('regression', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('partial-repair probe', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('partial-repair probe', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('normal control', {'grants': [[1468, 59, 37], [2753, 34, 1], [3215, 49, 24]], 'day': 24, 'amount': 9315}, [5968, 3347, []]), ('normal control', {'grants': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('normal control', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('normal control', {'grants': [[2773, 15, 9], [1310, 48, 23], [4052, 71, 20]], 'day': 23, 'amount': 8492}, [5362, 3130, []])], [('regression', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('regression', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('partial-repair probe', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('partial-repair probe', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('normal control', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('normal control', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('normal control', {'grants': [[4886, 68, 27]], 'day': 34, 'amount': 6459}, [4886, 1573, []]), ('normal control', {'grants': [[4933, 63, 40]], 'day': 63, 'amount': 7306}, [0, 7306, []])], [('regression', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('regression', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('partial-repair probe', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('partial-repair probe', {'grants': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('normal control', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('normal control', {'grants': [[4428, 38, 34], [4352, 38, 5], [1603, 11, 10]], 'day': 38, 'amount': 11185}, [0, 11185, []]), ('normal control', {'grants': [[1532, 36, 16], [3167, 81, 23]], 'day': 79, 'amount': 9179}, [3167, 6012, []]), ('normal control', {'grants': [[1721, 49, 40], [1723, 56, 3], [735, 16, 1]], 'day': 56, 'amount': 7084}, [0, 7084, []])], [('regression', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('regression', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('partial-repair probe', {'grants': [[571, 50, 17], [4761, 10, 6], [3521, 82, 34], [1414, 36, 2]], 'day': 34, 'amount': 721}, [721, 0, [[693, 36], [571, 50], [3521, 82]]]), ('partial-repair probe', {'grants': [[4651, 53, 31], [3113, 56, 35], [1383, 36, 23], [3661, 45, 24], [130, 62, 8]], 'day': 36, 'amount': 3058}, [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []]), ('normal control', {'grants': [[1110, 34, 23], [3403, 54, 35], [4357, 61, 21], [1009, 33, 4], [1988, 42, 17]], 'day': 33, 'amount': 7737}, [7455, 282, []]), ('normal control', {'grants': [], 'day': 50, 'amount': 6225}, [0, 6225, []]), ('normal control', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []])], [('regression', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('regression', {'grants': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('partial-repair probe', {'grants': [[1398, 69, 19], [4543, 47, 36], [2876, 44, 37], [4466, 58, 16]], 'day': 37, 'amount': 1446}, [1446, 0, [[1430, 44], [4543, 47], [4466, 58], [1398, 69]]]), ('partial-repair probe', {'grants': [[1738, 62, 14], [2402, 54, 26]], 'day': 14, 'amount': 1718}, [1718, 0, [[20, 62]]]), ('normal control', {'grants': [[1585, 58, 15], [4019, 40, 15], [2113, 83, 26]], 'day': 83, 'amount': 3346}, [0, 3346, []]), ('normal control', {'grants': [[1988, 63, 35]], 'day': 58, 'amount': 4262}, [1988, 2274, []]), ('normal control', {'grants': [[1288, 33, 20]], 'day': 20, 'amount': 7312}, [1288, 6024, []]), ('normal control', {'grants': [[324, 48, 13], [3431, 60, 6], [301, 29, 1], [1437, 59, 27]], 'day': 29, 'amount': 8166}, [5192, 2974, []])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), 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 |
|---|---|---|---|
| regression 0 | [5792, 0, [[3819, 68]]] | [5792, 0, [[280, 68]]] | Failed |
| regression 1 | [1147, 0, [[4520, 73]]] | [1147, 0, [[3373, 73]]] | Failed |
| partial-repair probe 2 | [236, 0, [[4168, 56], [1900, 63]]] | [236, 0, [[3932, 56], [1900, 63]]] | Failed |
| partial-repair probe 3 | [2567, 0, [[3775, 47], [3344, 61], [3652, 78]]] | [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]] | Failed |
| normal control 4 | [5968, 3347, []] | [5968, 3347, []] | Passed |
| normal control 5 | [3400, 8299, []] | [3400, 8299, []] | Passed |
| normal control 6 | [0, 6418, []] | [0, 6418, []] | Passed |
| normal control 7 | [5362, 3130, []] | [5362, 3130, []] | Passed |
SHA-256 / fb7f82c2b1c72426015b922b23a606b18fbf7264228485fbc7e275b1d091facf
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]
usable.sort(key=lambda g: (g[1], g[2]))
need = x['amount']
applied = 0
rest = []
for amt, exp, gd in usable:
take = min(amt, need)
need -= take
applied += take
if take == 0:
rest.append([amt, exp])
return [applied, need, rest]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'grants': [[3819, 68, 16], [1930, 58, 26], [323, 59, 3], [2345, 29, 23], [2715, 44, 13]], 'day': 44, 'amount': 5792}, [5792, 0, [[280, 68]]]), ('regression', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('partial-repair probe', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('partial-repair probe', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('normal control', {'grants': [[1468, 59, 37], [2753, 34, 1], [3215, 49, 24]], 'day': 24, 'amount': 9315}, [5968, 3347, []]), ('normal control', {'grants': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('normal control', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('normal control', {'grants': [[2773, 15, 9], [1310, 48, 23], [4052, 71, 20]], 'day': 23, 'amount': 8492}, [5362, 3130, []])], [('regression', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('regression', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('partial-repair probe', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('partial-repair probe', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('normal control', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('normal control', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('normal control', {'grants': [[4886, 68, 27]], 'day': 34, 'amount': 6459}, [4886, 1573, []]), ('normal control', {'grants': [[4933, 63, 40]], 'day': 63, 'amount': 7306}, [0, 7306, []])], [('regression', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('regression', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('partial-repair probe', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('partial-repair probe', {'grants': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('normal control', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('normal control', {'grants': [[4428, 38, 34], [4352, 38, 5], [1603, 11, 10]], 'day': 38, 'amount': 11185}, [0, 11185, []]), ('normal control', {'grants': [[1532, 36, 16], [3167, 81, 23]], 'day': 79, 'amount': 9179}, [3167, 6012, []]), ('normal control', {'grants': [[1721, 49, 40], [1723, 56, 3], [735, 16, 1]], 'day': 56, 'amount': 7084}, [0, 7084, []])], [('regression', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('regression', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('partial-repair probe', {'grants': [[571, 50, 17], [4761, 10, 6], [3521, 82, 34], [1414, 36, 2]], 'day': 34, 'amount': 721}, [721, 0, [[693, 36], [571, 50], [3521, 82]]]), ('partial-repair probe', {'grants': [[4651, 53, 31], [3113, 56, 35], [1383, 36, 23], [3661, 45, 24], [130, 62, 8]], 'day': 36, 'amount': 3058}, [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []]), ('normal control', {'grants': [[1110, 34, 23], [3403, 54, 35], [4357, 61, 21], [1009, 33, 4], [1988, 42, 17]], 'day': 33, 'amount': 7737}, [7455, 282, []]), ('normal control', {'grants': [], 'day': 50, 'amount': 6225}, [0, 6225, []]), ('normal control', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []])], [('regression', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('regression', {'grants': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('partial-repair probe', {'grants': [[1398, 69, 19], [4543, 47, 36], [2876, 44, 37], [4466, 58, 16]], 'day': 37, 'amount': 1446}, [1446, 0, [[1430, 44], [4543, 47], [4466, 58], [1398, 69]]]), ('partial-repair probe', {'grants': [[1738, 62, 14], [2402, 54, 26]], 'day': 14, 'amount': 1718}, [1718, 0, [[20, 62]]]), ('normal control', {'grants': [[1585, 58, 15], [4019, 40, 15], [2113, 83, 26]], 'day': 83, 'amount': 3346}, [0, 3346, []]), ('normal control', {'grants': [[1988, 63, 35]], 'day': 58, 'amount': 4262}, [1988, 2274, []]), ('normal control', {'grants': [[1288, 33, 20]], 'day': 20, 'amount': 7312}, [1288, 6024, []]), ('normal control', {'grants': [[324, 48, 13], [3431, 60, 6], [301, 29, 1], [1437, 59, 27]], 'day': 29, 'amount': 8166}, [5192, 2974, []])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), 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 |
|---|---|---|---|
| regression 0 | [5792, 0, []] | [5792, 0, [[280, 68]]] | Failed |
| regression 1 | [1147, 0, []] | [1147, 0, [[3373, 73]]] | Failed |
| partial-repair probe 2 | [236, 0, [[1900, 63]]] | [236, 0, [[3932, 56], [1900, 63]]] | Failed |
| partial-repair probe 3 | [2567, 0, [[3344, 61], [3652, 78]]] | [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]] | Failed |
| normal control 4 | [5968, 3347, []] | [5968, 3347, []] | Passed |
| normal control 5 | [3400, 8299, []] | [3400, 8299, []] | Passed |
| normal control 6 | [0, 6418, []] | [0, 6418, []] | Passed |
| normal control 7 | [5362, 3130, []] | [5362, 3130, []] | Passed |
SHA-256 / 2b6336fcc2529f89ceb5c788e6c47136cdb649ad6edcf21d65166201956fd3c1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]
usable.sort(key=lambda g: (g[1], g[2]))
need = x['amount']
applied = 0
rest = []
for amt, exp, gd in usable:
take = min(amt, need)
need -= take
applied += take
if amt - take > 0:
rest.append([amt - take, exp])
return [applied, need, rest]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'grants': [[3819, 68, 16], [1930, 58, 26], [323, 59, 3], [2345, 29, 23], [2715, 44, 13]], 'day': 44, 'amount': 5792}, [5792, 0, [[280, 68]]]), ('regression', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('partial-repair probe', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('partial-repair probe', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('normal control', {'grants': [[1468, 59, 37], [2753, 34, 1], [3215, 49, 24]], 'day': 24, 'amount': 9315}, [5968, 3347, []]), ('normal control', {'grants': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('normal control', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('normal control', {'grants': [[2773, 15, 9], [1310, 48, 23], [4052, 71, 20]], 'day': 23, 'amount': 8492}, [5362, 3130, []])], [('regression', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('regression', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('partial-repair probe', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('partial-repair probe', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('normal control', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('normal control', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('normal control', {'grants': [[4886, 68, 27]], 'day': 34, 'amount': 6459}, [4886, 1573, []]), ('normal control', {'grants': [[4933, 63, 40]], 'day': 63, 'amount': 7306}, [0, 7306, []])], [('regression', {'grants': [[2834, 10, 2], [2391, 78, 31], [4168, 56, 2], [1900, 63, 18], [3824, 30, 11]], 'day': 30, 'amount': 236}, [236, 0, [[3932, 56], [1900, 63]]]), ('regression', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('partial-repair probe', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('partial-repair probe', {'grants': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('normal control', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('normal control', {'grants': [[4428, 38, 34], [4352, 38, 5], [1603, 11, 10]], 'day': 38, 'amount': 11185}, [0, 11185, []]), ('normal control', {'grants': [[1532, 36, 16], [3167, 81, 23]], 'day': 79, 'amount': 9179}, [3167, 6012, []]), ('normal control', {'grants': [[1721, 49, 40], [1723, 56, 3], [735, 16, 1]], 'day': 56, 'amount': 7084}, [0, 7084, []])], [('regression', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]]), ('regression', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('partial-repair probe', {'grants': [[571, 50, 17], [4761, 10, 6], [3521, 82, 34], [1414, 36, 2]], 'day': 34, 'amount': 721}, [721, 0, [[693, 36], [571, 50], [3521, 82]]]), ('partial-repair probe', {'grants': [[4651, 53, 31], [3113, 56, 35], [1383, 36, 23], [3661, 45, 24], [130, 62, 8]], 'day': 36, 'amount': 3058}, [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []]), ('normal control', {'grants': [[1110, 34, 23], [3403, 54, 35], [4357, 61, 21], [1009, 33, 4], [1988, 42, 17]], 'day': 33, 'amount': 7737}, [7455, 282, []]), ('normal control', {'grants': [], 'day': 50, 'amount': 6225}, [0, 6225, []]), ('normal control', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []])], [('regression', {'grants': [[4546, 83, 40], [460, 75, 40], [4086, 56, 18], [3942, 30, 22]], 'day': 30, 'amount': 3239}, [3239, 0, [[847, 56]]]), ('regression', {'grants': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('partial-repair probe', {'grants': [[1398, 69, 19], [4543, 47, 36], [2876, 44, 37], [4466, 58, 16]], 'day': 37, 'amount': 1446}, [1446, 0, [[1430, 44], [4543, 47], [4466, 58], [1398, 69]]]), ('partial-repair probe', {'grants': [[1738, 62, 14], [2402, 54, 26]], 'day': 14, 'amount': 1718}, [1718, 0, [[20, 62]]]), ('normal control', {'grants': [[1585, 58, 15], [4019, 40, 15], [2113, 83, 26]], 'day': 83, 'amount': 3346}, [0, 3346, []]), ('normal control', {'grants': [[1988, 63, 35]], 'day': 58, 'amount': 4262}, [1988, 2274, []]), ('normal control', {'grants': [[1288, 33, 20]], 'day': 20, 'amount': 7312}, [1288, 6024, []]), ('normal control', {'grants': [[324, 48, 13], [3431, 60, 6], [301, 29, 1], [1437, 59, 27]], 'day': 29, 'amount': 8166}, [5192, 2974, []])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), 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 |
|---|---|---|---|
| regression 0 | [5792, 0, [[280, 68]]] | [5792, 0, [[280, 68]]] | Passed |
| regression 1 | [1147, 0, [[3373, 73]]] | [1147, 0, [[3373, 73]]] | Passed |
| partial-repair probe 2 | [236, 0, [[3932, 56], [1900, 63]]] | [236, 0, [[3932, 56], [1900, 63]]] | Passed |
| partial-repair probe 3 | [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]] | [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]] | Passed |
| normal control 4 | [5968, 3347, []] | [5968, 3347, []] | Passed |
| normal control 5 | [3400, 8299, []] | [3400, 8299, []] | Passed |
| normal control 6 | [0, 6418, []] | [0, 6418, []] | Passed |
| normal control 7 | [5362, 3130, []] | [5362, 3130, []] | Passed |
SHA-256 / 07c48729bb0c4afda4da8765a693cacf498f5f1fbe85dcc51e4946e3c75109f2
Verification & scope
A deterministic teaching model of a stipulated billing rule. It makes no claim to reproduce any billing provider's exact behaviour and is not billing software. 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:39.440034+00:00.
Case digest / db5a20e4c5bc3b3240d016a7ec9d61e1cbb9c1b57c932cbad7e8eae5659e44a2