{"abstract":"A filer with small investment income pays surtax on their wages above the threshold.","category":"Tax bracket computation","checks":6,"contract":"solve(nii, magi, status): stipulated 3.8% surtax on the lesser of net investment income and MAGI above the status threshold (single 200000, mfj 250000, mfs 125000), where neither amount counts below zero. Amounts are whole dollars; return the surtax in integer cents rounded half-up.","evaluation_group":"w2-tax_bracket_computation-net-investment-surtax","failed_approach":"Taking the lesser of NII and total MAGI omits the threshold.","family":"w2-tax_bracket_computation-net-investment-surtax-lesser-of","id":"FA-62561","implementations":{"attempt":{"sha256":"31db5623aa3c66d1bd372702ba6c5fdf18ee8652611120cf4a1103536f8c6510","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(nii, magi, status):\n    thr = {'single': 200000, 'mfj': 250000, 'mfs': 125000}[status]\n    base = max(0, min(nii, magi))\n    return int(base * Fraction(38, 10) + Fraction(1, 2))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression lesser-of 1', (20000, 300000, 'mfj'), 76000),\n  ('regression lesser-of 2', (50000, 230000, 'single'), 114000),\n  ('partial repair guard 2', (5001, 130000, 'mfs'), 19000), ('control: investment loss', (-4000, 400000, 'single'), 0),\n  ('control: below threshold', (10000, 190000, 'single'), 0), ('control: odd dollars', (7, 400000, 'mfj'), 27)],\n [('regression lesser-of 1', (5001, 130000, 'mfs'), 19000), ('regression lesser-of 2', (-4000, 400000, 'single'), 0),\n  ('partial repair guard 1', (10000, 190000, 'single'), 0), ('partial repair guard 2', (42884, 250001, 'mfj'), 4),\n  ('control: odd dollars', (7, 400000, 'mfj'), 27), ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000)],\n [('regression lesser-of 1', (10000, 190000, 'single'), 0), ('regression lesser-of 2', (7, 400000, 'mfj'), 27),\n  ('partial repair guard 1', (13, 125001, 'single'), 0), ('partial repair guard 2', (7, 200001, 'single'), 4),\n  ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000), ('control: separate filer', (5001, 130000, 'mfs'), 19000),\n  ('control: investment loss', (-4000, 400000, 'single'), 0)],\n [('regression lesser-of 1', (13, 250001, 'single'), 49), ('regression lesser-of 2', (42884, 250001, 'mfj'), 4),\n  ('partial repair guard 1', (13, 250001, 'mfj'), 4), ('partial repair guard 2', (13, 200001, 'mfj'), 0),\n  ('control: investment loss', (-4000, 400000, 'single'), 0),\n  ('control: below threshold', (10000, 190000, 'single'), 0), ('control: odd dollars', (7, 400000, 'mfj'), 27),\n  ('control: excess binding', (50000, 230000, 'single'), 114000)],\n [('regression lesser-of 1', (0, 200001, 'mfs'), 0), ('regression lesser-of 2', (13, 125001, 'single'), 0),\n  ('partial repair guard 1', (13, 125001, 'mfs'), 4), ('partial repair guard 2', (16055, 250001, 'mfj'), 4),\n  ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000), ('control: separate filer', (5001, 130000, 'mfs'), 19000),\n  ('control: investment loss', (-4000, 400000, 'single'), 0)]]\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":"df109fe65ae1bfb035709427e4c3f8f904c9d6f548cd59bdca6a2ef7540598da","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(nii, magi, status):\n    thr = {'single': 200000, 'mfj': 250000, 'mfs': 125000}[status]\n    base = max(0, max(nii, magi - thr))\n    return int(base * Fraction(38, 10) + Fraction(1, 2))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression lesser-of 1', (20000, 300000, 'mfj'), 76000),\n  ('regression lesser-of 2', (50000, 230000, 'single'), 114000),\n  ('partial repair guard 2', (5001, 130000, 'mfs'), 19000), ('control: investment loss', (-4000, 400000, 'single'), 0),\n  ('control: below threshold', (10000, 190000, 'single'), 0), ('control: odd dollars', (7, 400000, 'mfj'), 27)],\n [('regression lesser-of 1', (5001, 130000, 'mfs'), 19000), ('regression lesser-of 2', (-4000, 400000, 'single'), 0),\n  ('partial repair guard 1', (10000, 190000, 'single'), 0), ('partial repair guard 2', (42884, 250001, 'mfj'), 4),\n  ('control: odd dollars', (7, 400000, 'mfj'), 27), ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000)],\n [('regression lesser-of 1', (10000, 190000, 'single'), 0), ('regression lesser-of 2', (7, 400000, 'mfj'), 27),\n  ('partial repair guard 1', (13, 125001, 'single'), 0), ('partial repair guard 2', (7, 200001, 'single'), 4),\n  ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000), ('control: separate filer', (5001, 130000, 'mfs'), 19000),\n  ('control: investment loss', (-4000, 400000, 'single'), 0)],\n [('regression lesser-of 1', (13, 250001, 'single'), 49), ('regression lesser-of 2', (42884, 250001, 'mfj'), 4),\n  ('partial repair guard 1', (13, 250001, 'mfj'), 4), ('partial repair guard 2', (13, 200001, 'mfj'), 0),\n  ('control: investment loss', (-4000, 400000, 'single'), 0),\n  ('control: below threshold', (10000, 190000, 'single'), 0), ('control: odd dollars', (7, 400000, 'mfj'), 27),\n  ('control: excess binding', (50000, 230000, 'single'), 114000)],\n [('regression lesser-of 1', (0, 200001, 'mfs'), 0), ('regression lesser-of 2', (13, 125001, 'single'), 0),\n  ('partial repair guard 1', (13, 125001, 'mfs'), 4), ('partial repair guard 2', (16055, 250001, 'mfj'), 4),\n  ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000), ('control: separate filer', (5001, 130000, 'mfs'), 19000),\n  ('control: investment loss', (-4000, 400000, 'single'), 0)]]\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"},"fixed":{"sha256":"ae83d1bcadde9aad7b185214147d11fa75be3a0076b784dac642798c55048d12","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(nii, magi, status):\n    thr = {'single': 200000, 'mfj': 250000, 'mfs': 125000}[status]\n    base = max(0, min(nii, magi - thr))\n    return int(base * Fraction(38, 10) + Fraction(1, 2))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression lesser-of 1', (20000, 300000, 'mfj'), 76000),\n  ('regression lesser-of 2', (50000, 230000, 'single'), 114000),\n  ('partial repair guard 2', (5001, 130000, 'mfs'), 19000), ('control: investment loss', (-4000, 400000, 'single'), 0),\n  ('control: below threshold', (10000, 190000, 'single'), 0), ('control: odd dollars', (7, 400000, 'mfj'), 27)],\n [('regression lesser-of 1', (5001, 130000, 'mfs'), 19000), ('regression lesser-of 2', (-4000, 400000, 'single'), 0),\n  ('partial repair guard 1', (10000, 190000, 'single'), 0), ('partial repair guard 2', (42884, 250001, 'mfj'), 4),\n  ('control: odd dollars', (7, 400000, 'mfj'), 27), ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000)],\n [('regression lesser-of 1', (10000, 190000, 'single'), 0), ('regression lesser-of 2', (7, 400000, 'mfj'), 27),\n  ('partial repair guard 1', (13, 125001, 'single'), 0), ('partial repair guard 2', (7, 200001, 'single'), 4),\n  ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000), ('control: separate filer', (5001, 130000, 'mfs'), 19000),\n  ('control: investment loss', (-4000, 400000, 'single'), 0)],\n [('regression lesser-of 1', (13, 250001, 'single'), 49), ('regression lesser-of 2', (42884, 250001, 'mfj'), 4),\n  ('partial repair guard 1', (13, 250001, 'mfj'), 4), ('partial repair guard 2', (13, 200001, 'mfj'), 0),\n  ('control: investment loss', (-4000, 400000, 'single'), 0),\n  ('control: below threshold', (10000, 190000, 'single'), 0), ('control: odd dollars', (7, 400000, 'mfj'), 27),\n  ('control: excess binding', (50000, 230000, 'single'), 114000)],\n [('regression lesser-of 1', (0, 200001, 'mfs'), 0), ('regression lesser-of 2', (13, 125001, 'single'), 0),\n  ('partial repair guard 1', (13, 125001, 'mfs'), 4), ('partial repair guard 2', (16055, 250001, 'mfj'), 4),\n  ('control: excess binding', (50000, 230000, 'single'), 114000),\n  ('control: nii binding', (20000, 300000, 'mfj'), 76000), ('control: separate filer', (5001, 130000, 'mfs'), 19000),\n  ('control: investment loss', (-4000, 400000, 'single'), 0)]]\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-net-investment-surtax-lesser-of","generated_at":"2026-09-29T14:47:05.817639+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.","repair":"Tax the lesser of NII and MAGI above the threshold.","root_cause":"max() is used where the lesser amount is required.","sha256":"35a48df1989c1e577e33bfd49eef0f9d237f9870eba255cb8287d938a7812c78","title":"The surtax is levied on the greater of NII and the MAGI excess · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.034,"exit_code":1,"observations":[{"actual":76000,"check":"regression lesser-of 1","expected":76000,"passed":true},{"actual":190000,"check":"regression lesser-of 2","expected":114000,"passed":false},{"actual":19004,"check":"partial repair guard 2","expected":19000,"passed":false},{"actual":0,"check":"control: investment loss","expected":0,"passed":true},{"actual":38000,"check":"control: below threshold","expected":0,"passed":false},{"actual":27,"check":"control: odd dollars","expected":27,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression lesser-of 1\", \"actual\": 76000, \"expected\": 76000, \"passed\": true}, {\"check\": \"regression lesser-of 2\", \"actual\": 190000, \"expected\": 114000, \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": 19004, \"expected\": 19000, \"passed\": false}, {\"check\": \"control: investment loss\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: below threshold\", \"actual\": 38000, \"expected\": 0, \"passed\": false}, {\"check\": \"control: odd dollars\", \"actual\": 27, \"expected\": 27, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.471,"exit_code":1,"observations":[{"actual":190000,"check":"regression lesser-of 1","expected":76000,"passed":false},{"actual":190000,"check":"regression lesser-of 2","expected":114000,"passed":false},{"actual":19004,"check":"partial repair guard 2","expected":19000,"passed":false},{"actual":760000,"check":"control: investment loss","expected":0,"passed":false},{"actual":38000,"check":"control: below threshold","expected":0,"passed":false},{"actual":570000,"check":"control: odd dollars","expected":27,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression lesser-of 1\", \"actual\": 190000, \"expected\": 76000, \"passed\": false}, {\"check\": \"regression lesser-of 2\", \"actual\": 190000, \"expected\": 114000, \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": 19004, \"expected\": 19000, \"passed\": false}, {\"check\": \"control: investment loss\", \"actual\": 760000, \"expected\": 0, \"passed\": false}, {\"check\": \"control: below threshold\", \"actual\": 38000, \"expected\": 0, \"passed\": false}, {\"check\": \"control: odd dollars\", \"actual\": 570000, \"expected\": 27, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.385,"exit_code":0,"observations":[{"actual":76000,"check":"regression lesser-of 1","expected":76000,"passed":true},{"actual":114000,"check":"regression lesser-of 2","expected":114000,"passed":true},{"actual":19000,"check":"partial repair guard 2","expected":19000,"passed":true},{"actual":0,"check":"control: investment loss","expected":0,"passed":true},{"actual":0,"check":"control: below threshold","expected":0,"passed":true},{"actual":27,"check":"control: odd dollars","expected":27,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression lesser-of 1\", \"actual\": 76000, \"expected\": 76000, \"passed\": true}, {\"check\": \"regression lesser-of 2\", \"actual\": 114000, \"expected\": 114000, \"passed\": true}, {\"check\": \"partial repair guard 2\", \"actual\": 19000, \"expected\": 19000, \"passed\": true}, {\"check\": \"control: investment loss\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: below threshold\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"control: odd dollars\", \"actual\": 27, \"expected\": 27, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}