{"abstract":"Partially used credits reappear at full value.","category":"Subscription proration billing","checks":8,"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]].","evaluation_group":"w2-subscription-proration-expiring-credit-grants","failed_approach":"The attempt lists only untouched grants, losing partially used ones.","family":"w2-subscription-proration-expiring-credit-grants-partial-grant-remainder","id":"FA-59766","implementations":{"attempt":{"sha256":"2b6336fcc2529f89ceb5c788e6c47136cdb649ad6edcf21d65166201956fd3c1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]\n    usable.sort(key=lambda g: (g[1], g[2]))\n    need = x['amount']\n    applied = 0\n    rest = []\n    for amt, exp, gd in usable:\n        take = min(amt, need)\n        need -= take\n        applied += take\n        if take == 0:\n            rest.append([amt, exp])\n    return [applied, need, rest]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('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, []])]]\nfor i, (label, args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (label, i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"fb7f82c2b1c72426015b922b23a606b18fbf7264228485fbc7e275b1d091facf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]\n    usable.sort(key=lambda g: (g[1], g[2]))\n    need = x['amount']\n    applied = 0\n    rest = []\n    for amt, exp, gd in usable:\n        take = min(amt, need)\n        need -= take\n        applied += take\n        if amt - take > 0:\n            rest.append([amt, exp])\n    return [applied, need, rest]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('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, []])]]\nfor i, (label, args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (label, i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"07c48729bb0c4afda4da8765a693cacf498f5f1fbe85dcc51e4946e3c75109f2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    usable = [g for g in x['grants'] if g[2] <= x['day'] < g[1]]\n    usable.sort(key=lambda g: (g[1], g[2]))\n    need = x['amount']\n    applied = 0\n    rest = []\n    for amt, exp, gd in usable:\n        take = min(amt, need)\n        need -= take\n        applied += take\n        if amt - take > 0:\n            rest.append([amt - take, exp])\n    return [applied, need, rest]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('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, []])]]\nfor i, (label, args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (label, i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-subscription-proration-expiring-credit-grants-partial-grant-remainder","generated_at":"2026-09-29T14:46:39.440034+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Promotional credits must be burned in expiry order and never after they expire.","repair":"Restore the contract rule at the partial grant remainder step: use `if amt - take > 0:\n        rest.append([amt - take, exp])`.","root_cause":"The remaining list reports the original grant amount.","sha256":"db5a20e4c5bc3b3240d016a7ec9d61e1cbb9c1b57c932cbad7e8eae5659e44a2","title":"Expiring credit grants applied to invoices: partial grant remainder · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.399,"exit_code":1,"observations":[{"actual":[5792,0,[]],"check":"regression 0","expected":[5792,0,[[280,68]]],"passed":false},{"actual":[1147,0,[]],"check":"regression 1","expected":[1147,0,[[3373,73]]],"passed":false},{"actual":[236,0,[[1900,63]]],"check":"partial-repair probe 2","expected":[236,0,[[3932,56],[1900,63]]],"passed":false},{"actual":[2567,0,[[3344,61],[3652,78]]],"check":"partial-repair probe 3","expected":[2567,0,[[1208,47],[3344,61],[3652,78]]],"passed":false},{"actual":[5968,3347,[]],"check":"normal control 4","expected":[5968,3347,[]],"passed":true},{"actual":[3400,8299,[]],"check":"normal control 5","expected":[3400,8299,[]],"passed":true},{"actual":[0,6418,[]],"check":"normal control 6","expected":[0,6418,[]],"passed":true},{"actual":[5362,3130,[]],"check":"normal control 7","expected":[5362,3130,[]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [5792, 0, []], \"expected\": [5792, 0, [[280, 68]]], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [1147, 0, []], \"expected\": [1147, 0, [[3373, 73]]], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [236, 0, [[1900, 63]]], \"expected\": [236, 0, [[3932, 56], [1900, 63]]], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [2567, 0, [[3344, 61], [3652, 78]]], \"expected\": [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [5968, 3347, []], \"expected\": [5968, 3347, []], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [3400, 8299, []], \"expected\": [3400, 8299, []], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [0, 6418, []], \"expected\": [0, 6418, []], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [5362, 3130, []], \"expected\": [5362, 3130, []], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.019,"exit_code":1,"observations":[{"actual":[5792,0,[[3819,68]]],"check":"regression 0","expected":[5792,0,[[280,68]]],"passed":false},{"actual":[1147,0,[[4520,73]]],"check":"regression 1","expected":[1147,0,[[3373,73]]],"passed":false},{"actual":[236,0,[[4168,56],[1900,63]]],"check":"partial-repair probe 2","expected":[236,0,[[3932,56],[1900,63]]],"passed":false},{"actual":[2567,0,[[3775,47],[3344,61],[3652,78]]],"check":"partial-repair probe 3","expected":[2567,0,[[1208,47],[3344,61],[3652,78]]],"passed":false},{"actual":[5968,3347,[]],"check":"normal control 4","expected":[5968,3347,[]],"passed":true},{"actual":[3400,8299,[]],"check":"normal control 5","expected":[3400,8299,[]],"passed":true},{"actual":[0,6418,[]],"check":"normal control 6","expected":[0,6418,[]],"passed":true},{"actual":[5362,3130,[]],"check":"normal control 7","expected":[5362,3130,[]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [5792, 0, [[3819, 68]]], \"expected\": [5792, 0, [[280, 68]]], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [1147, 0, [[4520, 73]]], \"expected\": [1147, 0, [[3373, 73]]], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [236, 0, [[4168, 56], [1900, 63]]], \"expected\": [236, 0, [[3932, 56], [1900, 63]]], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [2567, 0, [[3775, 47], [3344, 61], [3652, 78]]], \"expected\": [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [5968, 3347, []], \"expected\": [5968, 3347, []], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [3400, 8299, []], \"expected\": [3400, 8299, []], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [0, 6418, []], \"expected\": [0, 6418, []], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [5362, 3130, []], \"expected\": [5362, 3130, []], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.989,"exit_code":0,"observations":[{"actual":[5792,0,[[280,68]]],"check":"regression 0","expected":[5792,0,[[280,68]]],"passed":true},{"actual":[1147,0,[[3373,73]]],"check":"regression 1","expected":[1147,0,[[3373,73]]],"passed":true},{"actual":[236,0,[[3932,56],[1900,63]]],"check":"partial-repair probe 2","expected":[236,0,[[3932,56],[1900,63]]],"passed":true},{"actual":[2567,0,[[1208,47],[3344,61],[3652,78]]],"check":"partial-repair probe 3","expected":[2567,0,[[1208,47],[3344,61],[3652,78]]],"passed":true},{"actual":[5968,3347,[]],"check":"normal control 4","expected":[5968,3347,[]],"passed":true},{"actual":[3400,8299,[]],"check":"normal control 5","expected":[3400,8299,[]],"passed":true},{"actual":[0,6418,[]],"check":"normal control 6","expected":[0,6418,[]],"passed":true},{"actual":[5362,3130,[]],"check":"normal control 7","expected":[5362,3130,[]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [5792, 0, [[280, 68]]], \"expected\": [5792, 0, [[280, 68]]], \"passed\": true}, {\"check\": \"regression 1\", \"actual\": [1147, 0, [[3373, 73]]], \"expected\": [1147, 0, [[3373, 73]]], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [236, 0, [[3932, 56], [1900, 63]]], \"expected\": [236, 0, [[3932, 56], [1900, 63]]], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]], \"expected\": [2567, 0, [[1208, 47], [3344, 61], [3652, 78]]], \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": [5968, 3347, []], \"expected\": [5968, 3347, []], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [3400, 8299, []], \"expected\": [3400, 8299, []], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [0, 6418, []], \"expected\": [0, 6418, []], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [5362, 3130, []], \"expected\": [5362, 3130, []], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}