{"abstract":"Prepaid toll account auto-replenishment returns a wrong result when a balance equal to the threshold triggers replenishment.","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":"Subtracting the charge a second time replenishes accounts that are still above threshold.","family":"w2-toll_and_parking_fee_computation-auto-replenish-threshold","id":"FA-68616","implementations":{"attempt":{"sha256":"f1a23af197fa1ce7f481079400f637af13f87f512e712c0b993923dbf3ecaa01","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 - c < 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': 2266, 'charges': [150, 1200, 3000, 400, 150, 650, 650], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 3563, 'card_ok': True}, {'balance': 1066, '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': -441, 'charges': [150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 1094, 'card_ok': True}, {'balance': 1409, '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': 2855, 'charges': [650, 1200], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 5906, 'card_ok': True}, {'balance': 1005, 'replenished': 0, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, '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': 2453, 'charges': [1200, 150, 650, 150, 150, 150, 275, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 18693, 'card_ok': False}, {'balance': -547, 'replenished': 0, 'first_negative': 6})], [({'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': 500, 'charges': [3000], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 12686, 'card_ok': True}, {'balance': 1000, 'replenished': 1, 'first_negative': None}), ({'balance': 3332, 'charges': [150, 400, 275, 1200, 150, 150, 275, 3000], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 4983, 'card_ok': True}, {'balance': -768, 'replenished': 1, 'first_negative': 7}), ({'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': 2401, 'charges': [3000, 275, 150, 150, 275], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 3761, 'card_ok': True}, {'balance': 1051, 'replenished': 1, 'first_negative': None}), ({'balance': 1390, 'charges': [150, 150, 1200, 150, 3000], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 10475, 'card_ok': True}, {'balance': 2740, 'replenished': 2, 'first_negative': None}), ({'balance': 3658, 'charges': [650, 150, 400, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 12188, 'card_ok': True}, {'balance': 2183, 'replenished': 0, 'first_negative': None})], [({'balance': -192, 'charges': [650, 3000, 650, 3000], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 9701, 'card_ok': True}, {'balance': 8, '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': 1210, 'charges': [400], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 7111, 'card_ok': True}, {'balance': 2810, 'replenished': 1, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 252, 'charges': [400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 7082, 'card_ok': True}, {'balance': 2352, 'replenished': 1, 'first_negative': None}), ({'balance': -78, 'charges': [650, 400], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 12782, 'card_ok': True}, {'balance': 2372, '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': 2049, 'charges': [650, 275, 650, 3000, 650, 400, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 12840, 'card_ok': True}, {'balance': 3149, 'replenished': 2, 'first_negative': None})], [({'balance': 2222, 'charges': [275, 650], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 19460, 'card_ok': True}, {'balance': 6297, 'replenished': 1, 'first_negative': None}), ({'balance': 650, 'charges': [1200, 650, 150, 400, 650, 275, 150, 150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 15662, 'card_ok': True}, {'balance': 1025, 'replenished': 1, 'first_negative': None}), ({'balance': 1372, 'charges': [400, 400, 3000, 650], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 1021, 'card_ok': True}, {'balance': 1922, 'replenished': 2, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, '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], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': -398, 'charges': [150, 400, 3000, 275, 150, 400, 1200, 1200], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 10518, 'card_ok': False}, {'balance': -7173, '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': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 587, 'charges': [1200, 3000, 650, 1200, 1200, 150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 12748, 'card_ok': True}, {'balance': 3687, 'replenished': 3, 'first_negative': None}), ({'balance': 1610, 'charges': [400, 1200, 150, 1200, 400, 650, 400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 4096, 'card_ok': True}, {'balance': 1710, 'replenished': 3, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 2876, 'charges': [3000, 400, 150, 275], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 2566, 'card_ok': True}, {'balance': 1051, 'replenished': 1, 'first_negative': None}), ({'balance': 2382, 'charges': [400, 1200, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 12535, 'card_ok': True}, {'balance': 507, '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': 1299, 'charges': [3000, 3000, 650], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 8830, 'card_ok': True}, {'balance': 2149, 'replenished': 3, 'first_negative': None})]]\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":"79b1d65d3b7ea9881c818edcdeb06b62763f89e6578560e7497c8b35de2de87d","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': 2266, 'charges': [150, 1200, 3000, 400, 150, 650, 650], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 3563, 'card_ok': True}, {'balance': 1066, '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': -441, 'charges': [150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 1094, 'card_ok': True}, {'balance': 1409, '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': 2855, 'charges': [650, 1200], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 5906, 'card_ok': True}, {'balance': 1005, 'replenished': 0, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, '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': 2453, 'charges': [1200, 150, 650, 150, 150, 150, 275, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 18693, 'card_ok': False}, {'balance': -547, 'replenished': 0, 'first_negative': 6})], [({'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': 500, 'charges': [3000], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 12686, 'card_ok': True}, {'balance': 1000, 'replenished': 1, 'first_negative': None}), ({'balance': 3332, 'charges': [150, 400, 275, 1200, 150, 150, 275, 3000], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 4983, 'card_ok': True}, {'balance': -768, 'replenished': 1, 'first_negative': 7}), ({'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': 2401, 'charges': [3000, 275, 150, 150, 275], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 3761, 'card_ok': True}, {'balance': 1051, 'replenished': 1, 'first_negative': None}), ({'balance': 1390, 'charges': [150, 150, 1200, 150, 3000], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 10475, 'card_ok': True}, {'balance': 2740, 'replenished': 2, 'first_negative': None}), ({'balance': 3658, 'charges': [650, 150, 400, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 12188, 'card_ok': True}, {'balance': 2183, 'replenished': 0, 'first_negative': None})], [({'balance': -192, 'charges': [650, 3000, 650, 3000], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 9701, 'card_ok': True}, {'balance': 8, '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': 1210, 'charges': [400], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 7111, 'card_ok': True}, {'balance': 2810, 'replenished': 1, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 252, 'charges': [400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 7082, 'card_ok': True}, {'balance': 2352, 'replenished': 1, 'first_negative': None}), ({'balance': -78, 'charges': [650, 400], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 12782, 'card_ok': True}, {'balance': 2372, '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': 2049, 'charges': [650, 275, 650, 3000, 650, 400, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 12840, 'card_ok': True}, {'balance': 3149, 'replenished': 2, 'first_negative': None})], [({'balance': 2222, 'charges': [275, 650], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 19460, 'card_ok': True}, {'balance': 6297, 'replenished': 1, 'first_negative': None}), ({'balance': 650, 'charges': [1200, 650, 150, 400, 650, 275, 150, 150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 15662, 'card_ok': True}, {'balance': 1025, 'replenished': 1, 'first_negative': None}), ({'balance': 1372, 'charges': [400, 400, 3000, 650], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 1021, 'card_ok': True}, {'balance': 1922, 'replenished': 2, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, '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], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': -398, 'charges': [150, 400, 3000, 275, 150, 400, 1200, 1200], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 10518, 'card_ok': False}, {'balance': -7173, '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': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 587, 'charges': [1200, 3000, 650, 1200, 1200, 150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 12748, 'card_ok': True}, {'balance': 3687, 'replenished': 3, 'first_negative': None}), ({'balance': 1610, 'charges': [400, 1200, 150, 1200, 400, 650, 400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 4096, 'card_ok': True}, {'balance': 1710, 'replenished': 3, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 2876, 'charges': [3000, 400, 150, 275], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 2566, 'card_ok': True}, {'balance': 1051, 'replenished': 1, 'first_negative': None}), ({'balance': 2382, 'charges': [400, 1200, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 12535, 'card_ok': True}, {'balance': 507, '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': 1299, 'charges': [3000, 3000, 650], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 8830, 'card_ok': True}, {'balance': 2149, 'replenished': 3, 'first_negative': None})]]\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":"ac8f5c65bb9124c2c372bd4d8d4c148e224f46f12c5b22a7ecf1cdfcb5db009c","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': 2266, 'charges': [150, 1200, 3000, 400, 150, 650, 650], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 3563, 'card_ok': True}, {'balance': 1066, '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': -441, 'charges': [150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 1094, 'card_ok': True}, {'balance': 1409, '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': 2855, 'charges': [650, 1200], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 5906, 'card_ok': True}, {'balance': 1005, 'replenished': 0, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, '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': 2453, 'charges': [1200, 150, 650, 150, 150, 150, 275, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 18693, 'card_ok': False}, {'balance': -547, 'replenished': 0, 'first_negative': 6})], [({'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': 500, 'charges': [3000], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 12686, 'card_ok': True}, {'balance': 1000, 'replenished': 1, 'first_negative': None}), ({'balance': 3332, 'charges': [150, 400, 275, 1200, 150, 150, 275, 3000], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 4983, 'card_ok': True}, {'balance': -768, 'replenished': 1, 'first_negative': 7}), ({'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': 2401, 'charges': [3000, 275, 150, 150, 275], 'threshold': 1000, 'min_replenish': 2500, 'usage_30d': 3761, 'card_ok': True}, {'balance': 1051, 'replenished': 1, 'first_negative': None}), ({'balance': 1390, 'charges': [150, 150, 1200, 150, 3000], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 10475, 'card_ok': True}, {'balance': 2740, 'replenished': 2, 'first_negative': None}), ({'balance': 3658, 'charges': [650, 150, 400, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 12188, 'card_ok': True}, {'balance': 2183, 'replenished': 0, 'first_negative': None})], [({'balance': -192, 'charges': [650, 3000, 650, 3000], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 9701, 'card_ok': True}, {'balance': 8, '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': 1210, 'charges': [400], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 7111, 'card_ok': True}, {'balance': 2810, 'replenished': 1, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 252, 'charges': [400], 'threshold': 500, 'min_replenish': 2500, 'usage_30d': 7082, 'card_ok': True}, {'balance': 2352, 'replenished': 1, 'first_negative': None}), ({'balance': -78, 'charges': [650, 400], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 12782, 'card_ok': True}, {'balance': 2372, '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': 2049, 'charges': [650, 275, 650, 3000, 650, 400, 275], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 12840, 'card_ok': True}, {'balance': 3149, 'replenished': 2, 'first_negative': None})], [({'balance': 2222, 'charges': [275, 650], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 19460, 'card_ok': True}, {'balance': 6297, 'replenished': 1, 'first_negative': None}), ({'balance': 650, 'charges': [1200, 650, 150, 400, 650, 275, 150, 150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 15662, 'card_ok': True}, {'balance': 1025, 'replenished': 1, 'first_negative': None}), ({'balance': 1372, 'charges': [400, 400, 3000, 650], 'threshold': 1500, 'min_replenish': 2500, 'usage_30d': 1021, 'card_ok': True}, {'balance': 1922, 'replenished': 2, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, '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], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 1000, 'replenished': 0, 'first_negative': None}), ({'balance': -398, 'charges': [150, 400, 3000, 275, 150, 400, 1200, 1200], 'threshold': 1500, 'min_replenish': 2000, 'usage_30d': 10518, 'card_ok': False}, {'balance': -7173, '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': 1400, 'charges': [400, 150], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 9000, 'card_ok': True}, {'balance': 3350, 'replenished': 1, 'first_negative': None}), ({'balance': 587, 'charges': [1200, 3000, 650, 1200, 1200, 150], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 12748, 'card_ok': True}, {'balance': 3687, 'replenished': 3, 'first_negative': None}), ({'balance': 1610, 'charges': [400, 1200, 150, 1200, 400, 650, 400], 'threshold': 1000, 'min_replenish': 1000, 'usage_30d': 4096, 'card_ok': True}, {'balance': 1710, 'replenished': 3, 'first_negative': None}), ({'balance': 400, 'charges': [400], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 0, 'card_ok': False}, {'balance': 0, 'replenished': 0, 'first_negative': None}), ({'balance': 2876, 'charges': [3000, 400, 150, 275], 'threshold': 1000, 'min_replenish': 2000, 'usage_30d': 2566, 'card_ok': True}, {'balance': 1051, 'replenished': 1, 'first_negative': None}), ({'balance': 2382, 'charges': [400, 1200, 275], 'threshold': 500, 'min_replenish': 1000, 'usage_30d': 12535, 'card_ok': True}, {'balance': 507, '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': 1299, 'charges': [3000, 3000, 650], 'threshold': 500, 'min_replenish': 2000, 'usage_30d': 8830, 'card_ok': True}, {'balance': 2149, 'replenished': 3, 'first_negative': None})]]\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-threshold","generated_at":"2026-09-29T14:48:03.876560+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 replenish threshold rule so that the step reads `if bal < x['threshold'] and x['card_ok']:`.","root_cause":"Balances exactly at the threshold are topped up early.","sha256":"e522fe29c50000f178add5e9c2058ed42bb3832350fda446ad3487ca67a56472","title":"Prepaid toll account auto-replenishment: a balance equal to the threshold triggers replenishment · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.702,"exit_code":1,"observations":[{"actual":{"balance":3566,"first_negative":null,"replenished":3},"check":"fee oracle 0","expected":{"balance":1066,"first_negative":null,"replenished":2},"passed":false},{"actual":{"balance":-525,"first_negative":0,"replenished":0},"check":"fee oracle 1","expected":{"balance":-525,"first_negative":0,"replenished":0},"passed":true},{"actual":{"balance":1409,"first_negative":null,"replenished":1},"check":"fee oracle 2","expected":{"balance":1409,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":3500,"first_negative":null,"replenished":1},"check":"fee oracle 3","expected":{"balance":1000,"first_negative":null,"replenished":0},"passed":false},{"actual":{"balance":3505,"first_negative":null,"replenished":1},"check":"fee oracle 4","expected":{"balance":1005,"first_negative":null,"replenished":0},"passed":false},{"actual":{"balance":0,"first_negative":null,"replenished":0},"check":"fee oracle 5","expected":{"balance":0,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":3350,"first_negative":null,"replenished":1},"check":"fee oracle 6","expected":{"balance":3350,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":-547,"first_negative":6,"replenished":0},"check":"fee oracle 7","expected":{"balance":-547,"first_negative":6,"replenished":0},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fee oracle 0\", \"actual\": {\"balance\": 3566, \"replenished\": 3, \"first_negative\": null}, \"expected\": {\"balance\": 1066, \"replenished\": 2, \"first_negative\": null}, \"passed\": false}, {\"check\": \"fee oracle 1\", \"actual\": {\"balance\": -525, \"replenished\": 0, \"first_negative\": 0}, \"expected\": {\"balance\": -525, \"replenished\": 0, \"first_negative\": 0}, \"passed\": true}, {\"check\": \"fee oracle 2\", \"actual\": {\"balance\": 1409, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 1409, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 3\", \"actual\": {\"balance\": 3500, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"passed\": false}, {\"check\": \"fee oracle 4\", \"actual\": {\"balance\": 3505, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 1005, \"replenished\": 0, \"first_negative\": null}, \"passed\": false}, {\"check\": \"fee oracle 5\", \"actual\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 6\", \"actual\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 7\", \"actual\": {\"balance\": -547, \"replenished\": 0, \"first_negative\": 6}, \"expected\": {\"balance\": -547, \"replenished\": 0, \"first_negative\": 6}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.863,"exit_code":1,"observations":[{"actual":{"balance":1066,"first_negative":null,"replenished":2},"check":"fee oracle 0","expected":{"balance":1066,"first_negative":null,"replenished":2},"passed":true},{"actual":{"balance":-525,"first_negative":0,"replenished":0},"check":"fee oracle 1","expected":{"balance":-525,"first_negative":0,"replenished":0},"passed":true},{"actual":{"balance":1409,"first_negative":null,"replenished":1},"check":"fee oracle 2","expected":{"balance":1409,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":3500,"first_negative":null,"replenished":1},"check":"fee oracle 3","expected":{"balance":1000,"first_negative":null,"replenished":0},"passed":false},{"actual":{"balance":1005,"first_negative":null,"replenished":0},"check":"fee oracle 4","expected":{"balance":1005,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":0,"first_negative":null,"replenished":0},"check":"fee oracle 5","expected":{"balance":0,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":3350,"first_negative":null,"replenished":1},"check":"fee oracle 6","expected":{"balance":3350,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":-547,"first_negative":6,"replenished":0},"check":"fee oracle 7","expected":{"balance":-547,"first_negative":6,"replenished":0},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fee oracle 0\", \"actual\": {\"balance\": 1066, \"replenished\": 2, \"first_negative\": null}, \"expected\": {\"balance\": 1066, \"replenished\": 2, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 1\", \"actual\": {\"balance\": -525, \"replenished\": 0, \"first_negative\": 0}, \"expected\": {\"balance\": -525, \"replenished\": 0, \"first_negative\": 0}, \"passed\": true}, {\"check\": \"fee oracle 2\", \"actual\": {\"balance\": 1409, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 1409, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 3\", \"actual\": {\"balance\": 3500, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"passed\": false}, {\"check\": \"fee oracle 4\", \"actual\": {\"balance\": 1005, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1005, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 5\", \"actual\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 6\", \"actual\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 7\", \"actual\": {\"balance\": -547, \"replenished\": 0, \"first_negative\": 6}, \"expected\": {\"balance\": -547, \"replenished\": 0, \"first_negative\": 6}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":47.766,"exit_code":0,"observations":[{"actual":{"balance":1066,"first_negative":null,"replenished":2},"check":"fee oracle 0","expected":{"balance":1066,"first_negative":null,"replenished":2},"passed":true},{"actual":{"balance":-525,"first_negative":0,"replenished":0},"check":"fee oracle 1","expected":{"balance":-525,"first_negative":0,"replenished":0},"passed":true},{"actual":{"balance":1409,"first_negative":null,"replenished":1},"check":"fee oracle 2","expected":{"balance":1409,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":1000,"first_negative":null,"replenished":0},"check":"fee oracle 3","expected":{"balance":1000,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":1005,"first_negative":null,"replenished":0},"check":"fee oracle 4","expected":{"balance":1005,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":0,"first_negative":null,"replenished":0},"check":"fee oracle 5","expected":{"balance":0,"first_negative":null,"replenished":0},"passed":true},{"actual":{"balance":3350,"first_negative":null,"replenished":1},"check":"fee oracle 6","expected":{"balance":3350,"first_negative":null,"replenished":1},"passed":true},{"actual":{"balance":-547,"first_negative":6,"replenished":0},"check":"fee oracle 7","expected":{"balance":-547,"first_negative":6,"replenished":0},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fee oracle 0\", \"actual\": {\"balance\": 1066, \"replenished\": 2, \"first_negative\": null}, \"expected\": {\"balance\": 1066, \"replenished\": 2, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 1\", \"actual\": {\"balance\": -525, \"replenished\": 0, \"first_negative\": 0}, \"expected\": {\"balance\": -525, \"replenished\": 0, \"first_negative\": 0}, \"passed\": true}, {\"check\": \"fee oracle 2\", \"actual\": {\"balance\": 1409, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 1409, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 3\", \"actual\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1000, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 4\", \"actual\": {\"balance\": 1005, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 1005, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 5\", \"actual\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"expected\": {\"balance\": 0, \"replenished\": 0, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 6\", \"actual\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"expected\": {\"balance\": 3350, \"replenished\": 1, \"first_negative\": null}, \"passed\": true}, {\"check\": \"fee oracle 7\", \"actual\": {\"balance\": -547, \"replenished\": 0, \"first_negative\": 6}, \"expected\": {\"balance\": -547, \"replenished\": 0, \"first_negative\": 6}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}