{"abstract":"Tax in the second bracket also re-taxes the first bracket's income.","category":"Tax bracket computation","checks":6,"contract":"solve(income, brackets): brackets is [[upper, rate_percent], ...] with strictly increasing positive uppers and a final open bracket [None, rate]; otherwise return 'ERR:brackets'. Each rate applies only to the slice of income in (previous upper, upper]. Negative income is taxed as zero. The tax is summed exactly and rounded half-up to cents once, returned as integer cents.","contract_signature":"income, brackets","evaluation_group":"w2-tax_bracket_computation-progressive-marginal-slices","failed_approach":"Counting the slice as inclusive of both endpoints (top - lower + 1) overstates each upper bracket by one dollar.","family":"w2-tax_bracket_computation-progressive-marginal-slices-slice-width","id":"FA-62346","implementations":{"attempt":{"sha256":"98693f6f29dcf43299511a4502cfd46560baf94b4e496d816d6a2636bb9c1785","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(income, brackets):\n    if not brackets or brackets[-1][0] is not None: return 'ERR:brackets'\n    uppers = [u for u, _ in brackets[:-1]]\n    if any(b <= a for a, b in zip([0] + uppers, uppers)): return 'ERR:brackets'\n    x = max(0, income)\n    tax, lower = Fraction(0), 0\n    for upper, rate in brackets:\n        top = x if upper is None else min(x, upper)\n        if top > lower:\n            tax += (top - lower + (1 if lower else 0)) * Fraction(rate) / 100\n        if upper is None or x <= upper: break\n        lower = upper\n    return int(tax * 100 + Fraction(1, 2))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression slice-width 1', (50000, [[10000, '10'], [40000, '12'], [None, '22']]), 680000),\n  ('regression slice-width 2', (40001, [[10000, '10'], [40000, '12'], [None, '22']]), 460022),\n  ('control: at first threshold', (10000, [[10000, '10'], [40000, '12'], [None, '22']]), 100000),\n  ('control: zero', (0, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: negative', (-5, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: fractional rate', (12345, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   126140)],\n [('regression slice-width 1', (12345, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   126140),\n  ('regression slice-width 2', (250001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   5917183),\n  ('control: negative', (-5, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: one over threshold', (40001, [[10000, '10'], [40000, '12'], [None, '22']]), 460022),\n  ('control: non increasing', (10000, [[10000, '10'], [5000, '20'], [None, '30']]), 'ERR:brackets'),\n  ('control: closed top', (10, [[10000, '10'], [20000, '20']]), 'ERR:brackets')],\n [('regression slice-width 1', (232540, [[34000, '22'], [101000, '15'], [147000, '10'], [184000, '10'], [None, '30']]),\n   4039200),\n  ('regression slice-width 2', (236107, [[31000, '10'], [159000, '10'], [172000, '24'], [193000, '22'], [None, '45']]),\n   4303815),\n  ('control: non increasing', (10000, [[10000, '10'], [5000, '20'], [None, '30']]), 'ERR:brackets'),\n  ('control: closed top', (10, [[10000, '10'], [20000, '20']]), 'ERR:brackets'),\n  ('control: high earner', (250001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   5917183),\n  ('control: single bracket', (777, [[None, '12.5']]), 9713)],\n [('regression slice-width 1', (221539, [[9000, '24'], [72000, '5'], [91000, '33.3'], [101000, '5'], [None, '37']]),\n   5673643),\n  ('regression slice-width 2', (64068, [[32000, '22'], [105000, '10'], [170000, '24'], [193000, '10'], [None, '37']]),\n   1024680),\n  ('control: single bracket', (777, [[None, '12.5']]), 9713),\n  ('control: three brackets', (50000, [[10000, '10'], [40000, '12'], [None, '22']]), 680000),\n  ('control: at first threshold', (10000, [[10000, '10'], [40000, '12'], [None, '22']]), 100000),\n  ('control: zero', (0, [[10000, '10'], [40000, '12'], [None, '22']]), 0)],\n [('regression slice-width 1', (161544, [[108000, '22'], [122000, '12.5'], [192000, '10'], [None, '30']]), 2946440),\n  ('regression slice-width 2', (84182, [[82000, '12.5'], [138000, '22'], [161000, '15'], [None, '37']]), 1073004),\n  ('control: zero', (0, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: negative', (-5, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: one over threshold', (40001, [[10000, '10'], [40000, '12'], [None, '22']]), 460022),\n  ('control: fractional rate', (12345, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   126140)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, 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":"302e0cf27649205ee6a2ceca8439117c7c197dc0977ca49d1f3f20f070912b64","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(income, brackets):\n    if not brackets or brackets[-1][0] is not None: return 'ERR:brackets'\n    uppers = [u for u, _ in brackets[:-1]]\n    if any(b <= a for a, b in zip([0] + uppers, uppers)): return 'ERR:brackets'\n    x = max(0, income)\n    tax, lower = Fraction(0), 0\n    for upper, rate in brackets:\n        top = x if upper is None else min(x, upper)\n        if top > lower:\n            tax += top * Fraction(rate) / 100\n        if upper is None or x <= upper: break\n        lower = upper\n    return int(tax * 100 + Fraction(1, 2))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression slice-width 1', (50000, [[10000, '10'], [40000, '12'], [None, '22']]), 680000),\n  ('regression slice-width 2', (40001, [[10000, '10'], [40000, '12'], [None, '22']]), 460022),\n  ('control: at first threshold', (10000, [[10000, '10'], [40000, '12'], [None, '22']]), 100000),\n  ('control: zero', (0, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: negative', (-5, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: fractional rate', (12345, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   126140)],\n [('regression slice-width 1', (12345, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   126140),\n  ('regression slice-width 2', (250001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   5917183),\n  ('control: negative', (-5, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: one over threshold', (40001, [[10000, '10'], [40000, '12'], [None, '22']]), 460022),\n  ('control: non increasing', (10000, [[10000, '10'], [5000, '20'], [None, '30']]), 'ERR:brackets'),\n  ('control: closed top', (10, [[10000, '10'], [20000, '20']]), 'ERR:brackets')],\n [('regression slice-width 1', (232540, [[34000, '22'], [101000, '15'], [147000, '10'], [184000, '10'], [None, '30']]),\n   4039200),\n  ('regression slice-width 2', (236107, [[31000, '10'], [159000, '10'], [172000, '24'], [193000, '22'], [None, '45']]),\n   4303815),\n  ('control: non increasing', (10000, [[10000, '10'], [5000, '20'], [None, '30']]), 'ERR:brackets'),\n  ('control: closed top', (10, [[10000, '10'], [20000, '20']]), 'ERR:brackets'),\n  ('control: high earner', (250001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   5917183),\n  ('control: single bracket', (777, [[None, '12.5']]), 9713)],\n [('regression slice-width 1', (221539, [[9000, '24'], [72000, '5'], [91000, '33.3'], [101000, '5'], [None, '37']]),\n   5673643),\n  ('regression slice-width 2', (64068, [[32000, '22'], [105000, '10'], [170000, '24'], [193000, '10'], [None, '37']]),\n   1024680),\n  ('control: single bracket', (777, [[None, '12.5']]), 9713),\n  ('control: three brackets', (50000, [[10000, '10'], [40000, '12'], [None, '22']]), 680000),\n  ('control: at first threshold', (10000, [[10000, '10'], [40000, '12'], [None, '22']]), 100000),\n  ('control: zero', (0, [[10000, '10'], [40000, '12'], [None, '22']]), 0)],\n [('regression slice-width 1', (161544, [[108000, '22'], [122000, '12.5'], [192000, '10'], [None, '30']]), 2946440),\n  ('regression slice-width 2', (84182, [[82000, '12.5'], [138000, '22'], [161000, '15'], [None, '37']]), 1073004),\n  ('control: zero', (0, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: negative', (-5, [[10000, '10'], [40000, '12'], [None, '22']]), 0),\n  ('control: one over threshold', (40001, [[10000, '10'], [40000, '12'], [None, '22']]), 460022),\n  ('control: fractional rate', (12345, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),\n   126140)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, 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 teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. 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-tax_bracket_computation-progressive-marginal-slices-slice-width","generated_at":"2026-09-29T14:47:03.810901+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Tax computations hinge on which slice, threshold, ordering and rounding rule applies at each step; a misplaced boundary silently misstates liabilities.","root_cause":"The slice uses top instead of top - lower.","sha256":"5f7eccbdfb47546b1d9d0a4f26833a6893aaf37b1f1c075c54228a8c8df4dcbf","title":"Each bracket rate is applied to income measured from zero · 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":43.19,"exit_code":1,"observations":[{"actual":680034,"check":"regression slice-width 1","expected":680000,"passed":false},{"actual":460056,"check":"regression slice-width 2","expected":460022,"passed":false},{"actual":100000,"check":"control: at first threshold","expected":100000,"passed":true},{"actual":0,"check":"control: zero","expected":0,"passed":true},{"actual":0,"check":"control: negative","expected":0,"passed":true},{"actual":126152,"check":"control: fractional rate","expected":126140,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression slice-width 1\", \"actual\": 680034, \"expected\": 680000, \"passed\": false}, {\"check\": \"regression slice-width 2\", \"actual\": 460056, \"expected\": 460022, \"passed\": false}, {\"check\": \"control: at first threshold\", \"actual\": 100000, \"expected\": 100000, \"passed\": true}, {\"check\": \"control: zero\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: negative\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: fractional rate\", \"actual\": 126152, \"expected\": 126140, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.352,"exit_code":1,"observations":[{"actual":1680000,"check":"regression slice-width 1","expected":680000,"passed":false},{"actual":1460022,"check":"regression slice-width 2","expected":460022,"passed":false},{"actual":100000,"check":"control: at first threshold","expected":100000,"passed":true},{"actual":0,"check":"control: zero","expected":0,"passed":true},{"actual":0,"check":"control: negative","expected":0,"passed":true},{"actual":258140,"check":"control: fractional rate","expected":126140,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression slice-width 1\", \"actual\": 1680000, \"expected\": 680000, \"passed\": false}, {\"check\": \"regression slice-width 2\", \"actual\": 1460022, \"expected\": 460022, \"passed\": false}, {\"check\": \"control: at first threshold\", \"actual\": 100000, \"expected\": 100000, \"passed\": true}, {\"check\": \"control: zero\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: negative\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: fractional rate\", \"actual\": 258140, \"expected\": 126140, \"passed\": false}], \"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."}}