{"abstract":"Downgrade invoices over-collect tax because unused-time credits carry no tax reversal.","category":"Subscription proration billing","checks":8,"contract":"Input {lines: [[signed cents, taxable]], rate_bp}. Tax is computed per taxable line, including negative credit lines (negative tax), each rounded half away from zero, then summed. Subtotal is the sum of all lines. Return [subtotal, tax, subtotal + tax].","contract_signature":"x","evaluation_group":"w2-subscription-proration-proration-line-tax","failed_approach":"The attempt includes credit lines even when they are not taxable.","family":"w2-subscription-proration-proration-line-tax-credit-line-tax-reversal","id":"FA-59526","implementations":{"attempt":{"sha256":"98840712827ae55daf081ad0739f1dc27b6c6cf8e979aac5d4a4a2c3f0a0943b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    parts = []\n    for amt, taxable in x['lines']:\n        if taxable or amt < 0:\n            parts.append(amt * x['rate_bp'])\n    def hr(n):\n        t = (abs(n) * 2 + 10000) // 20000\n        return t if n >= 0 else -t\n    tax = sum(hr(n) for n in parts)\n    sub = sum(a for a, t in x['lines'])\n    return [sub, tax, sub + tax]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'lines': [[-30768, True], [88008, True], [58540, True], [-18089, False]], 'rate_bp': 50}, [97691, 579, 98270]), ('regression', {'lines': [[53, True], [-19388, True], [67, True]], 'rate_bp': 2000}, [-19268, -3854, -23122]), ('partial-repair probe', {'lines': [[-51735, False]], 'rate_bp': 2267}, [-51735, 0, -51735]), ('partial-repair probe', {'lines': [[-42950, False], [83094, False], [74700, False], [-33526, False]], 'rate_bp': 725}, [81318, 0, 81318]), ('normal control', {'lines': [[70, True]], 'rate_bp': 825}, [70, 6, 76]), ('normal control', {'lines': [[52, True], [19, False], [14472, True], [91, False]], 'rate_bp': 297}, [14634, 432, 15066]), ('normal control', {'lines': [[78656, True]], 'rate_bp': 1498}, [78656, 11783, 90439]), ('normal control', {'lines': [[74, True], [81059, True], [70668, True]], 'rate_bp': 825}, [151801, 12523, 164324])], [('regression', {'lines': [[-12837, True], [-41474, True], [88408, True], [-5186, False]], 'rate_bp': 1738}, [28911, 5926, 34837]), ('regression', {'lines': [[53, True], [-19388, True], [67, True]], 'rate_bp': 2000}, [-19268, -3854, -23122]), ('partial-repair probe', {'lines': [[-42950, False], [83094, False], [74700, False], [-33526, False]], 'rate_bp': 725}, [81318, 0, 81318]), ('partial-repair probe', {'lines': [[30278, True], [-25624, False], [18105, True]], 'rate_bp': 50}, [22759, 242, 23001]), ('normal control', {'lines': [[1785, False]], 'rate_bp': 1510}, [1785, 0, 1785]), ('normal control', {'lines': [[11, True], [30948, False]], 'rate_bp': 1000}, [30959, 1, 30960]), ('normal control', {'lines': [[20, False]], 'rate_bp': 50}, [20, 0, 20]), ('normal control', {'lines': [[13, True]], 'rate_bp': 825}, [13, 1, 14])], [('regression', {'lines': [[-30781, False], [-35543, True], [34368, True]], 'rate_bp': 50}, [-31956, -6, -31962]), ('regression', {'lines': [[27, True], [-11860, True], [-39505, True], [21922, True]], 'rate_bp': 825}, [-29416, -2426, -31842]), ('partial-repair probe', {'lines': [[30278, True], [-25624, False], [18105, True]], 'rate_bp': 50}, [22759, 242, 23001]), ('partial-repair probe', {'lines': [[-25232, False], [10, True]], 'rate_bp': 825}, [-25222, 1, -25221]), ('normal control', {'lines': [[7, True]], 'rate_bp': 725}, [7, 1, 8]), ('normal control', {'lines': [[49780, False], [72791, False]], 'rate_bp': 725}, [122571, 0, 122571]), ('normal control', {'lines': [[66301, True], [16, True], [10, False], [37, False]], 'rate_bp': 725}, [66364, 4808, 71172]), ('normal control', {'lines': [[91, False]], 'rate_bp': 12}, [91, 0, 91])], [('regression', {'lines': [[3, True], [-21770, True], [51, True], [-55198, False], [12289, False]], 'rate_bp': 825}, [-64625, -1792, -66417]), ('regression', {'lines': [[-17245, True], [79270, True], [25, True], [-36068, True]], 'rate_bp': 720}, [25982, 1870, 27852]), ('partial-repair probe', {'lines': [[-25232, False], [10, True]], 'rate_bp': 825}, [-25222, 1, -25221]), ('partial-repair probe', {'lines': [[-59554, False], [89, True], [-10465, False], [69423, False]], 'rate_bp': 1000}, [-507, 9, -498]), ('normal control', {'lines': [[25, True]], 'rate_bp': 825}, [25, 2, 27]), ('normal control', {'lines': [[19129, False]], 'rate_bp': 725}, [19129, 0, 19129]), ('normal control', {'lines': [[84, False]], 'rate_bp': 1355}, [84, 0, 84]), ('normal control', {'lines': [[35, True]], 'rate_bp': 50}, [35, 0, 35])], [('regression', {'lines': [[-45541, False], [-19439, False], [-33085, True], [-32736, True], [-53476, False]], 'rate_bp': 2000}, [-184277, -13164, -197441]), ('regression', {'lines': [[74, True], [-48741, True], [16317, True], [-6432, True]], 'rate_bp': 1000}, [-38782, -3878, -42660]), ('partial-repair probe', {'lines': [[-59554, False], [89, True], [-10465, False], [69423, False]], 'rate_bp': 1000}, [-507, 9, -498]), ('partial-repair probe', {'lines': [[-25891, False]], 'rate_bp': 50}, [-25891, 0, -25891]), ('normal control', {'lines': [[95, True]], 'rate_bp': 2000}, [95, 19, 114]), ('normal control', {'lines': [[30480, True], [19, True], [32317, True]], 'rate_bp': 2002}, [62816, 12576, 75392]), ('normal control', {'lines': [[1, False]], 'rate_bp': 50}, [1, 0, 1]), ('normal control', {'lines': [[95, True], [43198, False], [26, True], [47914, True], [10383, True]], 'rate_bp': 1897}, [101616, 11082, 112698])]]\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":"edea3153b3616a084733e511edf358d8ef9bc41e3e04752be34145355e9467f2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    parts = []\n    for amt, taxable in x['lines']:\n        if taxable and amt > 0:\n            parts.append(amt * x['rate_bp'])\n    def hr(n):\n        t = (abs(n) * 2 + 10000) // 20000\n        return t if n >= 0 else -t\n    tax = sum(hr(n) for n in parts)\n    sub = sum(a for a, t in x['lines'])\n    return [sub, tax, sub + tax]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'lines': [[-30768, True], [88008, True], [58540, True], [-18089, False]], 'rate_bp': 50}, [97691, 579, 98270]), ('regression', {'lines': [[53, True], [-19388, True], [67, True]], 'rate_bp': 2000}, [-19268, -3854, -23122]), ('partial-repair probe', {'lines': [[-51735, False]], 'rate_bp': 2267}, [-51735, 0, -51735]), ('partial-repair probe', {'lines': [[-42950, False], [83094, False], [74700, False], [-33526, False]], 'rate_bp': 725}, [81318, 0, 81318]), ('normal control', {'lines': [[70, True]], 'rate_bp': 825}, [70, 6, 76]), ('normal control', {'lines': [[52, True], [19, False], [14472, True], [91, False]], 'rate_bp': 297}, [14634, 432, 15066]), ('normal control', {'lines': [[78656, True]], 'rate_bp': 1498}, [78656, 11783, 90439]), ('normal control', {'lines': [[74, True], [81059, True], [70668, True]], 'rate_bp': 825}, [151801, 12523, 164324])], [('regression', {'lines': [[-12837, True], [-41474, True], [88408, True], [-5186, False]], 'rate_bp': 1738}, [28911, 5926, 34837]), ('regression', {'lines': [[53, True], [-19388, True], [67, True]], 'rate_bp': 2000}, [-19268, -3854, -23122]), ('partial-repair probe', {'lines': [[-42950, False], [83094, False], [74700, False], [-33526, False]], 'rate_bp': 725}, [81318, 0, 81318]), ('partial-repair probe', {'lines': [[30278, True], [-25624, False], [18105, True]], 'rate_bp': 50}, [22759, 242, 23001]), ('normal control', {'lines': [[1785, False]], 'rate_bp': 1510}, [1785, 0, 1785]), ('normal control', {'lines': [[11, True], [30948, False]], 'rate_bp': 1000}, [30959, 1, 30960]), ('normal control', {'lines': [[20, False]], 'rate_bp': 50}, [20, 0, 20]), ('normal control', {'lines': [[13, True]], 'rate_bp': 825}, [13, 1, 14])], [('regression', {'lines': [[-30781, False], [-35543, True], [34368, True]], 'rate_bp': 50}, [-31956, -6, -31962]), ('regression', {'lines': [[27, True], [-11860, True], [-39505, True], [21922, True]], 'rate_bp': 825}, [-29416, -2426, -31842]), ('partial-repair probe', {'lines': [[30278, True], [-25624, False], [18105, True]], 'rate_bp': 50}, [22759, 242, 23001]), ('partial-repair probe', {'lines': [[-25232, False], [10, True]], 'rate_bp': 825}, [-25222, 1, -25221]), ('normal control', {'lines': [[7, True]], 'rate_bp': 725}, [7, 1, 8]), ('normal control', {'lines': [[49780, False], [72791, False]], 'rate_bp': 725}, [122571, 0, 122571]), ('normal control', {'lines': [[66301, True], [16, True], [10, False], [37, False]], 'rate_bp': 725}, [66364, 4808, 71172]), ('normal control', {'lines': [[91, False]], 'rate_bp': 12}, [91, 0, 91])], [('regression', {'lines': [[3, True], [-21770, True], [51, True], [-55198, False], [12289, False]], 'rate_bp': 825}, [-64625, -1792, -66417]), ('regression', {'lines': [[-17245, True], [79270, True], [25, True], [-36068, True]], 'rate_bp': 720}, [25982, 1870, 27852]), ('partial-repair probe', {'lines': [[-25232, False], [10, True]], 'rate_bp': 825}, [-25222, 1, -25221]), ('partial-repair probe', {'lines': [[-59554, False], [89, True], [-10465, False], [69423, False]], 'rate_bp': 1000}, [-507, 9, -498]), ('normal control', {'lines': [[25, True]], 'rate_bp': 825}, [25, 2, 27]), ('normal control', {'lines': [[19129, False]], 'rate_bp': 725}, [19129, 0, 19129]), ('normal control', {'lines': [[84, False]], 'rate_bp': 1355}, [84, 0, 84]), ('normal control', {'lines': [[35, True]], 'rate_bp': 50}, [35, 0, 35])], [('regression', {'lines': [[-45541, False], [-19439, False], [-33085, True], [-32736, True], [-53476, False]], 'rate_bp': 2000}, [-184277, -13164, -197441]), ('regression', {'lines': [[74, True], [-48741, True], [16317, True], [-6432, True]], 'rate_bp': 1000}, [-38782, -3878, -42660]), ('partial-repair probe', {'lines': [[-59554, False], [89, True], [-10465, False], [69423, False]], 'rate_bp': 1000}, [-507, 9, -498]), ('partial-repair probe', {'lines': [[-25891, False]], 'rate_bp': 50}, [-25891, 0, -25891]), ('normal control', {'lines': [[95, True]], 'rate_bp': 2000}, [95, 19, 114]), ('normal control', {'lines': [[30480, True], [19, True], [32317, True]], 'rate_bp': 2002}, [62816, 12576, 75392]), ('normal control', {'lines': [[1, False]], 'rate_bp': 50}, [1, 0, 1]), ('normal control', {'lines': [[95, True], [43198, False], [26, True], [47914, True], [10383, True]], 'rate_bp': 1897}, [101616, 11082, 112698])]]\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-proration-line-tax-credit-line-tax-reversal","generated_at":"2026-09-29T14:46:37.195247+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Credit lines on a prorated invoice must reverse the tax charged on the original period.","root_cause":"Negative credit lines are skipped when computing tax.","sha256":"54a8998354c825e135f17d5f4db4ea2447283b2ffb16b4810a7606001d2382d1","title":"Sales tax on proration credit and debit lines: credit line tax reversal · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":44.657,"exit_code":1,"observations":[{"actual":[97691,489,98180],"check":"regression 0","expected":[97691,579,98270],"passed":false},{"actual":[-19268,-3854,-23122],"check":"regression 1","expected":[-19268,-3854,-23122],"passed":true},{"actual":[-51735,-11728,-63463],"check":"partial-repair probe 2","expected":[-51735,0,-51735],"passed":false},{"actual":[81318,-5545,75773],"check":"partial-repair probe 3","expected":[81318,0,81318],"passed":false},{"actual":[70,6,76],"check":"normal control 4","expected":[70,6,76],"passed":true},{"actual":[14634,432,15066],"check":"normal control 5","expected":[14634,432,15066],"passed":true},{"actual":[78656,11783,90439],"check":"normal control 6","expected":[78656,11783,90439],"passed":true},{"actual":[151801,12523,164324],"check":"normal control 7","expected":[151801,12523,164324],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [97691, 489, 98180], \"expected\": [97691, 579, 98270], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [-19268, -3854, -23122], \"expected\": [-19268, -3854, -23122], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [-51735, -11728, -63463], \"expected\": [-51735, 0, -51735], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [81318, -5545, 75773], \"expected\": [81318, 0, 81318], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [70, 6, 76], \"expected\": [70, 6, 76], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [14634, 432, 15066], \"expected\": [14634, 432, 15066], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [78656, 11783, 90439], \"expected\": [78656, 11783, 90439], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [151801, 12523, 164324], \"expected\": [151801, 12523, 164324], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.455,"exit_code":1,"observations":[{"actual":[97691,733,98424],"check":"regression 0","expected":[97691,579,98270],"passed":false},{"actual":[-19268,24,-19244],"check":"regression 1","expected":[-19268,-3854,-23122],"passed":false},{"actual":[-51735,0,-51735],"check":"partial-repair probe 2","expected":[-51735,0,-51735],"passed":true},{"actual":[81318,0,81318],"check":"partial-repair probe 3","expected":[81318,0,81318],"passed":true},{"actual":[70,6,76],"check":"normal control 4","expected":[70,6,76],"passed":true},{"actual":[14634,432,15066],"check":"normal control 5","expected":[14634,432,15066],"passed":true},{"actual":[78656,11783,90439],"check":"normal control 6","expected":[78656,11783,90439],"passed":true},{"actual":[151801,12523,164324],"check":"normal control 7","expected":[151801,12523,164324],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [97691, 733, 98424], \"expected\": [97691, 579, 98270], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [-19268, 24, -19244], \"expected\": [-19268, -3854, -23122], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [-51735, 0, -51735], \"expected\": [-51735, 0, -51735], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [81318, 0, 81318], \"expected\": [81318, 0, 81318], \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": [70, 6, 76], \"expected\": [70, 6, 76], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [14634, 432, 15066], \"expected\": [14634, 432, 15066], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [78656, 11783, 90439], \"expected\": [78656, 11783, 90439], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [151801, 12523, 164324], \"expected\": [151801, 12523, 164324], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}