{"abstract":"Long-lived credits are consumed while short-lived ones expire unused.","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 sorts by expiry descending.","family":"w2-subscription-proration-expiring-credit-grants-consumption-order","id":"FA-59761","implementations":{"attempt":{"sha256":"2d0a24cf9ae1dfcfcbac3cbd8ad524f5b154a9dcb3f0f3bcb6d90e746710d875","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': [[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]]]), ('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': [[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]]]), ('regression', {'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': [[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': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('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': [[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]]]), ('regression', {'grants': [[402, 28, 2], [4255, 65, 36], [2572, 56, 6], [4531, 25, 19], [2694, 48, 28]], 'day': 36, 'amount': 3121}, [3121, 0, [[2145, 56], [4255, 65]]]), ('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': [[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': [[402, 28, 2], [4255, 65, 36], [2572, 56, 6], [4531, 25, 19], [2694, 48, 28]], 'day': 36, 'amount': 3121}, [3121, 0, [[2145, 56], [4255, 65]]]), ('regression', {'grants': [[3489, 77, 37], [4072, 62, 23], [470, 62, 5], [2073, 40, 29], [1072, 34, 0]], 'day': 29, 'amount': 5684}, [5684, 0, [[2003, 62]]]), ('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': [[3812, 65, 19], [1707, 52, 18], [3211, 41, 24], [3775, 75, 29], [2654, 22, 1]], 'day': 41, 'amount': 6841}, [6841, 0, [[2453, 75]]]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []]), ('normal control', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('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, []])], [('regression', {'grants': [[3489, 77, 37], [4072, 62, 23], [470, 62, 5], [2073, 40, 29], [1072, 34, 0]], 'day': 29, 'amount': 5684}, [5684, 0, [[2003, 62]]]), ('regression', {'grants': [[3971, 27, 11], [4895, 40, 6], [3338, 81, 23], [122, 78, 29], [4523, 78, 24]], 'day': 29, 'amount': 7395}, [7395, 0, [[2023, 78], [122, 78], [3338, 81]]]), ('partial-repair probe', {'grants': [[3812, 65, 19], [1707, 52, 18], [3211, 41, 24], [3775, 75, 29], [2654, 22, 1]], 'day': 41, 'amount': 6841}, [6841, 0, [[2453, 75]]]), ('partial-repair probe', {'grants': [[4874, 70, 33], [4203, 58, 8]], 'day': 33, 'amount': 972}, [972, 0, [[3231, 58], [4874, 70]]]), ('normal control', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []]), ('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, []])]]\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":"3ef63e6593f8c4e1fe6aa75d32673e9104100d669ad3f204e7d908a126892df3","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[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': [[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]]]), ('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': [[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]]]), ('regression', {'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': [[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': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('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': [[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]]]), ('regression', {'grants': [[402, 28, 2], [4255, 65, 36], [2572, 56, 6], [4531, 25, 19], [2694, 48, 28]], 'day': 36, 'amount': 3121}, [3121, 0, [[2145, 56], [4255, 65]]]), ('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': [[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': [[402, 28, 2], [4255, 65, 36], [2572, 56, 6], [4531, 25, 19], [2694, 48, 28]], 'day': 36, 'amount': 3121}, [3121, 0, [[2145, 56], [4255, 65]]]), ('regression', {'grants': [[3489, 77, 37], [4072, 62, 23], [470, 62, 5], [2073, 40, 29], [1072, 34, 0]], 'day': 29, 'amount': 5684}, [5684, 0, [[2003, 62]]]), ('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': [[3812, 65, 19], [1707, 52, 18], [3211, 41, 24], [3775, 75, 29], [2654, 22, 1]], 'day': 41, 'amount': 6841}, [6841, 0, [[2453, 75]]]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []]), ('normal control', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('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, []])], [('regression', {'grants': [[3489, 77, 37], [4072, 62, 23], [470, 62, 5], [2073, 40, 29], [1072, 34, 0]], 'day': 29, 'amount': 5684}, [5684, 0, [[2003, 62]]]), ('regression', {'grants': [[3971, 27, 11], [4895, 40, 6], [3338, 81, 23], [122, 78, 29], [4523, 78, 24]], 'day': 29, 'amount': 7395}, [7395, 0, [[2023, 78], [122, 78], [3338, 81]]]), ('partial-repair probe', {'grants': [[3812, 65, 19], [1707, 52, 18], [3211, 41, 24], [3775, 75, 29], [2654, 22, 1]], 'day': 41, 'amount': 6841}, [6841, 0, [[2453, 75]]]), ('partial-repair probe', {'grants': [[4874, 70, 33], [4203, 58, 8]], 'day': 33, 'amount': 972}, [972, 0, [[3231, 58], [4874, 70]]]), ('normal control', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []]), ('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, []])]]\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":"266f12891f9eb98193e209e171e73ebd713c3712aa50a10035a83fe57648a0f0","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': [[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]]]), ('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': [[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]]]), ('regression', {'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': [[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': [[3527, 52, 33], [1461, 57, 34], [978, 47, 40], [4380, 48, 0]], 'day': 34, 'amount': 7979}, [7979, 0, [[1389, 57]]]), ('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': [[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]]]), ('regression', {'grants': [[402, 28, 2], [4255, 65, 36], [2572, 56, 6], [4531, 25, 19], [2694, 48, 28]], 'day': 36, 'amount': 3121}, [3121, 0, [[2145, 56], [4255, 65]]]), ('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': [[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': [[402, 28, 2], [4255, 65, 36], [2572, 56, 6], [4531, 25, 19], [2694, 48, 28]], 'day': 36, 'amount': 3121}, [3121, 0, [[2145, 56], [4255, 65]]]), ('regression', {'grants': [[3489, 77, 37], [4072, 62, 23], [470, 62, 5], [2073, 40, 29], [1072, 34, 0]], 'day': 29, 'amount': 5684}, [5684, 0, [[2003, 62]]]), ('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': [[3812, 65, 19], [1707, 52, 18], [3211, 41, 24], [3775, 75, 29], [2654, 22, 1]], 'day': 41, 'amount': 6841}, [6841, 0, [[2453, 75]]]), ('normal control', {'grants': [], 'day': 33, 'amount': 11076}, [0, 11076, []]), ('normal control', {'grants': [[3257, 40, 31], [4520, 73, 40], [4293, 11, 10]], 'day': 40, 'amount': 1147}, [1147, 0, [[3373, 73]]]), ('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, []])], [('regression', {'grants': [[3489, 77, 37], [4072, 62, 23], [470, 62, 5], [2073, 40, 29], [1072, 34, 0]], 'day': 29, 'amount': 5684}, [5684, 0, [[2003, 62]]]), ('regression', {'grants': [[3971, 27, 11], [4895, 40, 6], [3338, 81, 23], [122, 78, 29], [4523, 78, 24]], 'day': 29, 'amount': 7395}, [7395, 0, [[2023, 78], [122, 78], [3338, 81]]]), ('partial-repair probe', {'grants': [[3812, 65, 19], [1707, 52, 18], [3211, 41, 24], [3775, 75, 29], [2654, 22, 1]], 'day': 41, 'amount': 6841}, [6841, 0, [[2453, 75]]]), ('partial-repair probe', {'grants': [[4874, 70, 33], [4203, 58, 8]], 'day': 33, 'amount': 972}, [972, 0, [[3231, 58], [4874, 70]]]), ('normal control', {'grants': [[3265, 3, 2], [961, 90, 30], [2437, 40, 28]], 'day': 3, 'amount': 6149}, [0, 6149, []]), ('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, []])]]\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-consumption-order","generated_at":"2026-09-29T14:46:39.391356+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 consumption order step: use `usable.sort(key=lambda g: (g[1], g[2]))`.","root_cause":"Grants are consumed oldest-granted first instead of soonest-expiring first.","sha256":"d7837890d9c09e6656c55480c3f46b4bee006f25177ec2e03754231596ff80f7","title":"Expiring credit grants applied to invoices: consumption order · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.458,"exit_code":1,"observations":[{"actual":[5792,0,[[280,58]]],"check":"regression 0","expected":[5792,0,[[280,68]]],"passed":false},{"actual":[3058,0,[[185,56],[4651,53],[3661,45]]],"check":"regression 1","expected":[3058,0,[[603,45],[4651,53],[3113,56],[130,62]]],"passed":false},{"actual":[236,0,[[1664,63],[4168,56]]],"check":"partial-repair probe 2","expected":[236,0,[[3932,56],[1900,63]]],"passed":false},{"actual":[2567,0,[[1085,78],[3344,61],[3775,47]]],"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, [[280, 58]]], \"expected\": [5792, 0, [[280, 68]]], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [3058, 0, [[185, 56], [4651, 53], [3661, 45]]], \"expected\": [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [236, 0, [[1664, 63], [4168, 56]]], \"expected\": [236, 0, [[3932, 56], [1900, 63]]], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [2567, 0, [[1085, 78], [3344, 61], [3775, 47]]], \"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":43.319,"exit_code":1,"observations":[{"actual":[5792,0,[[280,58]]],"check":"regression 0","expected":[5792,0,[[280,68]]],"passed":false},{"actual":[3058,0,[[733,45],[4651,53],[3113,56]]],"check":"regression 1","expected":[3058,0,[[603,45],[4651,53],[3113,56],[130,62]]],"passed":false},{"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":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [5792, 0, [[280, 58]]], \"expected\": [5792, 0, [[280, 68]]], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [3058, 0, [[733, 45], [4651, 53], [3113, 56]]], \"expected\": [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]], \"passed\": false}, {\"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\": false}\n"},"fixed":{"elapsed_ms":42.533,"exit_code":0,"observations":[{"actual":[5792,0,[[280,68]]],"check":"regression 0","expected":[5792,0,[[280,68]]],"passed":true},{"actual":[3058,0,[[603,45],[4651,53],[3113,56],[130,62]]],"check":"regression 1","expected":[3058,0,[[603,45],[4651,53],[3113,56],[130,62]]],"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\": [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]], \"expected\": [3058, 0, [[603, 45], [4651, 53], [3113, 56], [130, 62]]], \"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"}