{"abstract":"Discounted prorations drift by cents proportional to the quantity.","category":"Subscription proration billing","checks":8,"contract":"Input {unit, old, new quantities, tiers: ascending [[min_qty, pct_off]], left, period}. A quantity's discount is the pct of the last tier with qty >= min_qty and applies to all units: total(q) = q*unit*(100-pct) in cent-percent. Proration of q = total(q)*left/(100*period) half-up. Return [-proration(old), proration(new)].","evaluation_group":"w2-subscription-proration-volume-discount-quantity-change","failed_approach":"The attempt truncates the discounted unit price instead, still rounding before quantity.","family":"w2-subscription-proration-volume-discount-quantity-change-discounted-unit-rounding","id":"FA-59696","implementations":{"attempt":{"sha256":"b87831a39da779c0aafda10c1c42cc065909d8b37ea2b5624c6b1b665220c3c8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def tier_pct(q):\n        pct = 0\n        for mn, off in x['tiers']:\n            if q >= mn:\n                pct = off\n        return pct\n    def total(q):\n        return q * (x['unit'] * (100 - tier_pct(q)) // 100) * 100\n    def pr(q):\n        return (total(q) * x['left'] * 2 + 100 * x['period']) // (200 * x['period'])\n    return [-pr(x['old']), pr(x['new'])]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'unit': 1396, 'old': 18, 'new': 39, 'tiers': [[1, 0], [5, 10], [31, 25]], 'left': 21, 'period': 31}, [-15320, 27661]), ('regression', {'unit': 999, 'old': 18, 'new': 1, 'tiers': [[1, 0], [8, 10], [28, 15]], 'left': 25, 'period': 31}, [-13051, 806]), ('partial-repair probe', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('partial-repair probe', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('normal control', {'unit': 1500, 'old': 37, 'new': 19, 'tiers': [[1, 0], [5, 5], [28, 15]], 'left': 13, 'period': 31}, [-19783, 11354]), ('normal control', {'unit': 1500, 'old': 21, 'new': 45, 'tiers': [[1, 0], [7, 10], [29, 20]], 'left': 20, 'period': 31}, [-18290, 34839]), ('normal control', {'unit': 1000, 'old': 9, 'new': 22, 'tiers': [[1, 0], [8, 5], [22, 20]], 'left': 24, 'period': 31}, [-6619, 13626]), ('normal control', {'unit': 999, 'old': 1, 'new': 19, 'tiers': [[1, 0], [10, 5], [31, 25]], 'left': 1, 'period': 31}, [-32, 582])], [('regression', {'unit': 999, 'old': 18, 'new': 1, 'tiers': [[1, 0], [8, 10], [28, 15]], 'left': 25, 'period': 31}, [-13051, 806]), ('regression', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('partial-repair probe', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('partial-repair probe', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('normal control', {'unit': 1500, 'old': 38, 'new': 12, 'tiers': [[1, 0], [8, 10], [31, 25]], 'left': 15, 'period': 31}, [-20685, 7839]), ('normal control', {'unit': 1500, 'old': 22, 'new': 32, 'tiers': [[1, 0], [5, 5], [35, 25]], 'left': 9, 'period': 31}, [-9102, 13239]), ('normal control', {'unit': 1500, 'old': 6, 'new': 44, 'tiers': [[1, 0], [10, 10], [22, 15]], 'left': 22, 'period': 31}, [-6387, 39813]), ('normal control', {'unit': 1000, 'old': 48, 'new': 14, 'tiers': [[1, 0], [9, 5], [31, 20]], 'left': 21, 'period': 31}, [-26013, 9010])], [('regression', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('regression', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('partial-repair probe', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('partial-repair probe', {'unit': 999, 'old': 39, 'new': 26, 'tiers': [[1, 0], [7, 10], [32, 15]], 'left': 27, 'period': 31}, [-28844, 20360]), ('normal control', {'unit': 1500, 'old': 26, 'new': 40, 'tiers': [[1, 0], [7, 10], [26, 20]], 'left': 20, 'period': 31}, [-20129, 30968]), ('normal control', {'unit': 1000, 'old': 5, 'new': 17, 'tiers': [[1, 0], [5, 5], [37, 25]], 'left': 10, 'period': 31}, [-1532, 5210]), ('normal control', {'unit': 1000, 'old': 27, 'new': 46, 'tiers': [[1, 0], [9, 5], [20, 15]], 'left': 4, 'period': 31}, [-2961, 5045]), ('normal control', {'unit': 1000, 'old': 18, 'new': 17, 'tiers': [[1, 0], [10, 10], [32, 25]], 'left': 24, 'period': 31}, [-12542, 11845])], [('regression', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('regression', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('partial-repair probe', {'unit': 999, 'old': 9, 'new': 38, 'tiers': [[1, 0], [6, 5], [32, 15]], 'left': 27, 'period': 31}, [-7439, 28104]), ('partial-repair probe', {'unit': 999, 'old': 10, 'new': 1, 'tiers': [[1, 0], [5, 10], [22, 15]], 'left': 29, 'period': 31}, [-8411, 935]), ('normal control', {'unit': 1000, 'old': 41, 'new': 30, 'tiers': [[1, 0], [5, 5], [20, 15]], 'left': 23, 'period': 31}, [-25856, 18919]), ('normal control', {'unit': 1000, 'old': 1, 'new': 2, 'tiers': [[1, 0], [10, 5], [21, 20]], 'left': 30, 'period': 31}, [-968, 1935]), ('normal control', {'unit': 1500, 'old': 42, 'new': 42, 'tiers': [[1, 0], [9, 10], [33, 25]], 'left': 30, 'period': 31}, [-45726, 45726]), ('normal control', {'unit': 1500, 'old': 45, 'new': 35, 'tiers': [[1, 0], [9, 10], [25, 25]], 'left': 26, 'period': 31}, [-42460, 33024])], [('regression', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('regression', {'unit': 999, 'old': 39, 'new': 26, 'tiers': [[1, 0], [7, 10], [32, 15]], 'left': 27, 'period': 31}, [-28844, 20360]), ('partial-repair probe', {'unit': 999, 'old': 24, 'new': 6, 'tiers': [[1, 0], [5, 10], [35, 15]], 'left': 27, 'period': 31}, [-18794, 4699]), ('partial-repair probe', {'unit': 999, 'old': 37, 'new': 45, 'tiers': [[1, 0], [9, 10], [25, 20]], 'left': 31, 'period': 31}, [-29570, 35964]), ('normal control', {'unit': 999, 'old': 21, 'new': 1, 'tiers': [[1, 0], [10, 5], [31, 20]], 'left': 9, 'period': 31}, [-5786, 290]), ('normal control', {'unit': 1000, 'old': 27, 'new': 21, 'tiers': [[1, 0], [8, 10], [36, 15]], 'left': 24, 'period': 31}, [-18813, 14632]), ('normal control', {'unit': 1000, 'old': 4, 'new': 9, 'tiers': [[1, 0], [6, 10], [23, 20]], 'left': 30, 'period': 31}, [-3871, 7839]), ('normal control', {'unit': 1000, 'old': 26, 'new': 40, 'tiers': [[1, 0], [5, 5], [36, 25]], 'left': 25, 'period': 31}, [-19919, 24194])]]\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":"47d81172c6f9d909707f987203f0778e1b4a0585bd262cf9dd61fe82c4da2f03","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def tier_pct(q):\n        pct = 0\n        for mn, off in x['tiers']:\n            if q >= mn:\n                pct = off\n        return pct\n    def total(q):\n        return q * ((x['unit'] * (100 - tier_pct(q)) + 50) // 100) * 100\n    def pr(q):\n        return (total(q) * x['left'] * 2 + 100 * x['period']) // (200 * x['period'])\n    return [-pr(x['old']), pr(x['new'])]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'unit': 1396, 'old': 18, 'new': 39, 'tiers': [[1, 0], [5, 10], [31, 25]], 'left': 21, 'period': 31}, [-15320, 27661]), ('regression', {'unit': 999, 'old': 18, 'new': 1, 'tiers': [[1, 0], [8, 10], [28, 15]], 'left': 25, 'period': 31}, [-13051, 806]), ('partial-repair probe', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('partial-repair probe', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('normal control', {'unit': 1500, 'old': 37, 'new': 19, 'tiers': [[1, 0], [5, 5], [28, 15]], 'left': 13, 'period': 31}, [-19783, 11354]), ('normal control', {'unit': 1500, 'old': 21, 'new': 45, 'tiers': [[1, 0], [7, 10], [29, 20]], 'left': 20, 'period': 31}, [-18290, 34839]), ('normal control', {'unit': 1000, 'old': 9, 'new': 22, 'tiers': [[1, 0], [8, 5], [22, 20]], 'left': 24, 'period': 31}, [-6619, 13626]), ('normal control', {'unit': 999, 'old': 1, 'new': 19, 'tiers': [[1, 0], [10, 5], [31, 25]], 'left': 1, 'period': 31}, [-32, 582])], [('regression', {'unit': 999, 'old': 18, 'new': 1, 'tiers': [[1, 0], [8, 10], [28, 15]], 'left': 25, 'period': 31}, [-13051, 806]), ('regression', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('partial-repair probe', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('partial-repair probe', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('normal control', {'unit': 1500, 'old': 38, 'new': 12, 'tiers': [[1, 0], [8, 10], [31, 25]], 'left': 15, 'period': 31}, [-20685, 7839]), ('normal control', {'unit': 1500, 'old': 22, 'new': 32, 'tiers': [[1, 0], [5, 5], [35, 25]], 'left': 9, 'period': 31}, [-9102, 13239]), ('normal control', {'unit': 1500, 'old': 6, 'new': 44, 'tiers': [[1, 0], [10, 10], [22, 15]], 'left': 22, 'period': 31}, [-6387, 39813]), ('normal control', {'unit': 1000, 'old': 48, 'new': 14, 'tiers': [[1, 0], [9, 5], [31, 20]], 'left': 21, 'period': 31}, [-26013, 9010])], [('regression', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('regression', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('partial-repair probe', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('partial-repair probe', {'unit': 999, 'old': 39, 'new': 26, 'tiers': [[1, 0], [7, 10], [32, 15]], 'left': 27, 'period': 31}, [-28844, 20360]), ('normal control', {'unit': 1500, 'old': 26, 'new': 40, 'tiers': [[1, 0], [7, 10], [26, 20]], 'left': 20, 'period': 31}, [-20129, 30968]), ('normal control', {'unit': 1000, 'old': 5, 'new': 17, 'tiers': [[1, 0], [5, 5], [37, 25]], 'left': 10, 'period': 31}, [-1532, 5210]), ('normal control', {'unit': 1000, 'old': 27, 'new': 46, 'tiers': [[1, 0], [9, 5], [20, 15]], 'left': 4, 'period': 31}, [-2961, 5045]), ('normal control', {'unit': 1000, 'old': 18, 'new': 17, 'tiers': [[1, 0], [10, 10], [32, 25]], 'left': 24, 'period': 31}, [-12542, 11845])], [('regression', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('regression', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('partial-repair probe', {'unit': 999, 'old': 9, 'new': 38, 'tiers': [[1, 0], [6, 5], [32, 15]], 'left': 27, 'period': 31}, [-7439, 28104]), ('partial-repair probe', {'unit': 999, 'old': 10, 'new': 1, 'tiers': [[1, 0], [5, 10], [22, 15]], 'left': 29, 'period': 31}, [-8411, 935]), ('normal control', {'unit': 1000, 'old': 41, 'new': 30, 'tiers': [[1, 0], [5, 5], [20, 15]], 'left': 23, 'period': 31}, [-25856, 18919]), ('normal control', {'unit': 1000, 'old': 1, 'new': 2, 'tiers': [[1, 0], [10, 5], [21, 20]], 'left': 30, 'period': 31}, [-968, 1935]), ('normal control', {'unit': 1500, 'old': 42, 'new': 42, 'tiers': [[1, 0], [9, 10], [33, 25]], 'left': 30, 'period': 31}, [-45726, 45726]), ('normal control', {'unit': 1500, 'old': 45, 'new': 35, 'tiers': [[1, 0], [9, 10], [25, 25]], 'left': 26, 'period': 31}, [-42460, 33024])], [('regression', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('regression', {'unit': 999, 'old': 39, 'new': 26, 'tiers': [[1, 0], [7, 10], [32, 15]], 'left': 27, 'period': 31}, [-28844, 20360]), ('partial-repair probe', {'unit': 999, 'old': 24, 'new': 6, 'tiers': [[1, 0], [5, 10], [35, 15]], 'left': 27, 'period': 31}, [-18794, 4699]), ('partial-repair probe', {'unit': 999, 'old': 37, 'new': 45, 'tiers': [[1, 0], [9, 10], [25, 20]], 'left': 31, 'period': 31}, [-29570, 35964]), ('normal control', {'unit': 999, 'old': 21, 'new': 1, 'tiers': [[1, 0], [10, 5], [31, 20]], 'left': 9, 'period': 31}, [-5786, 290]), ('normal control', {'unit': 1000, 'old': 27, 'new': 21, 'tiers': [[1, 0], [8, 10], [36, 15]], 'left': 24, 'period': 31}, [-18813, 14632]), ('normal control', {'unit': 1000, 'old': 4, 'new': 9, 'tiers': [[1, 0], [6, 10], [23, 20]], 'left': 30, 'period': 31}, [-3871, 7839]), ('normal control', {'unit': 1000, 'old': 26, 'new': 40, 'tiers': [[1, 0], [5, 5], [36, 25]], 'left': 25, 'period': 31}, [-19919, 24194])]]\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":"dbf508407b7211694bc641f4a41f0c4cccf8cca9f24669abf97480e565d9ec11","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    def tier_pct(q):\n        pct = 0\n        for mn, off in x['tiers']:\n            if q >= mn:\n                pct = off\n        return pct\n    def total(q):\n        return q * x['unit'] * (100 - tier_pct(q))\n    def pr(q):\n        return (total(q) * x['left'] * 2 + 100 * x['period']) // (200 * x['period'])\n    return [-pr(x['old']), pr(x['new'])]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'unit': 1396, 'old': 18, 'new': 39, 'tiers': [[1, 0], [5, 10], [31, 25]], 'left': 21, 'period': 31}, [-15320, 27661]), ('regression', {'unit': 999, 'old': 18, 'new': 1, 'tiers': [[1, 0], [8, 10], [28, 15]], 'left': 25, 'period': 31}, [-13051, 806]), ('partial-repair probe', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('partial-repair probe', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('normal control', {'unit': 1500, 'old': 37, 'new': 19, 'tiers': [[1, 0], [5, 5], [28, 15]], 'left': 13, 'period': 31}, [-19783, 11354]), ('normal control', {'unit': 1500, 'old': 21, 'new': 45, 'tiers': [[1, 0], [7, 10], [29, 20]], 'left': 20, 'period': 31}, [-18290, 34839]), ('normal control', {'unit': 1000, 'old': 9, 'new': 22, 'tiers': [[1, 0], [8, 5], [22, 20]], 'left': 24, 'period': 31}, [-6619, 13626]), ('normal control', {'unit': 999, 'old': 1, 'new': 19, 'tiers': [[1, 0], [10, 5], [31, 25]], 'left': 1, 'period': 31}, [-32, 582])], [('regression', {'unit': 999, 'old': 18, 'new': 1, 'tiers': [[1, 0], [8, 10], [28, 15]], 'left': 25, 'period': 31}, [-13051, 806]), ('regression', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('partial-repair probe', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('partial-repair probe', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('normal control', {'unit': 1500, 'old': 38, 'new': 12, 'tiers': [[1, 0], [8, 10], [31, 25]], 'left': 15, 'period': 31}, [-20685, 7839]), ('normal control', {'unit': 1500, 'old': 22, 'new': 32, 'tiers': [[1, 0], [5, 5], [35, 25]], 'left': 9, 'period': 31}, [-9102, 13239]), ('normal control', {'unit': 1500, 'old': 6, 'new': 44, 'tiers': [[1, 0], [10, 10], [22, 15]], 'left': 22, 'period': 31}, [-6387, 39813]), ('normal control', {'unit': 1000, 'old': 48, 'new': 14, 'tiers': [[1, 0], [9, 5], [31, 20]], 'left': 21, 'period': 31}, [-26013, 9010])], [('regression', {'unit': 4294, 'old': 31, 'new': 18, 'tiers': [[1, 0], [10, 5], [21, 25]], 'left': 12, 'period': 31}, [-38646, 28424]), ('regression', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('partial-repair probe', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('partial-repair probe', {'unit': 999, 'old': 39, 'new': 26, 'tiers': [[1, 0], [7, 10], [32, 15]], 'left': 27, 'period': 31}, [-28844, 20360]), ('normal control', {'unit': 1500, 'old': 26, 'new': 40, 'tiers': [[1, 0], [7, 10], [26, 20]], 'left': 20, 'period': 31}, [-20129, 30968]), ('normal control', {'unit': 1000, 'old': 5, 'new': 17, 'tiers': [[1, 0], [5, 5], [37, 25]], 'left': 10, 'period': 31}, [-1532, 5210]), ('normal control', {'unit': 1000, 'old': 27, 'new': 46, 'tiers': [[1, 0], [9, 5], [20, 15]], 'left': 4, 'period': 31}, [-2961, 5045]), ('normal control', {'unit': 1000, 'old': 18, 'new': 17, 'tiers': [[1, 0], [10, 10], [32, 25]], 'left': 24, 'period': 31}, [-12542, 11845])], [('regression', {'unit': 4525, 'old': 44, 'new': 17, 'tiers': [[1, 0], [5, 5], [26, 15]], 'left': 7, 'period': 31}, [-38214, 16502]), ('regression', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('partial-repair probe', {'unit': 999, 'old': 9, 'new': 38, 'tiers': [[1, 0], [6, 5], [32, 15]], 'left': 27, 'period': 31}, [-7439, 28104]), ('partial-repair probe', {'unit': 999, 'old': 10, 'new': 1, 'tiers': [[1, 0], [5, 10], [22, 15]], 'left': 29, 'period': 31}, [-8411, 935]), ('normal control', {'unit': 1000, 'old': 41, 'new': 30, 'tiers': [[1, 0], [5, 5], [20, 15]], 'left': 23, 'period': 31}, [-25856, 18919]), ('normal control', {'unit': 1000, 'old': 1, 'new': 2, 'tiers': [[1, 0], [10, 5], [21, 20]], 'left': 30, 'period': 31}, [-968, 1935]), ('normal control', {'unit': 1500, 'old': 42, 'new': 42, 'tiers': [[1, 0], [9, 10], [33, 25]], 'left': 30, 'period': 31}, [-45726, 45726]), ('normal control', {'unit': 1500, 'old': 45, 'new': 35, 'tiers': [[1, 0], [9, 10], [25, 25]], 'left': 26, 'period': 31}, [-42460, 33024])], [('regression', {'unit': 999, 'old': 14, 'new': 7, 'tiers': [[1, 0], [8, 10], [27, 25]], 'left': 24, 'period': 31}, [-9745, 5414]), ('regression', {'unit': 999, 'old': 39, 'new': 26, 'tiers': [[1, 0], [7, 10], [32, 15]], 'left': 27, 'period': 31}, [-28844, 20360]), ('partial-repair probe', {'unit': 999, 'old': 24, 'new': 6, 'tiers': [[1, 0], [5, 10], [35, 15]], 'left': 27, 'period': 31}, [-18794, 4699]), ('partial-repair probe', {'unit': 999, 'old': 37, 'new': 45, 'tiers': [[1, 0], [9, 10], [25, 20]], 'left': 31, 'period': 31}, [-29570, 35964]), ('normal control', {'unit': 999, 'old': 21, 'new': 1, 'tiers': [[1, 0], [10, 5], [31, 20]], 'left': 9, 'period': 31}, [-5786, 290]), ('normal control', {'unit': 1000, 'old': 27, 'new': 21, 'tiers': [[1, 0], [8, 10], [36, 15]], 'left': 24, 'period': 31}, [-18813, 14632]), ('normal control', {'unit': 1000, 'old': 4, 'new': 9, 'tiers': [[1, 0], [6, 10], [23, 20]], 'left': 30, 'period': 31}, [-3871, 7839]), ('normal control', {'unit': 1000, 'old': 26, 'new': 40, 'tiers': [[1, 0], [5, 5], [36, 25]], 'left': 25, 'period': 31}, [-19919, 24194])]]\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-volume-discount-quantity-change-discounted-unit-rounding","generated_at":"2026-09-29T14:46:38.789694+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Crossing a volume tier on a mid-cycle quantity change re-prices every unit for the rest of the period.","repair":"Restore the contract rule at the discounted unit rounding step: use `return q * x['unit'] * (100 - tier_pct(q))`.","root_cause":"The discounted unit price is rounded to cents before multiplying by quantity.","sha256":"49e0c69aec64850495074b8cafb92d42e655485703f2876b15bd4ca2ad799f21","title":"Volume discount tiers on quantity changes: discounted unit rounding · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.981,"exit_code":1,"observations":[{"actual":[-15315,27661],"check":"regression 0","expected":[-15320,27661],"passed":false},{"actual":[-13050,806],"check":"regression 1","expected":[-13051,806],"passed":false},{"actual":[-38640,28421],"check":"partial-repair probe 2","expected":[-38646,28424],"passed":false},{"actual":[-38212,16499],"check":"partial-repair probe 3","expected":[-38214,16502],"passed":false},{"actual":[-19783,11354],"check":"normal control 4","expected":[-19783,11354],"passed":true},{"actual":[-18290,34839],"check":"normal control 5","expected":[-18290,34839],"passed":true},{"actual":[-6619,13626],"check":"normal control 6","expected":[-6619,13626],"passed":true},{"actual":[-32,582],"check":"normal control 7","expected":[-32,582],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [-15315, 27661], \"expected\": [-15320, 27661], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [-13050, 806], \"expected\": [-13051, 806], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [-38640, 28421], \"expected\": [-38646, 28424], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [-38212, 16499], \"expected\": [-38214, 16502], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [-19783, 11354], \"expected\": [-19783, 11354], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [-18290, 34839], \"expected\": [-18290, 34839], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [-6619, 13626], \"expected\": [-6619, 13626], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [-32, 582], \"expected\": [-32, 582], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.064,"exit_code":1,"observations":[{"actual":[-15315,27661],"check":"regression 0","expected":[-15320,27661],"passed":false},{"actual":[-13050,806],"check":"regression 1","expected":[-13051,806],"passed":false},{"actual":[-38652,28421],"check":"partial-repair probe 2","expected":[-38646,28424],"passed":false},{"actual":[-38212,16503],"check":"partial-repair probe 3","expected":[-38214,16502],"passed":false},{"actual":[-19783,11354],"check":"normal control 4","expected":[-19783,11354],"passed":true},{"actual":[-18290,34839],"check":"normal control 5","expected":[-18290,34839],"passed":true},{"actual":[-6619,13626],"check":"normal control 6","expected":[-6619,13626],"passed":true},{"actual":[-32,582],"check":"normal control 7","expected":[-32,582],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [-15315, 27661], \"expected\": [-15320, 27661], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [-13050, 806], \"expected\": [-13051, 806], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [-38652, 28421], \"expected\": [-38646, 28424], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [-38212, 16503], \"expected\": [-38214, 16502], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [-19783, 11354], \"expected\": [-19783, 11354], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [-18290, 34839], \"expected\": [-18290, 34839], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [-6619, 13626], \"expected\": [-6619, 13626], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [-32, 582], \"expected\": [-32, 582], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.387,"exit_code":0,"observations":[{"actual":[-15320,27661],"check":"regression 0","expected":[-15320,27661],"passed":true},{"actual":[-13051,806],"check":"regression 1","expected":[-13051,806],"passed":true},{"actual":[-38646,28424],"check":"partial-repair probe 2","expected":[-38646,28424],"passed":true},{"actual":[-38214,16502],"check":"partial-repair probe 3","expected":[-38214,16502],"passed":true},{"actual":[-19783,11354],"check":"normal control 4","expected":[-19783,11354],"passed":true},{"actual":[-18290,34839],"check":"normal control 5","expected":[-18290,34839],"passed":true},{"actual":[-6619,13626],"check":"normal control 6","expected":[-6619,13626],"passed":true},{"actual":[-32,582],"check":"normal control 7","expected":[-32,582],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [-15320, 27661], \"expected\": [-15320, 27661], \"passed\": true}, {\"check\": \"regression 1\", \"actual\": [-13051, 806], \"expected\": [-13051, 806], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [-38646, 28424], \"expected\": [-38646, 28424], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [-38214, 16502], \"expected\": [-38214, 16502], \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": [-19783, 11354], \"expected\": [-19783, 11354], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [-18290, 34839], \"expected\": [-18290, 34839], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [-6619, 13626], \"expected\": [-6619, 13626], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [-32, 582], \"expected\": [-32, 582], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}