{"abstract":"Prepaid toll account auto-replenishment returns a wrong result when replenishment is attempted with a declined card.","category":"Toll and parking fee computation","checks":8,"contract":"Input {balance, charges, threshold, min_replenish, usage_30d, card_ok}. The replenish amount is max(min_replenish, ceil(usage_30d/4) rounded up to a multiple of 500). After each charge, if the balance is strictly below threshold and the card works, one replenishment is added. first_negative is the index of the first charge after which the balance is negative (or null). Return {balance, replenished, first_negative}.","evaluation_group":"w2-toll_and_parking_fee_computation-auto-replenish","failed_approach":"Allowing one replenishment before honouring the decline still credits unpaid money.","family":"w2-toll_and_parking_fee_computation-auto-replenish-card-check","id":"FA-68636","implementations":{"attempt":{"sha256":"7d11dddd48c522d999d701bcd910424d12b61cadb15f4255f6672816fb9c29c8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    bal = x['balance']\n    n = 0\n    first = None\n    amt = max(x['min_replenish'], -(-x['usage_30d'] // 2000) * 500)\n    for i, c in enumerate(x['charges']):\n        bal -= c\n        if bal < x['threshold'] and (x['card_ok'] or n == 0):\n            bal += amt\n            n += 1\n        if bal < 0 and first is None:\n            first = i\n    return {'balance': bal, 'replenished': n, 'first_negative': first}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 1042, 'charges': [150, 400, 400, 275, 1200, 400, 1200, 650], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 3603, 'card_ok': False}, {'balance': -3633, 'replenished': 0, 'first_negative': 3}), ({'balance': 3098, 'charges': [275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 8704, 'card_ok': True}, {'balance': 2823, 'replenished': 0, 'first_negative': None}), ({'balance': 2083, 'charges': [400, 3000, 1200, 150, 3000, 150, 275, 400], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 15358, 'card_ok': True}, {'balance': 1508, 'replenished': 2, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2570, 'charges': [1200, 150], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 14152, 'card_ok': True}, {'balance': 1220, 'replenished': 0, 'first_negative': None}), ({'balance': -415, 'charges': [3000, 400, 150, 400, 3000, 650, 650, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 13000, 'card_ok': False}, {'balance': -8940, 'replenished': 0, 'first_negative': 0})], [({'balance': 960, 'charges': [150, 400], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 1855, 'card_ok': True}, {'balance': 2410, 'replenished': 1, 'first_negative': None}), ({'balance': 2103, 'charges': [400, 275, 1200, 3000], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 12226, 'card_ok': False}, {'balance': -2772, 'replenished': 0, 'first_negative': 3}), ({'balance': 2015, 'charges': [150], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 308, 'card_ok': True}, {'balance': 1865, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 2113, 'charges': [650, 3000, 400, 650, 1200, 400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 3260, 'card_ok': False}, {'balance': -4187, 'replenished': 0, 'first_negative': 1}), ({'balance': 3967, 'charges': [150, 275, 3000, 1200, 1200, 275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 8777, 'card_ok': True}, {'balance': 2867, 'replenished': 2, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None})], [({'balance': 397, 'charges': [400, 3000, 650], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 3118, 'card_ok': False}, {'balance': -3653, 'replenished': 0, 'first_negative': 0}), ({'balance': 173, 'charges': [1200, 400, 3000, 150], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 12679, 'card_ok': True}, {'balance': 2423, 'replenished': 2, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 3708, 'charges': [1200, 1200, 650, 1200, 650], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 11407, 'card_ok': True}, {'balance': 1808, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2856, 'charges': [150, 150, 1200, 150], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 8265, 'card_ok': True}, {'balance': 1206, 'replenished': 0, 'first_negative': None}), ({'balance': 2101, 'charges': [650, 150, 400, 1200, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 2791, 'card_ok': False}, {'balance': -574, 'replenished': 0, 'first_negative': 3})], [({'balance': 581, 'charges': [150, 3000, 400, 400], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 6330, 'card_ok': False}, {'balance': -3369, 'replenished': 0, 'first_negative': 1}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 30, 'charges': [150, 275, 400, 3000, 650], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 6576, 'card_ok': True}, {'balance': 3055, 'replenished': 3, 'first_negative': None}), ({'balance': 1352, 'charges': [1200], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 18621, 'card_ok': True}, {'balance': 5152, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2093, 'charges': [1200, 400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 228, 'card_ok': False}, {'balance': 493, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 2533, 'charges': [150, 650, 150, 400, 3000, 150, 3000], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 11845, 'card_ok': True}, {'balance': 4033, 'replenished': 3, 'first_negative': None})], [({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 3426, 'charges': [1200, 400], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 13777, 'card_ok': True}, {'balance': 1826, 'replenished': 0, 'first_negative': None}), ({'balance': 841, 'charges': [1200, 150], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 6647, 'card_ok': True}, {'balance': 1491, 'replenished': 1, 'first_negative': None}), ({'balance': 2207, 'charges': [3000, 3000, 1200, 275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 3869, 'card_ok': True}, {'balance': 2232, 'replenished': 3, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 1085, 'charges': [150, 3000, 275, 650, 275, 150, 275, 3000], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 2619, 'card_ok': False}, {'balance': -6690, 'replenished': 0, 'first_negative': 1}), ({'balance': -472, 'charges': [1200, 3000, 275, 650], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 16057, 'card_ok': False}, {'balance': -5597, 'replenished': 0, 'first_negative': 0})]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check('fee oracle' + ' %d' % 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":"b7a67d51090870ab7432ef584d11c9e005630114ffc8e20c025449ca52b74612","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    bal = x['balance']\n    n = 0\n    first = None\n    amt = max(x['min_replenish'], -(-x['usage_30d'] // 2000) * 500)\n    for i, c in enumerate(x['charges']):\n        bal -= c\n        if bal < x['threshold'] :\n            bal += amt\n            n += 1\n        if bal < 0 and first is None:\n            first = i\n    return {'balance': bal, 'replenished': n, 'first_negative': first}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 1042, 'charges': [150, 400, 400, 275, 1200, 400, 1200, 650], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 3603, 'card_ok': False}, {'balance': -3633, 'replenished': 0, 'first_negative': 3}), ({'balance': 3098, 'charges': [275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 8704, 'card_ok': True}, {'balance': 2823, 'replenished': 0, 'first_negative': None}), ({'balance': 2083, 'charges': [400, 3000, 1200, 150, 3000, 150, 275, 400], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 15358, 'card_ok': True}, {'balance': 1508, 'replenished': 2, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2570, 'charges': [1200, 150], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 14152, 'card_ok': True}, {'balance': 1220, 'replenished': 0, 'first_negative': None}), ({'balance': -415, 'charges': [3000, 400, 150, 400, 3000, 650, 650, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 13000, 'card_ok': False}, {'balance': -8940, 'replenished': 0, 'first_negative': 0})], [({'balance': 960, 'charges': [150, 400], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 1855, 'card_ok': True}, {'balance': 2410, 'replenished': 1, 'first_negative': None}), ({'balance': 2103, 'charges': [400, 275, 1200, 3000], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 12226, 'card_ok': False}, {'balance': -2772, 'replenished': 0, 'first_negative': 3}), ({'balance': 2015, 'charges': [150], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 308, 'card_ok': True}, {'balance': 1865, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 2113, 'charges': [650, 3000, 400, 650, 1200, 400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 3260, 'card_ok': False}, {'balance': -4187, 'replenished': 0, 'first_negative': 1}), ({'balance': 3967, 'charges': [150, 275, 3000, 1200, 1200, 275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 8777, 'card_ok': True}, {'balance': 2867, 'replenished': 2, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None})], [({'balance': 397, 'charges': [400, 3000, 650], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 3118, 'card_ok': False}, {'balance': -3653, 'replenished': 0, 'first_negative': 0}), ({'balance': 173, 'charges': [1200, 400, 3000, 150], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 12679, 'card_ok': True}, {'balance': 2423, 'replenished': 2, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 3708, 'charges': [1200, 1200, 650, 1200, 650], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 11407, 'card_ok': True}, {'balance': 1808, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2856, 'charges': [150, 150, 1200, 150], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 8265, 'card_ok': True}, {'balance': 1206, 'replenished': 0, 'first_negative': None}), ({'balance': 2101, 'charges': [650, 150, 400, 1200, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 2791, 'card_ok': False}, {'balance': -574, 'replenished': 0, 'first_negative': 3})], [({'balance': 581, 'charges': [150, 3000, 400, 400], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 6330, 'card_ok': False}, {'balance': -3369, 'replenished': 0, 'first_negative': 1}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 30, 'charges': [150, 275, 400, 3000, 650], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 6576, 'card_ok': True}, {'balance': 3055, 'replenished': 3, 'first_negative': None}), ({'balance': 1352, 'charges': [1200], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 18621, 'card_ok': True}, {'balance': 5152, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2093, 'charges': [1200, 400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 228, 'card_ok': False}, {'balance': 493, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 2533, 'charges': [150, 650, 150, 400, 3000, 150, 3000], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 11845, 'card_ok': True}, {'balance': 4033, 'replenished': 3, 'first_negative': None})], [({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 3426, 'charges': [1200, 400], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 13777, 'card_ok': True}, {'balance': 1826, 'replenished': 0, 'first_negative': None}), ({'balance': 841, 'charges': [1200, 150], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 6647, 'card_ok': True}, {'balance': 1491, 'replenished': 1, 'first_negative': None}), ({'balance': 2207, 'charges': [3000, 3000, 1200, 275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 3869, 'card_ok': True}, {'balance': 2232, 'replenished': 3, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 1085, 'charges': [150, 3000, 275, 650, 275, 150, 275, 3000], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 2619, 'card_ok': False}, {'balance': -6690, 'replenished': 0, 'first_negative': 1}), ({'balance': -472, 'charges': [1200, 3000, 275, 650], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 16057, 'card_ok': False}, {'balance': -5597, 'replenished': 0, 'first_negative': 0})]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check('fee oracle' + ' %d' % 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":"2b793f48cba4b2d64672f370bee7c09c733046b131bb1f170432db2740dec104","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    bal = x['balance']\n    n = 0\n    first = None\n    amt = max(x['min_replenish'], -(-x['usage_30d'] // 2000) * 500)\n    for i, c in enumerate(x['charges']):\n        bal -= c\n        if bal < x['threshold'] and x['card_ok']:\n            bal += amt\n            n += 1\n        if bal < 0 and first is None:\n            first = i\n    return {'balance': bal, 'replenished': n, 'first_negative': first}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 1042, 'charges': [150, 400, 400, 275, 1200, 400, 1200, 650], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 3603, 'card_ok': False}, {'balance': -3633, 'replenished': 0, 'first_negative': 3}), ({'balance': 3098, 'charges': [275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 8704, 'card_ok': True}, {'balance': 2823, 'replenished': 0, 'first_negative': None}), ({'balance': 2083, 'charges': [400, 3000, 1200, 150, 3000, 150, 275, 400], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 15358, 'card_ok': True}, {'balance': 1508, 'replenished': 2, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2570, 'charges': [1200, 150], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 14152, 'card_ok': True}, {'balance': 1220, 'replenished': 0, 'first_negative': None}), ({'balance': -415, 'charges': [3000, 400, 150, 400, 3000, 650, 650, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 13000, 'card_ok': False}, {'balance': -8940, 'replenished': 0, 'first_negative': 0})], [({'balance': 960, 'charges': [150, 400], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 1855, 'card_ok': True}, {'balance': 2410, 'replenished': 1, 'first_negative': None}), ({'balance': 2103, 'charges': [400, 275, 1200, 3000], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 12226, 'card_ok': False}, {'balance': -2772, 'replenished': 0, 'first_negative': 3}), ({'balance': 2015, 'charges': [150], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 308, 'card_ok': True}, {'balance': 1865, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 2113, 'charges': [650, 3000, 400, 650, 1200, 400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 3260, 'card_ok': False}, {'balance': -4187, 'replenished': 0, 'first_negative': 1}), ({'balance': 3967, 'charges': [150, 275, 3000, 1200, 1200, 275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 8777, 'card_ok': True}, {'balance': 2867, 'replenished': 2, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None})], [({'balance': 397, 'charges': [400, 3000, 650], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 3118, 'card_ok': False}, {'balance': -3653, 'replenished': 0, 'first_negative': 0}), ({'balance': 173, 'charges': [1200, 400, 3000, 150], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 12679, 'card_ok': True}, {'balance': 2423, 'replenished': 2, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 3708, 'charges': [1200, 1200, 650, 1200, 650], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 11407, 'card_ok': True}, {'balance': 1808, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2856, 'charges': [150, 150, 1200, 150], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 8265, 'card_ok': True}, {'balance': 1206, 'replenished': 0, 'first_negative': None}), ({'balance': 2101, 'charges': [650, 150, 400, 1200, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 2791, 'card_ok': False}, {'balance': -574, 'replenished': 0, 'first_negative': 3})], [({'balance': 581, 'charges': [150, 3000, 400, 400], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 6330, 'card_ok': False}, {'balance': -3369, 'replenished': 0, 'first_negative': 1}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 30, 'charges': [150, 275, 400, 3000, 650], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 6576, 'card_ok': True}, {'balance': 3055, 'replenished': 3, 'first_negative': None}), ({'balance': 1352, 'charges': [1200], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 18621, 'card_ok': True}, {'balance': 5152, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 2093, 'charges': [1200, 400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 228, 'card_ok': False}, {'balance': 493, 'replenished': 0, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 2533, 'charges': [150, 650, 150, 400, 3000, 150, 3000], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 11845, 'card_ok': True}, {'balance': 4033, 'replenished': 3, 'first_negative': None})], [({'balance': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 1400, 'charges': [400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': 3426, 'charges': [1200, 400], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 13777, 'card_ok': True}, {'balance': 1826, 'replenished': 0, 'first_negative': None}), ({'balance': 841, 'charges': [1200, 150], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 6647, 'card_ok': True}, {'balance': 1491, 'replenished': 1, 'first_negative': None}), ({'balance': 2207, 'charges': [3000, 3000, 1200, 275], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 3869, 'card_ok': True}, {'balance': 2232, 'replenished': 3, 'first_negative': None}), ({'balance': 300, 'charges': [400, 150, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': -525, 'replenished': 0, 'first_negative': 0}), ({'balance': 1085, 'charges': [150, 3000, 275, 650, 275, 150, 275, 3000], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 2619, 'card_ok': False}, {'balance': -6690, 'replenished': 0, 'first_negative': 1}), ({'balance': -472, 'charges': [1200, 3000, 275, 650], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 16057, 'card_ok': False}, {'balance': -5597, 'replenished': 0, 'first_negative': 0})]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check('fee oracle' + ' %d' % 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, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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-toll_and_parking_fee_computation-auto-replenish-card-check","generated_at":"2026-09-29T14:48:04.137250+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Fee engines bill customers in integer cents; a wrong boundary, rounding stage or cap scope silently over- or under-charges.","repair":"Restore the declined card rule so that the step reads `and x['card_ok']:`.","root_cause":"Declined cards still add replenishments to the balance.","sha256":"b6815fc897207b91af6463bfe08c97e3951690edc228a2cf3f3d5fb9e4eb7186","title":"Prepaid toll account auto-replenishment: replenishment is attempted with a declined card · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.861,"exit_code":1,"observations":[{"actual":{"balance":1000,"first_negative":null,"replenished":1},"check":"fee oracle 0","expected":{"balance":0,"first_negative":null,"replenished":0},"passed":false},{"actual":{"balance":-2633,"first_negative":4,"replenished":1},"check":"fee oracle 1","expected":{"balance":-3633,"first_negative":3,"replenished":0},"passed":false},{"actual":{"balance":2823,"first_negative":null,"replenished":0},"check":"fee oracle 2","expected":{"balance":2823,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":1508,"first_negative":null,"replenished":2},"check":"fee oracle 3","expected":{"balance":1508,"first_negative":null,"replenished":2},"passed":true},{"actual":{"balance":1000,"first_negative":null,"replenished":0},"check":"fee oracle 4","expected":{"balance":1000,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":3350,"first_negative":null,"replenished":1},"check":"fee oracle 5","expected":{"balance":3350,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":1220,"first_negative":null,"replenished":0},"check":"fee oracle 6","expected":{"balance":1220,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":-5440,"first_negative":1,"replenished":1},"check":"fee oracle 7","expected":{"balance":-8940,"first_negative":0,"replenished":0},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fee oracle 0\", \"actual\": {\"balance\": 1000, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"passed\": false}, {\"check\": \"fee oracle 1\", \"actual\": {\"balance\": -2633, \"replenished\": 1, \"first_negative\": 4}, \"expected\": {\"balance\": -3633, \"replenished\": 0, \"first_negative\": 3}, \"passed\": false}, {\"check\": \"fee oracle 2\", \"actual\": {\"balance\": 2823, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 2823, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 3\", \"actual\": {\"balance\": 1508, \"replenished\": 2, \"first_negative\": null}, \"expected\": {\"balance\": 1508, \"replenished\": 2, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 4\", \"actual\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 5\", \"actual\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 6\", \"actual\": {\"balance\": 1220, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1220, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 7\", \"actual\": {\"balance\": -5440, \"replenished\": 1, \"first_negative\": 1}, \"expected\": {\"balance\": -8940, \"replenished\": 0, \"first_negative\": 0}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.289,"exit_code":1,"observations":[{"actual":{"balance":1000,"first_negative":null,"replenished":1},"check":"fee oracle 0","expected":{"balance":0,"first_negative":null,"replenished":0},"passed":false},{"actual":{"balance":1367,"first_negative":null,"replenished":5},"check":"fee oracle 1","expected":{"balance":-3633,"first_negative":3,"replenished":0},"passed":false},{"actual":{"balance":2823,"first_negative":null,"replenished":0},"check":"fee oracle 2","expected":{"balance":2823,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":1508,"first_negative":null,"replenished":2},"check":"fee oracle 3","expected":{"balance":1508,"first_negative":null,"replenished":2},"passed":true},{"actual":{"balance":1000,"first_negative":null,"replenished":0},"check":"fee oracle 4","expected":{"balance":1000,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":3350,"first_negative":null,"replenished":1},"check":"fee oracle 5","expected":{"balance":3350,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":1220,"first_negative":null,"replenished":0},"check":"fee oracle 6","expected":{"balance":1220,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":1560,"first_negative":null,"replenished":3},"check":"fee oracle 7","expected":{"balance":-8940,"first_negative":0,"replenished":0},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fee oracle 0\", \"actual\": {\"balance\": 1000, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"passed\": false}, {\"check\": \"fee oracle 1\", \"actual\": {\"balance\": 1367, \"replenished\": 5, \"first_negative\": null}, \"expected\": {\"balance\": -3633, \"replenished\": 0, \"first_negative\": 3}, \"passed\": false}, {\"check\": \"fee oracle 2\", \"actual\": {\"balance\": 2823, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 2823, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 3\", \"actual\": {\"balance\": 1508, \"replenished\": 2, \"first_negative\": null}, \"expected\": {\"balance\": 1508, \"replenished\": 2, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 4\", \"actual\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 5\", \"actual\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 6\", \"actual\": {\"balance\": 1220, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1220, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 7\", \"actual\": {\"balance\": 1560, \"replenished\": 3, \"first_negative\": null}, \"expected\": {\"balance\": -8940, \"replenished\": 0, \"first_negative\": 0}, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.968,"exit_code":0,"observations":[{"actual":{"balance":0,"first_negative":null,"replenished":0},"check":"fee oracle 0","expected":{"balance":0,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":-3633,"first_negative":3,"replenished":0},"check":"fee oracle 1","expected":{"balance":-3633,"first_negative":3,"replenished":0},"passed":true},{"actual":{"balance":2823,"first_negative":null,"replenished":0},"check":"fee oracle 2","expected":{"balance":2823,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":1508,"first_negative":null,"replenished":2},"check":"fee oracle 3","expected":{"balance":1508,"first_negative":null,"replenished":2},"passed":true},{"actual":{"balance":1000,"first_negative":null,"replenished":0},"check":"fee oracle 4","expected":{"balance":1000,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":3350,"first_negative":null,"replenished":1},"check":"fee oracle 5","expected":{"balance":3350,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":1220,"first_negative":null,"replenished":0},"check":"fee oracle 6","expected":{"balance":1220,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":-8940,"first_negative":0,"replenished":0},"check":"fee oracle 7","expected":{"balance":-8940,"first_negative":0,"replenished":0},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fee oracle 0\", \"actual\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 1\", \"actual\": {\"balance\": -3633, \"replenished\": 0, \"first_negative\": 3}, \"expected\": {\"balance\": -3633, \"replenished\": 0, \"first_negative\": 3}, \"passed\": true}, {\"check\": \"fee oracle 2\", \"actual\": {\"balance\": 2823, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 2823, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 3\", \"actual\": {\"balance\": 1508, \"replenished\": 2, \"first_negative\": null}, \"expected\": {\"balance\": 1508, \"replenished\": 2, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 4\", \"actual\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 5\", \"actual\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 6\", \"actual\": {\"balance\": 1220, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1220, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 7\", \"actual\": {\"balance\": -8940, \"replenished\": 0, \"first_negative\": 0}, \"expected\": {\"balance\": -8940, \"replenished\": 0, \"first_negative\": 0}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}