FA-59771 / Subscription proration billing / Open access
Expiring credit grants applied to invoices: future grants excluded · case 01
Credits scheduled for next month pay this month's invoice.
ROOT CAUSE
Grants are usable before their grant day.
VERIFIED REPAIR
Restore the contract rule at the future grants excluded step: use `usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]`.
Unsuccessful approach: The attempt checks the grant precedes its expiry instead of the invoice day.
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 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': [[1468, 59, 37], [2753, 34, 1], [3215, 49, 24]], 'day': 24, 'amount': 9315}, [5968, 3347, []]), ('regression', {'grants': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('partial-repair probe', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('partial-repair probe', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('normal control', {'grants': [[3819, 68, 16], [1930, 58, 26], [323, 59, 3], [2345, 29, 23], [2715, 44, 13]], 'day': 44, 'amount': 5792}, [5792, 0, [[280, 68]]]), ('normal control', {'grants': [[2773, 15, 9], [1310, 48, 23], [4052, 71, 20]], 'day': 23, 'amount': 8492}, [5362, 3130, []]), ('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': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('regression', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('partial-repair probe', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('partial-repair probe', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('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, []]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []])], [('regression', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('regression', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('partial-repair probe', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('partial-repair probe', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('normal control', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('normal control', {'grants': [], 'day': 50, 'amount': 6225}, [0, 6225, []]), ('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, []])], [('regression', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('regression', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('partial-repair probe', {'grants': [[1110, 34, 23], [3403, 54, 35], [4357, 61, 21], [1009, 33, 4], [1988, 42, 17]], 'day': 33, 'amount': 7737}, [7455, 282, []]), ('partial-repair probe', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []]), ('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, []]), ('normal control', {'grants': [[2393, 25, 21]], 'day': 25, 'amount': 2298}, [0, 2298, []]), ('normal control', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]])], [('regression', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('regression', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('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': [[1025, 32, 22], [4283, 39, 31], [3756, 69, 37], [2137, 3, 0], [2949, 17, 3]], 'day': 22, 'amount': 2736}, [1025, 1711, []]), ('normal control', {'grants': [], 'day': 80, 'amount': 1837}, [0, 1837, []]), ('normal control', {'grants': [], 'day': 25, 'amount': 2572}, [0, 2572, []]), ('normal control', {'grants': [], 'day': 73, 'amount': 5894}, [0, 5894, []]), ('normal control', {'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]]])]]
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 | [7436, 1879, []] | [5968, 3347, []] | Failed |
| regression 1 | [11699, 0, [[711, 64]]] | [3400, 8299, []] | Failed |
| partial-repair probe 2 | [2784, 3634, []] | [0, 6418, []] | Failed |
| partial-repair probe 3 | [10480, 0, [[465, 48], [1384, 70]]] | [8552, 1928, []] | Failed |
| normal control 4 | [5792, 0, [[280, 68]]] | [5792, 0, [[280, 68]]] | Passed |
| normal control 5 | [5362, 3130, []] | [5362, 3130, []] | Passed |
| normal control 6 | [4886, 1573, []] | [4886, 1573, []] | Passed |
| normal control 7 | [0, 7306, []] | [0, 7306, []] | Passed |
SHA-256 / e053a997ee8166d6e5cf76bb6b317131b48b218cbcd892d54232f5545c551378
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] <= g[1] and 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': [[1468, 59, 37], [2753, 34, 1], [3215, 49, 24]], 'day': 24, 'amount': 9315}, [5968, 3347, []]), ('regression', {'grants': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('partial-repair probe', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('partial-repair probe', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('normal control', {'grants': [[3819, 68, 16], [1930, 58, 26], [323, 59, 3], [2345, 29, 23], [2715, 44, 13]], 'day': 44, 'amount': 5792}, [5792, 0, [[280, 68]]]), ('normal control', {'grants': [[2773, 15, 9], [1310, 48, 23], [4052, 71, 20]], 'day': 23, 'amount': 8492}, [5362, 3130, []]), ('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': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('regression', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('partial-repair probe', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('partial-repair probe', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('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, []]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []])], [('regression', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('regression', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('partial-repair probe', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('partial-repair probe', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('normal control', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('normal control', {'grants': [], 'day': 50, 'amount': 6225}, [0, 6225, []]), ('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, []])], [('regression', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('regression', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('partial-repair probe', {'grants': [[1110, 34, 23], [3403, 54, 35], [4357, 61, 21], [1009, 33, 4], [1988, 42, 17]], 'day': 33, 'amount': 7737}, [7455, 282, []]), ('partial-repair probe', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []]), ('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, []]), ('normal control', {'grants': [[2393, 25, 21]], 'day': 25, 'amount': 2298}, [0, 2298, []]), ('normal control', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]])], [('regression', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('regression', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('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': [[1025, 32, 22], [4283, 39, 31], [3756, 69, 37], [2137, 3, 0], [2949, 17, 3]], 'day': 22, 'amount': 2736}, [1025, 1711, []]), ('normal control', {'grants': [], 'day': 80, 'amount': 1837}, [0, 1837, []]), ('normal control', {'grants': [], 'day': 25, 'amount': 2572}, [0, 2572, []]), ('normal control', {'grants': [], 'day': 73, 'amount': 5894}, [0, 5894, []]), ('normal control', {'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]]])]]
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 | [7436, 1879, []] | [5968, 3347, []] | Failed |
| regression 1 | [11699, 0, [[711, 64]]] | [3400, 8299, []] | Failed |
| partial-repair probe 2 | [2784, 3634, []] | [0, 6418, []] | Failed |
| partial-repair probe 3 | [10480, 0, [[465, 48], [1384, 70]]] | [8552, 1928, []] | Failed |
| normal control 4 | [5792, 0, [[280, 68]]] | [5792, 0, [[280, 68]]] | Passed |
| normal control 5 | [5362, 3130, []] | [5362, 3130, []] | Passed |
| normal control 6 | [4886, 1573, []] | [4886, 1573, []] | Passed |
| normal control 7 | [0, 7306, []] | [0, 7306, []] | Passed |
SHA-256 / 1f3a4bd1727fa11519feb6931134e810cfcdd418546b9b9a161725eeac53e0ab
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': [[1468, 59, 37], [2753, 34, 1], [3215, 49, 24]], 'day': 24, 'amount': 9315}, [5968, 3347, []]), ('regression', {'grants': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('partial-repair probe', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('partial-repair probe', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('normal control', {'grants': [[3819, 68, 16], [1930, 58, 26], [323, 59, 3], [2345, 29, 23], [2715, 44, 13]], 'day': 44, 'amount': 5792}, [5792, 0, [[280, 68]]]), ('normal control', {'grants': [[2773, 15, 9], [1310, 48, 23], [4052, 71, 20]], 'day': 23, 'amount': 8492}, [5362, 3130, []]), ('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': [[2342, 62, 27], [2349, 64, 11], [3400, 5, 3], [4319, 29, 10]], 'day': 3, 'amount': 11699}, [3400, 8299, []]), ('regression', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('partial-repair probe', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('partial-repair probe', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('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, []]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []])], [('regression', {'grants': [[2784, 49, 29], [4250, 5, 2]], 'day': 5, 'amount': 6418}, [0, 6418, []]), ('regression', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('partial-repair probe', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('partial-repair probe', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('normal control', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('normal control', {'grants': [], 'day': 50, 'amount': 6225}, [0, 6225, []]), ('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, []])], [('regression', {'grants': [[1384, 70, 15], [4042, 35, 28], [3777, 37, 32], [3126, 48, 5]], 'day': 28, 'amount': 10480}, [8552, 1928, []]), ('regression', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('partial-repair probe', {'grants': [[1110, 34, 23], [3403, 54, 35], [4357, 61, 21], [1009, 33, 4], [1988, 42, 17]], 'day': 33, 'amount': 7737}, [7455, 282, []]), ('partial-repair probe', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []]), ('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, []]), ('normal control', {'grants': [[2393, 25, 21]], 'day': 25, 'amount': 2298}, [0, 2298, []]), ('normal control', {'grants': [[3652, 78, 36], [3344, 61, 28], [3775, 47, 19]], 'day': 36, 'amount': 2567}, [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]])], [('regression', {'grants': [[2817, 40, 9], [519, 18, 4], [2025, 35, 27]], 'day': 18, 'amount': 2988}, [2817, 171, []]), ('regression', {'grants': [[348, 44, 22], [3151, 71, 29], [1829, 75, 25]], 'day': 22, 'amount': 1836}, [348, 1488, []]), ('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': [[1025, 32, 22], [4283, 39, 31], [3756, 69, 37], [2137, 3, 0], [2949, 17, 3]], 'day': 22, 'amount': 2736}, [1025, 1711, []]), ('normal control', {'grants': [], 'day': 80, 'amount': 1837}, [0, 1837, []]), ('normal control', {'grants': [], 'day': 25, 'amount': 2572}, [0, 2572, []]), ('normal control', {'grants': [], 'day': 73, 'amount': 5894}, [0, 5894, []]), ('normal control', {'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]]])]]
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 | [5968, 3347, []] | [5968, 3347, []] | Passed |
| regression 1 | [3400, 8299, []] | [3400, 8299, []] | Passed |
| partial-repair probe 2 | [0, 6418, []] | [0, 6418, []] | Passed |
| partial-repair probe 3 | [8552, 1928, []] | [8552, 1928, []] | Passed |
| normal control 4 | [5792, 0, [[280, 68]]] | [5792, 0, [[280, 68]]] | Passed |
| normal control 5 | [5362, 3130, []] | [5362, 3130, []] | Passed |
| normal control 6 | [4886, 1573, []] | [4886, 1573, []] | Passed |
| normal control 7 | [0, 7306, []] | [0, 7306, []] | Passed |
SHA-256 / 1e01dabd65fc6c1833d66f51a2a49ace5b07334a84ff8ba76c00bbebcf7649a4
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.484047+00:00.
Case digest / 2e8a64d306eb0ccdf1bb0d2401bd3d399d8a45e0189bdd581502534241f8d2fb